Skip to content

Commit e8e360b

Browse files
committed
Bump version
1 parent 3fb53d3 commit e8e360b

34 files changed

Lines changed: 94 additions & 67 deletions

File tree

‎docs/template-scaffolding.md‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ template-defined categories, configuration bindings, and extension points.
1818
- Git initialization is opt-in with `--git`; never create an initial commit.
1919
- Accept explicit npm package versions and local `.tgz` files or package folders.
2020
- Require an absent or empty destination. Stage and validate before writing.
21-
- Check compatibility against the running CLI and pin that exact PureStack version.
21+
- Check template compatibility against the running CLI. Keep the template's dependency selectors; the starter uses `latest` for PureStack packages.
2222
- Preserve generated files if installation or Git initialization fails, with retry
2323
instructions and a failing exit status.
2424

@@ -44,12 +44,14 @@ project, including `package.json`, `README.md`, `AGENTS.md`, and
4444
Project dependencies must use registry versions, ranges, tags, or `npm:` aliases.
4545
Workspace references, local paths, Git sources, and tarball URLs are rejected.
4646

47-
The generated package name, `purestack` dependency, site title, and logo brand
47+
The generated package name, site title, and logo brand
4848
are customized. Template-defined option bindings can configure appearance,
4949
features, publishing, and plugin settings. Unspecified values use the template's
50-
declared defaults. The `purestack` dependency uses the literal
51-
`{{purestackVersion}}` in the source template. Other `@purestack/*` dependencies
52-
can use the same token to share the CLI's product version, including test helpers.
50+
declared defaults. The starter declares `purestack` and its `@purestack/*`
51+
dependencies as `latest`. The package manager resolves their current published
52+
releases during installation and records the exact versions in the project's
53+
lockfile. The CLI preserves template dependency selectors instead of pinning them
54+
to its own version. Templates can also declare published versions, ranges, and tags.
5355
Keep `.gitignore` and `.yarnrc.yml` under their real names and explicitly include
5456
`template/.gitignore` and `template/.yarnrc.yml` in the package's `files` list.
5557
`yarn package` and `yarn publish-package` use npm to pack templates, preserving

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
33
"name": "purestack-repo",
4-
"version": "1.1.19",
4+
"version": "1.1.20",
55
"packageManager": "yarn@4.18.1",
66
"type": "module",
77
"sideEffects": false,

‎packages/purestack/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "purestack",
3-
"version": "1.1.19",
3+
"version": "1.1.20",
44
"packageManager": "yarn@4.9.2",
55
"module": "./dist/purestack.mjs",
66
"types": "./dist/purestack.d.mts",

‎packages/purestack/src/cli/terminal/creation-view.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export class CreationView {
6060
start(title: string, directory: string, version: string) {
6161
return `\n${this.frame(
6262
'◈ PURESTACK · CREATE SITE',
63-
[title, '', `Directory ${directory}`, `PureStack ${version}`],
63+
[title, '', `Directory ${directory}`, `PureStack CLI ${version}`],
6464
'accent',
6565
)}\n\n`
6666
}
@@ -101,7 +101,7 @@ export class CreationView {
101101
[
102102
`Directory ${result.directory}`,
103103
`Template ${result.template}`,
104-
`PureStack ${result.version}`,
104+
`PureStack CLI ${result.version}`,
105105
],
106106
tone,
107107
)

‎packages/purestack/src/index.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
export const version: string = '1.1.19'
1+
export const version: string = '1.1.20'
22

33
export * from '@purestack/ts-ssg'

‎packages/purestack/src/init/init.test.ts‎

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,21 +203,21 @@ describe('project generation', () => {
203203
expect(project).toMatchObject({
204204
name: 'my-docs',
205205
private: true,
206-
dependencies: { purestack: cliVersion },
206+
dependencies: { purestack: 'latest' },
207207
})
208208
expect(prepared.packageManager).toBe('yarn')
209209
expect(await readFile(path.join(destination, 'yarn.lock'), 'utf8')).toBe('')
210210
expect(project.packageManager).toBe('yarn@4.18.1')
211-
expect(project.devDependencies['@purestack/ts-minidom']).toBe(cliVersion)
211+
expect(project.devDependencies['@purestack/ts-minidom']).toBe('latest')
212212
const yarnConfig = await readFile(
213213
path.join(destination, '.yarnrc.yml'),
214214
'utf8',
215215
)
216216
expect(yarnConfig).toContain('nodeLinker: node-modules')
217217
expect(yarnConfig).toContain('npmMinimalAgeGate: 0')
218218
expect(project.dependencies).toMatchObject({
219-
'@purestack/ts-style': cliVersion,
220-
regor: '^1.7.6',
219+
'@purestack/ts-style': 'latest',
220+
regor: 'latest',
221221
})
222222
expect(
223223
JSON.parse(
@@ -241,6 +241,36 @@ describe('project generation', () => {
241241
).toContain('yarn build')
242242
})
243243

244+
it('preserves template dependency selectors instead of replacing them with the CLI version', async () => {
245+
const unpacked = await fixture()
246+
const packageFile = path.join(unpacked, 'template/package.json')
247+
const project = JSON.parse(await readFile(packageFile, 'utf8'))
248+
project.dependencies.purestack = '1.2.3'
249+
project.dependencies['@purestack/ts-style'] = '^1.2.0'
250+
await writeFile(packageFile, JSON.stringify(project))
251+
252+
await prepareProject(unpacked, path.join(temporary, 'project'), cliVersion)
253+
254+
expect(
255+
JSON.parse(await readFile(packageFile, 'utf8')).dependencies,
256+
).toEqual(project.dependencies)
257+
})
258+
259+
it.each([undefined, 42])(
260+
'rejects a missing or invalid PureStack dependency (%s)',
261+
async (dependency) => {
262+
const unpacked = await fixture()
263+
const packageFile = path.join(unpacked, 'template/package.json')
264+
const project = JSON.parse(await readFile(packageFile, 'utf8'))
265+
project.dependencies.purestack = dependency
266+
await writeFile(packageFile, JSON.stringify(project))
267+
268+
await expect(
269+
prepareProject(unpacked, path.join(temporary, 'project'), cliVersion),
270+
).rejects.toThrow(/must declare dependencies.purestack/)
271+
},
272+
)
273+
244274
it('rejects incompatible templates without creating a destination', async () => {
245275
const unpacked = await fixture()
246276
const destination = path.join(temporary, 'project')
@@ -390,6 +420,7 @@ describe('project generation', () => {
390420
' package.tgz ',
391421
'',
392422
'{{unknown}}',
423+
'{{purestackVersion}}',
393424
])('rejects nonportable dependency %s', async (version) => {
394425
const unpacked = await fixture()
395426
const packageFile = path.join(unpacked, 'template/package.json')

‎packages/purestack/src/init/template.ts‎

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -259,10 +259,10 @@ function isRegistryDependency(version: string) {
259259
export async function prepareProject(
260260
unpacked: string,
261261
directory: string,
262-
purestackVersion: string,
262+
cliVersion: string,
263263
title = path.basename(directory),
264264
) {
265-
const { pkg } = await inspectTemplate(unpacked, purestackVersion)
265+
const { pkg } = await inspectTemplate(unpacked, cliVersion)
266266
const source = path.join(unpacked, 'template')
267267
const files = await listProjectFiles(source)
268268
for (const file of [
@@ -289,12 +289,9 @@ export async function prepareProject(
289289
if (match[1] === 'yarn') packageManager = 'yarn'
290290
}
291291
const dependencies = project.dependencies
292-
if (
293-
!isRecord(dependencies) ||
294-
dependencies.purestack !== '{{purestackVersion}}'
295-
)
292+
if (!isRecord(dependencies) || typeof dependencies.purestack !== 'string')
296293
throw new Error(
297-
'Template must declare dependencies.purestack as {{purestackVersion}}.',
294+
'Template must declare dependencies.purestack as a published dependency version, range, or tag.',
298295
)
299296
for (const field of [
300297
'dependencies',
@@ -305,21 +302,11 @@ export async function prepareProject(
305302
const entries = project[field]
306303
if (entries === undefined) continue
307304
if (!isRecord(entries)) throw new Error(`Invalid project ${field}.`)
308-
for (const [dependency, version] of Object.entries(entries)) {
309-
if (
310-
typeof version !== 'string' ||
311-
(!isRegistryDependency(version) &&
312-
!(
313-
(dependency === 'purestack' ||
314-
dependency.startsWith('@purestack/')) &&
315-
version === '{{purestackVersion}}'
316-
))
317-
)
305+
for (const version of Object.values(entries)) {
306+
if (typeof version !== 'string' || !isRegistryDependency(version))
318307
throw new Error(
319308
`Project ${field} must use published dependency versions.`,
320309
)
321-
if (version === '{{purestackVersion}}')
322-
entries[dependency] = purestackVersion
323310
}
324311
}
325312
const scripts = project.scripts
@@ -345,7 +332,6 @@ export async function prepareProject(
345332
}
346333
project.name = projectName(directory)
347334
project.private = true
348-
dependencies.purestack = purestackVersion
349335
await writeJson(path.join(source, 'package.json'), project)
350336
const configFile = path.join(source, 'content', 'siteConfig.json')
351337
const config = await readJson(configFile)

‎packages/ts-common/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@purestack/ts-common",
3-
"version": "1.1.19",
3+
"version": "1.1.20",
44
"packageManager": "yarn@4.9.2",
55
"module": "./dist/ts-common.mjs",
66
"types": "./dist/ts-common.d.mts",

‎packages/ts-components/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@purestack/ts-components",
3-
"version": "1.1.19",
3+
"version": "1.1.20",
44
"packageManager": "yarn@4.9.2",
55
"module": "./dist/ts-components.mjs",
66
"types": "./dist/ts-components.d.mts",

‎packages/ts-css/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@purestack/ts-css",
3-
"version": "1.1.19",
3+
"version": "1.1.20",
44
"packageManager": "yarn@4.9.2",
55
"module": "./dist/ts-css.mjs",
66
"types": "./dist/ts-css.d.mts",

0 commit comments

Comments
 (0)