create-jst 0.4.10 → 0.4.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-jst",
3
- "version": "0.4.10",
3
+ "version": "0.4.11",
4
4
  "description": "Create a web application from the JST template.",
5
5
  "type": "module",
6
6
  "packageManager": "npm@11.6.2",
@@ -12,7 +12,7 @@
12
12
  "src"
13
13
  ],
14
14
  "engines": {
15
- "node": ">=24.15.0 <25"
15
+ "node": ">=22.14.0"
16
16
  },
17
17
  "scripts": {
18
18
  "lint": "eslint . --max-warnings 0",
@@ -34,6 +34,8 @@
34
34
  "license": "MIT",
35
35
  "dependencies": {
36
36
  "@clack/prompts": "^1.8.1",
37
+ "@reatom/core": "^1001.3.0",
38
+ "@reatom/react": "^1001.0.1",
37
39
  "degit": "^3.10.0"
38
40
  },
39
41
  "devDependencies": {
@@ -29,6 +29,12 @@ export function createProjectInitializer({ onProgress = () => undefined, project
29
29
  onProgress({ type: 'git.initialization.started', specification })
30
30
  await projectGateway.initializeGit(temporaryDestination)
31
31
  }
32
+ else {
33
+ await projectGateway.removeGitMetadata(temporaryDestination)
34
+ }
35
+ if (specification.install) {
36
+ await projectGateway.assertRuntimeSupported(temporaryDestination)
37
+ }
32
38
  await projectGateway.commitDestination(temporaryDestination, specification.destination)
33
39
  rollbackDestination = specification.destination
34
40
  if (specification.install) {
@@ -3,7 +3,7 @@ export const PRIMARY_COLORS = ['dark', 'gray', 'red', 'pink', 'grape', 'violet',
3
3
  export const PACKAGE_MANAGERS = ['npm', 'pnpm']
4
4
  export const STYLE_LANGUAGES = ['css', 'scss']
5
5
  export const EXAMPLES = ['clean', 'showcase']
6
- export const TEMPLATE_SOURCE = 'jst-stack/jst#v0.4.5'
6
+ export const TEMPLATE_SOURCE = 'jst-stack/jst#v0.4.6'
7
7
  export const SHOWCASE_SOURCE = 'jst-stack/jst-showcase#62bc760f9df49fe110c055b914b087ba0d95402a'
8
8
 
9
9
  export function buildProjectSpecification(input) {
@@ -16,6 +16,7 @@ const textExtensions = new Set(['.md', '.mjs', '.yaml', '.yml'])
16
16
  export function createNodeProjectGateway({ nodeExecutable, signal }) {
17
17
  return {
18
18
  assertDestinationIsEmpty,
19
+ assertRuntimeSupported,
19
20
  cleanupDestination,
20
21
  commitDestination,
21
22
  configureExample,
@@ -24,6 +25,7 @@ export function createNodeProjectGateway({ nodeExecutable, signal }) {
24
25
  initializeGit,
25
26
  installDependencies,
26
27
  prepareDestination,
28
+ removeGitMetadata,
27
29
  validateTemplate,
28
30
  }
29
31
 
@@ -64,13 +66,6 @@ export function createNodeProjectGateway({ nodeExecutable, signal }) {
64
66
  ], specification.destination, { signal })
65
67
  }
66
68
 
67
- async function configureExample(specification) {
68
- const manifestPath = join(specification.destination, 'package.json')
69
- const manifest = JSON.parse(await readFile(manifestPath, 'utf8'))
70
- manifest.name = specification.name
71
- await writeFile(manifestPath, `${JSON.stringify(manifest, null, '\t')}\n`)
72
- }
73
-
74
69
  function initializeGit(destination) {
75
70
  return run('git', ['init', '--initial-branch=main'], destination, { signal })
76
71
  }
@@ -101,6 +96,42 @@ export function createNodeProjectGateway({ nodeExecutable, signal }) {
101
96
  }
102
97
  }
103
98
 
99
+ async function configureExample(specification) {
100
+ const manifestPath = join(specification.destination, 'package.json')
101
+ const manifest = JSON.parse(await readFile(manifestPath, 'utf8'))
102
+ manifest.name = specification.name
103
+ await writeFile(manifestPath, `${JSON.stringify(manifest, null, '\t')}\n`)
104
+ }
105
+
106
+ function removeGitMetadata(destination) {
107
+ return rm(join(destination, '.git'), { force: true, recursive: true })
108
+ }
109
+
110
+ async function assertRuntimeSupported(destination) {
111
+ const manifest = JSON.parse(await readFile(join(destination, 'package.json'), 'utf8'))
112
+ const required = manifest.engines?.node
113
+ const match = /^>=(\d+)\.(\d+)\.(\d+) <(\d+)$/u.exec(required ?? '')
114
+ if (!match) {
115
+ return
116
+ }
117
+ const current = process.versions.node.split('.').map(Number)
118
+ const minimum = match.slice(1, 4).map(Number)
119
+ const maximumMajor = Number(match[4])
120
+ if (current[0] < maximumMajor && compareVersions(current, minimum) >= 0) {
121
+ return
122
+ }
123
+ throw new Error(`This template requires Node.js ${required}; detected ${process.versions.node}. Upgrade Node and run create-jst again.`)
124
+ }
125
+
126
+ function compareVersions(left, right) {
127
+ for (let index = 0; index < right.length; index += 1) {
128
+ if (left[index] !== right[index]) {
129
+ return left[index] - right[index]
130
+ }
131
+ }
132
+ return 0
133
+ }
134
+
104
135
  async function configurePackageManager(destination, packageManager, signal) {
105
136
  const manifestPath = join(destination, 'package.json')
106
137
  const manifest = JSON.parse(await readFile(manifestPath, 'utf8'))
@@ -105,7 +105,7 @@ function getNextSteps(specification, directory) {
105
105
  guidance: [
106
106
  `First slice ${packageManager} run create:slice -- feature firstFeature`,
107
107
  `Fast gate ${packageManager} run validate`,
108
- `Full gate ${packageManager} run check`,
108
+ `Release gate ${packageManager} run check:release`,
109
109
  ],
110
110
  setup: [
111
111
  `cd ${directory}`,