create-packkit 2.0.2 → 2.0.3

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-packkit",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "description": "Highly configurable scaffolder for modern npm packages and CLIs — pick your stack (TS/JS, bundler, tests, linter, CI, releases) from a CLI or a web configurator.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -26,7 +26,8 @@
26
26
  "test": "node --test",
27
27
  "check:deps": "node scripts/check-template-deps.mjs",
28
28
  "integration": "node scripts/integration.mjs",
29
- "build:web": "esbuild src/core/index.js --bundle --format=esm --outfile=docs/packkit-core.js"
29
+ "build:web": "esbuild src/core/index.js --bundle --format=esm --outfile=docs/packkit-core.js",
30
+ "update:node": "node scripts/update-node-versions.mjs"
30
31
  },
31
32
  "repository": {
32
33
  "type": "git",
package/src/cli/index.js CHANGED
@@ -3,7 +3,7 @@ import { readFileSync, existsSync } from 'node:fs';
3
3
  import { fileURLToPath } from 'node:url';
4
4
  import * as p from '@clack/prompts';
5
5
  import { generate, fromPreset, normalizeConfig, PRESET_NAMES, OPTIONS, PRESET_INFO, PRESET_ALIASES } from '../core/index.js';
6
- import { nodeFloor, meetsNodeFloor } from '../core/node.js';
6
+ import { engineFloor, meetsNodeFloor } from '../core/node.js';
7
7
  import { parseCliArgs } from './args.js';
8
8
  import { runWizard } from './wizard.js';
9
9
  import { writeProject, dirIsEmptyOrMissing, gitInit, installDeps } from './write.js';
@@ -92,7 +92,7 @@ export async function run(argv = process.argv.slice(2)) {
92
92
  // require this floor. npm only *warns* on engines, so catch it here — clearly,
93
93
  // once — instead of letting a doomed install spew EBADENGINE and leave a broken
94
94
  // project. This is the signal both humans and agents need up front.
95
- const floor = nodeFloor(config.nodeVersion);
95
+ const floor = engineFloor(config.nodeVersion);
96
96
  const nodeOk = meetsNodeFloor(process.version, floor);
97
97
  if (!nodeOk) {
98
98
  const lines = [
@@ -34,8 +34,8 @@ export default {
34
34
 
35
35
  if (needsLintStaged) {
36
36
  pkg['lint-staged'] = staged;
37
- // Held at 16: v17 requires Node >=22.22.1, which would silently drop
38
- // Node 20 LTS support for every generated project. See NODE_FLOOR.
37
+ // Held at 16: v17 requires Node >=22.22.1, above our Node 22 engines
38
+ // floor (22.13) it would break the Maintenance-LTS line. See ENGINE_MIN.
39
39
  pkg.devDependencies['lint-staged'] = '^16.2.0';
40
40
  }
41
41
 
@@ -1,6 +1,6 @@
1
1
  // Always-on: base package.json descriptive fields + the source entry + README.
2
2
 
3
- import { nodeFloor } from '../node.js';
3
+ import { engineFloor, nodePin } from '../node.js';
4
4
 
5
5
  export default {
6
6
  id: 'meta',
@@ -12,7 +12,7 @@ export default {
12
12
  version: '0.0.0',
13
13
  description: cfg.description || '',
14
14
  type: cfg.moduleFormat === 'cjs' ? 'commonjs' : 'module',
15
- engines: { node: `>=${nodeFloor(cfg.nodeVersion)}` },
15
+ engines: { node: `>=${engineFloor(cfg.nodeVersion)}` },
16
16
  scripts: {},
17
17
  };
18
18
 
@@ -35,8 +35,9 @@ export default {
35
35
  // README
36
36
  files['README.md'] = readme(cfg);
37
37
 
38
- // Node version pin — the honest floor, so `nvm use` can't land below it.
39
- files['.nvmrc'] = `${nodeFloor(cfg.nodeVersion)}\n`;
38
+ // Node version pin — that line's newest patch (from Node's own data), so
39
+ // `nvm use` lands on a current, real release.
40
+ files['.nvmrc'] = `${nodePin(cfg.nodeVersion)}\n`;
40
41
 
41
42
  // A typecheck script for TS projects — framework-aware (plain tsc can't
42
43
  // resolve .vue/.svelte modules).
@@ -118,7 +119,7 @@ function readme(cfg) {
118
119
  lines.push(
119
120
  '## Requirements',
120
121
  '',
121
- `Node.js >= ${nodeFloor(cfg.nodeVersion)} (\`.nvmrc\` pins it; run \`nvm use\`). Enforced via \`engine-strict\`, so installs fail fast on an unsupported version.`,
122
+ `Node.js >= ${engineFloor(cfg.nodeVersion)} (\`.nvmrc\` pins ${nodePin(cfg.nodeVersion)}; run \`nvm use\`). Enforced via \`engine-strict\`, so installs fail fast on an unsupported version.`,
122
123
  '',
123
124
  );
124
125
 
@@ -0,0 +1,12 @@
1
+ // AUTO-GENERATED by scripts/update-node-versions.mjs — do not edit by hand.
2
+ // Source: nodejs.org/dist + nodejs/Release schedule, refreshed 2026-07-14.
3
+ // Offered lines track the Node release schedule; each version is that line's
4
+ // newest published patch. Run `node scripts/update-node-versions.mjs` to refresh.
5
+
6
+ export const NODE_LINES = {
7
+ '24': { version: '24.18.0', status: 'active-lts', codename: 'Krypton', label: '24 (Active LTS, "Krypton")' },
8
+ '22': { version: '22.23.1', status: 'maintenance', codename: 'Jod', label: '22 (Maintenance LTS, "Jod")' },
9
+ '26': { version: '26.5.0', status: 'current', codename: null, label: '26 (Current)' },
10
+ };
11
+
12
+ export const DEFAULT_NODE = '24';
package/src/core/node.js CHANGED
@@ -1,18 +1,30 @@
1
- // Shared Node-version floor logic. Browser-safe (no node builtins) so both the
2
- // generator and the CLI preflight agree on exactly one source of truth.
1
+ // Shared Node-version logic. Browser-safe (no node builtins) so the generator
2
+ // and the CLI preflight agree on exactly one source of truth.
3
+ //
4
+ // Two concerns, two sources:
5
+ // - which majors we offer + the exact patch to pin -> node-versions.js,
6
+ // auto-derived from Node's release schedule + dist index (never guessed).
7
+ // - the minimum patch *within a major* our template deps need -> ENGINE_MIN,
8
+ // below, driven by our deps (eslint/vite), governed by the template-deps
9
+ // freshness workflow. These change rarely and independently of Node.
3
10
 
4
- // The real minimum patch for each supported major, driven by our template deps
5
- // (eslint 10, jsdom 29, vite 8 need ^20.19; vite/others need ^22.12). Writing a
6
- // bare ">=20" would be a lie — a user on 20.17 hits EBADENGINE and transitive
7
- // syntax errors. Keep this honest.
8
- export const NODE_FLOOR = { 18: '18.18.0', 20: '20.19.0', 22: '22.12.0', 24: '24.0.0' };
11
+ import { NODE_LINES, DEFAULT_NODE } from './node-versions.js';
9
12
 
10
- export const nodeFloor = (v) => NODE_FLOOR[v] || `${v}.0.0`;
13
+ export { NODE_LINES, DEFAULT_NODE };
14
+
15
+ // eslint 10 needs ^20.19/^22.13; vite 8 needs ^20.19/^22.12 — take the max.
16
+ export const ENGINE_MIN = { 18: '18.18.0', 20: '20.19.0', 22: '22.13.0' };
17
+
18
+ /** The `engines` minimum for a target major (a floor, not a pin). */
19
+ export const engineFloor = (v) => ENGINE_MIN[v] || `${v}.0.0`;
20
+
21
+ /** The exact version to pin in `.nvmrc` — that line's newest patch, or the floor. */
22
+ export const nodePin = (v) => NODE_LINES[v]?.version || engineFloor(v);
11
23
 
12
24
  const parts = (s) =>
13
25
  String(s).replace(/^v/, '').split('.').map((n) => parseInt(n, 10) || 0);
14
26
 
15
- /** True if `current` (e.g. "v20.17.0" or process.version) is >= `floor` ("20.19.0"). */
27
+ /** True if `current` (e.g. "v22.5.0" or process.version) is >= `floor` ("22.13.0"). */
16
28
  export function meetsNodeFloor(current, floor) {
17
29
  const [a, b, c] = parts(current);
18
30
  const [x, y, z] = parts(floor);
@@ -2,8 +2,14 @@
2
2
  // Both the CLI wizard and the web configurator render from this schema, and
3
3
  // `normalizeConfig` turns partial/user input into a complete, valid config.
4
4
 
5
+ import { NODE_LINES, DEFAULT_NODE } from './node.js';
6
+
5
7
  /** @typedef {'select'|'multiselect'|'boolean'|'text'} OptionType */
6
8
 
9
+ // Node choices are derived from Node's own release schedule (see node-versions.js)
10
+ // so the LTS/Current lines and their patches stay current without hand-editing.
11
+ const NODE_CHOICES = Object.entries(NODE_LINES).map(([value, info]) => ({ value, label: info.label }));
12
+
7
13
  export const OPTIONS = {
8
14
  // ---- package metadata ----
9
15
  name: { group: 'meta', type: 'text', label: 'Package name', default: 'my-package' },
@@ -59,12 +65,8 @@ export const OPTIONS = {
59
65
  ],
60
66
  },
61
67
  nodeVersion: {
62
- group: 'core', type: 'select', label: 'Node version', default: '20',
63
- choices: [
64
- { value: '20', label: '20 (LTS, ≥20.19)' },
65
- { value: '22', label: '22 (LTS, ≥22.12)' },
66
- { value: '24', label: '24 (Current)' },
67
- ],
68
+ group: 'core', type: 'select', label: 'Node version', default: DEFAULT_NODE,
69
+ choices: NODE_CHOICES,
68
70
  },
69
71
 
70
72
  // ---- build ----