create-packkit 1.5.0 → 2.0.1
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/README.md +1 -1
- package/package.json +1 -1
- package/src/core/features/githooks.js +3 -1
- package/src/core/features/meta.js +9 -3
- package/src/core/options.js +6 -6
- package/src/core/presets.js +9 -9
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@ No install needed: **[danmat.github.io/create-packkit](https://danmat.github.io/
|
|
|
33
33
|
| Area | Options |
|
|
34
34
|
|---|---|
|
|
35
35
|
| **Language** | TypeScript (strict) · JavaScript (ESM) |
|
|
36
|
-
| **Module format** | ESM · CJS ·
|
|
36
|
+
| **Module format** | **ESM-only (default)** · dual (ESM + CJS) · CJS — proper `exports` map |
|
|
37
37
|
| **Target** | Library · CLI tool · **HTTP service (Hono)** · **App (Vite SPA)** · any combination |
|
|
38
38
|
| **Framework** | None · **React** · **Vue** · **Svelte** (component libraries or apps) |
|
|
39
39
|
| **Storybook** | optional, for React / Vue / Svelte component libraries |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-packkit",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
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": {
|
|
@@ -34,7 +34,9 @@ export default {
|
|
|
34
34
|
|
|
35
35
|
if (needsLintStaged) {
|
|
36
36
|
pkg['lint-staged'] = staged;
|
|
37
|
-
|
|
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.
|
|
39
|
+
pkg.devDependencies['lint-staged'] = '^16.2.0';
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
return { files, pkg };
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
// Always-on: base package.json descriptive fields + the source entry + README.
|
|
2
2
|
|
|
3
|
+
// The real minimum patch for each major, driven by our template deps (eslint 10,
|
|
4
|
+
// jsdom 29, vite 8 need ^20.19; vite/others need ^22.12). `>=20` would be a lie —
|
|
5
|
+
// a user on 20.17 hits EBADENGINE and transitive syntax errors. Keep this honest.
|
|
6
|
+
export const NODE_FLOOR = { 18: '18.18.0', 20: '20.19.0', 22: '22.12.0', 24: '24.0.0' };
|
|
7
|
+
const nodeFloor = (v) => NODE_FLOOR[v] || `${v}.0.0`;
|
|
8
|
+
|
|
3
9
|
export default {
|
|
4
10
|
id: 'meta',
|
|
5
11
|
active: () => true,
|
|
@@ -10,7 +16,7 @@ export default {
|
|
|
10
16
|
version: '0.0.0',
|
|
11
17
|
description: cfg.description || '',
|
|
12
18
|
type: cfg.moduleFormat === 'cjs' ? 'commonjs' : 'module',
|
|
13
|
-
engines: { node: `>=${cfg.nodeVersion}` },
|
|
19
|
+
engines: { node: `>=${nodeFloor(cfg.nodeVersion)}` },
|
|
14
20
|
scripts: {},
|
|
15
21
|
};
|
|
16
22
|
|
|
@@ -33,8 +39,8 @@ export default {
|
|
|
33
39
|
// README
|
|
34
40
|
files['README.md'] = readme(cfg);
|
|
35
41
|
|
|
36
|
-
// Node version pin
|
|
37
|
-
files['.nvmrc'] = `${cfg.nodeVersion}\n`;
|
|
42
|
+
// Node version pin — the honest floor, so `nvm use` can't land below it.
|
|
43
|
+
files['.nvmrc'] = `${nodeFloor(cfg.nodeVersion)}\n`;
|
|
38
44
|
|
|
39
45
|
// A typecheck script for TS projects — framework-aware (plain tsc can't
|
|
40
46
|
// resolve .vue/.svelte modules).
|
package/src/core/options.js
CHANGED
|
@@ -21,11 +21,11 @@ export const OPTIONS = {
|
|
|
21
21
|
],
|
|
22
22
|
},
|
|
23
23
|
moduleFormat: {
|
|
24
|
-
group: 'core', type: 'select', label: 'Module format', default: '
|
|
24
|
+
group: 'core', type: 'select', label: 'Module format', default: 'esm',
|
|
25
25
|
choices: [
|
|
26
|
-
{ value: 'esm', label: 'ESM only' },
|
|
27
|
-
{ value: 'cjs', label: 'CommonJS only' },
|
|
26
|
+
{ value: 'esm', label: 'ESM only (recommended)' },
|
|
28
27
|
{ value: 'dual', label: 'Dual (ESM + CJS)' },
|
|
28
|
+
{ value: 'cjs', label: 'CommonJS only' },
|
|
29
29
|
],
|
|
30
30
|
},
|
|
31
31
|
target: {
|
|
@@ -61,9 +61,9 @@ export const OPTIONS = {
|
|
|
61
61
|
nodeVersion: {
|
|
62
62
|
group: 'core', type: 'select', label: 'Node version', default: '20',
|
|
63
63
|
choices: [
|
|
64
|
-
{ value: '
|
|
65
|
-
{ value: '
|
|
66
|
-
{ value: '
|
|
64
|
+
{ value: '20', label: '20 (LTS, ≥20.19)' },
|
|
65
|
+
{ value: '22', label: '22 (LTS, ≥22.12)' },
|
|
66
|
+
{ value: '24', label: '24 (Current)' },
|
|
67
67
|
],
|
|
68
68
|
},
|
|
69
69
|
|
package/src/core/presets.js
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
// the wizard: `npx packkit ts-lib my-project`.
|
|
3
3
|
|
|
4
4
|
export const PRESETS = {
|
|
5
|
-
'ts-lib': { language: 'ts', target: ['library'], moduleFormat: '
|
|
6
|
-
'js-lib': { language: 'js', target: ['library'], moduleFormat: '
|
|
5
|
+
'ts-lib': { language: 'ts', target: ['library'], moduleFormat: 'esm' },
|
|
6
|
+
'js-lib': { language: 'js', target: ['library'], moduleFormat: 'esm', bundler: 'tsup' },
|
|
7
7
|
'ts-cli': { language: 'ts', target: ['cli', 'library'], moduleFormat: 'esm' },
|
|
8
8
|
cli: { language: 'ts', target: ['cli', 'library'], moduleFormat: 'esm' },
|
|
9
|
-
'react-lib': { language: 'ts', framework: 'react', target: ['library'], moduleFormat: '
|
|
10
|
-
'react-lib-js': { language: 'js', framework: 'react', target: ['library'], moduleFormat: '
|
|
9
|
+
'react-lib': { language: 'ts', framework: 'react', target: ['library'], moduleFormat: 'esm', test: 'vitest' },
|
|
10
|
+
'react-lib-js': { language: 'js', framework: 'react', target: ['library'], moduleFormat: 'esm', bundler: 'tsup', test: 'vitest' },
|
|
11
11
|
'react-app': { language: 'ts', framework: 'react', target: ['app'], test: 'vitest', release: 'none', workflows: ['ci'] },
|
|
12
12
|
'vue-lib': { language: 'ts', framework: 'vue', target: ['library'], test: 'vitest' },
|
|
13
13
|
'vue-app': { language: 'ts', framework: 'vue', target: ['app'], test: 'vitest', release: 'none', workflows: ['ci'] },
|
|
@@ -20,19 +20,19 @@ export const PRESETS = {
|
|
|
20
20
|
},
|
|
21
21
|
monorepo: { monorepo: true, language: 'ts', packageManager: 'pnpm' },
|
|
22
22
|
oss: {
|
|
23
|
-
language: 'ts', target: ['library'], moduleFormat: '
|
|
23
|
+
language: 'ts', target: ['library'], moduleFormat: 'esm', bundler: 'tsup',
|
|
24
24
|
test: 'vitest', coverage: true, lint: 'eslint-prettier', gitHooks: 'simple-git-hooks',
|
|
25
25
|
release: 'changesets', workflows: ['ci', 'npm-publish', 'codeql', 'codecov'],
|
|
26
26
|
deps: 'renovate', community: true, agents: true, vscode: true,
|
|
27
27
|
pkgChecks: true, knip: true,
|
|
28
28
|
},
|
|
29
29
|
minimal: {
|
|
30
|
-
language: 'ts', target: ['library'], moduleFormat: '
|
|
30
|
+
language: 'ts', target: ['library'], moduleFormat: 'esm', bundler: 'tsup',
|
|
31
31
|
test: 'none', lint: 'none', gitHooks: 'none', release: 'none',
|
|
32
32
|
workflows: ['ci'], deps: 'none', community: false, agents: false, vscode: false,
|
|
33
33
|
},
|
|
34
34
|
full: {
|
|
35
|
-
language: 'ts', target: ['library', 'cli'], moduleFormat: '
|
|
35
|
+
language: 'ts', target: ['library', 'cli'], moduleFormat: 'esm', bundler: 'tsup',
|
|
36
36
|
test: 'vitest', coverage: true, lint: 'eslint-prettier', gitHooks: 'simple-git-hooks',
|
|
37
37
|
release: 'changesets',
|
|
38
38
|
workflows: ['ci', 'npm-publish', 'pages', 'codeql', 'codecov', 'stale'],
|
|
@@ -65,14 +65,14 @@ export function resolvePreset(name) {
|
|
|
65
65
|
|
|
66
66
|
// Short gists for the CLI help and the web configurator (tooltips + description).
|
|
67
67
|
export const PRESET_INFO = {
|
|
68
|
-
'ts-lib': 'TypeScript library —
|
|
68
|
+
'ts-lib': 'TypeScript library — ESM-only, tsup, Vitest, ESLint.',
|
|
69
69
|
'js-lib': 'JavaScript (ESM) library — tsup, Vitest, ESLint.',
|
|
70
70
|
'ts-cli': 'TypeScript CLI + library — ESM, ships a bin.',
|
|
71
71
|
cli: 'TypeScript CLI tool — ESM, ships a bin.',
|
|
72
72
|
'react-lib': 'React component library (TS) — JSX, peer deps, jsdom tests.',
|
|
73
73
|
'react-lib-js': 'React component library (JS) — JSX, peer deps, jsdom tests.',
|
|
74
74
|
'react-app': 'React SPA — Vite dev server, build, Testing Library.',
|
|
75
|
-
'vue-lib': 'Vue component library — Vite lib build (SFCs),
|
|
75
|
+
'vue-lib': 'Vue component library — Vite lib build (SFCs), ESM + types.',
|
|
76
76
|
'vue-app': 'Vue SPA — Vite dev server, build, Testing Library.',
|
|
77
77
|
'svelte-lib': 'Svelte component library — ships source, peer svelte, jsdom tests.',
|
|
78
78
|
'svelte-app': 'Svelte SPA — Vite dev server, build, Testing Library.',
|