create-fsaa 0.1.3 → 0.1.6

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/lib/init.mjs +17 -7
  2. package/package.json +1 -1
package/lib/init.mjs CHANGED
@@ -65,15 +65,25 @@ export async function initCmd({ flags, interactive }) {
65
65
  pkg.name = name;
66
66
  writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + "\n");
67
67
 
68
- // Windows: pnpm ships as pnpm.cmd; spawning a bare "pnpm" on win32 fails
69
- // (Node ≥18.20 refuses .cmd/.bat without shell). Use the .cmd shim there.
70
- const pnpmBin = process.platform === "win32" ? "pnpm.cmd" : "pnpm";
68
+ // Windows: pnpm ships as pnpm.cmd, and Node ≥18.20 REFUSES to spawn .cmd/.bat
69
+ // without the shell option (EINVAL). So: .cmd name + shell on win32.
70
+ const win = process.platform === "win32";
71
+ const pnpmBin = win ? "pnpm.cmd" : "pnpm";
71
72
  console.log("> installing dependencies (this may take a minute)…");
72
- const r = spawnSync(pnpmBin, ["install"], { cwd: dest, stdio: "inherit" });
73
+ let r = spawnSync(pnpmBin, ["install"], { cwd: dest, stdio: "inherit", shell: win });
73
74
  if (r.error) {
74
- console.error('\nfsaa: pnpm not found on PATH — the FSAA contract pins pnpm.');
75
- console.error(' enable it: corepack enable pnpm or: npm i -g pnpm');
76
- return 1;
75
+ // pnpm missing from PATH — recover INSTEAD of nagging: run the pinned
76
+ // version through npx (npx exists wherever this CLI already runs).
77
+ const pinned = (pkg.packageManager || "pnpm@10.34.9").split("@")[1] || "10.34.9";
78
+ const npxBin = win ? "npx.cmd" : "npx";
79
+ console.log(` pnpm not on PATH — running the pinned pnpm@${pinned} through npx…`);
80
+ r = spawnSync(npxBin, ["-y", `pnpm@${pinned}`, "install"], { cwd: dest, stdio: "inherit", shell: win });
81
+ if (r.error) {
82
+ console.error(`\nfsaa: could not install dependencies automatically (npx unavailable).\n recover by hand: cd ${dest} && npm exec -y pnpm@${pinned} install`);
83
+ const e = new Error("install failed");
84
+ e.userError = true;
85
+ throw e;
86
+ }
77
87
  }
78
88
  if (r.status !== 0) {
79
89
  console.error(`fsaa: dependency install failed — the template files are in place.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-fsaa",
3
- "version": "0.1.3",
3
+ "version": "0.1.6",
4
4
  "description": "FSAA \u2014 Feature-Sliced Atomic Architecture. Run `npm create fsaa` (this package) to scaffold an FSAA app from the official starter templates; `fsaa g <slice>` generates canonical slices.",
5
5
  "license": "MIT",
6
6
  "author": "Veaceslav Bezusco <Aramex86@users.noreply.github.com>",