create-zerodirs 0.1.0 → 0.1.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.
Files changed (2) hide show
  1. package/dist/create.js +20 -1
  2. package/package.json +1 -1
package/dist/create.js CHANGED
@@ -88,7 +88,18 @@ export async function create(options, environment) {
88
88
  if (options.install) {
89
89
  const installSpinner = p.spinner();
90
90
  installSpinner.start(`${installCommand(manager)}`);
91
- const result = await run(manager, ['install'], { cwd: target, timeout: 900_000 });
91
+ let result = await run(manager, ['install'], { cwd: target, timeout: 900_000 });
92
+ if (!result.ok && manager === 'npm' && isNpmPeerSetCrash(result)) {
93
+ // The npm bundled with Node 24.3 (11.4) crashes in its peer-dependency resolver on
94
+ // vitest 4's optional peers; npm 11.19 has the fix. `--legacy-peer-deps` skips that
95
+ // resolver, and every peer this project needs is a direct dependency already.
96
+ installSpinner.stop('npm install crashed in its peer resolver (an npm bug fixed in 11.19)');
97
+ installSpinner.start('npm install --legacy-peer-deps');
98
+ result = await run('npm', ['install', '--legacy-peer-deps'], { cwd: target, timeout: 900_000 });
99
+ if (result.ok) {
100
+ notes.push('npm install needed --legacy-peer-deps: the npm that ships with your Node crashes on vitest 4 peer dependencies (fixed in npm 11.19). Update npm, use pnpm, or keep the flag.');
101
+ }
102
+ }
92
103
  installed = result.ok;
93
104
  if (result.ok)
94
105
  installSpinner.stop('Dependencies installed');
@@ -245,3 +256,11 @@ export function readOwnVersion(packageJsonPath) {
245
256
  return '0.0.0';
246
257
  }
247
258
  }
259
+ /**
260
+ * npm ≤ 11.18 dies with `Cannot read properties of null (reading 'edgesOut')` while
261
+ * walking vitest 4's optional peer dependencies (npm/cli#8261). The message is the only
262
+ * stable signature: exit codes and the surrounding lines vary by version.
263
+ */
264
+ export function isNpmPeerSetCrash(result) {
265
+ return /edgesOut/.test(`${result.stderr}\n${result.message}`);
266
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-zerodirs",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Scaffold a ZeroDirs directory site: pick a dataset, answer a few questions, get a project that builds.",
5
5
  "keywords": ["zerodirs", "directory", "astro", "cloudflare", "starter"],
6
6
  "homepage": "https://docs.zerodirs.com/",