Skip to content

Commit 6ace8c6

Browse files
committed
Fix CI verification of templates failure.
1 parent 01c516d commit 6ace8c6

3 files changed

Lines changed: 15 additions & 9 deletions

File tree

‎packages/purestack/src/cli/terminal/commands.test.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@ import { changeDirectoryCommand } from './commands'
77

88
let temporary: string
99
beforeAll(async () => {
10-
temporary = await mkdtemp(path.join(tmpdir(), 'purestack-shell-'))
10+
// Shells keep the form they start in: RUNNER~1 on Windows, /private/var on macOS.
11+
temporary = await realpath(
12+
await mkdtemp(path.join(tmpdir(), 'purestack-shell-')),
13+
)
1114
})
1215
afterAll(async () => {
13-
expect(path.dirname(path.resolve(temporary))).toBe(path.resolve(tmpdir()))
16+
expect(path.dirname(temporary)).toBe(await realpath(tmpdir()))
1417
expect(path.basename(temporary)).toMatch(/^purestack-shell-/)
1518
await rm(temporary, { recursive: true, force: true })
1619
})

‎scripts/verify-templates.ts‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
runPackageManager,
99
} from '../packages/purestack/src/init/package-manager'
1010
import { runProcess } from '../packages/purestack/src/init/process'
11+
import { resolveCoreSiteConfig } from '../packages/ts-ssg/src/config/core-config'
1112
import { workspaceManifestPaths } from './workspaces'
1213

1314
const root = process.cwd()
@@ -117,14 +118,16 @@ async function main() {
117118
if (typeof project.scripts?.[script] === 'string')
118119
await runPackageManager(manager, ['run', script], directory)
119120
}
120-
for (const output of ['site', 'publish']) {
121-
const html = await readFile(
122-
path.join(directory, 'dist', output, 'index.html'),
123-
'utf8',
124-
)
121+
// Each template chooses its output folders; resolve them as the build does.
122+
const { outDir, publishDir } = resolveCoreSiteConfig({
123+
rootDir: directory,
124+
contentDir: path.join(directory, 'content'),
125+
})
126+
for (const output of [outDir, publishDir]) {
127+
const html = await readFile(path.join(output, 'index.html'), 'utf8')
125128
assert(
126129
html.includes('Template verification'),
127-
`${output} is missing the customized title.`,
130+
`${path.relative(directory, output)} is missing the customized title.`,
128131
)
129132
}
130133
console.log(`Verified ${template.manifest.name}.`)

‎templates/starter/template/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Run `yarn install` if dependencies were not installed during creation, then
1818
- `content/hello.ts` demonstrates browser behavior loaded with `PageScript`.
1919
- Add plugins to `content/purestack.config.ts` for custom components and themes.
2020

21-
Run `yarn build` to generate `dist/site`. Run `yarn publish` to create
21+
Run `yarn build` to generate `dist/dev`. Run `yarn publish` to create
2222
a clean, minified release in `dist/publish`. These commands write local files;
2323
deploy the release folder with your static hosting provider.
2424

0 commit comments

Comments
 (0)