Repository navigation
Description
stellar scaffold init -p pnpm records pnpm in scaffold.yml and writes pnpm-workspace.yaml, but otherwise leaves the template's npm-specific setup in place. The resulting project fails to install, and its scripts still run npm.
Environment
- stellar-scaffold
v0.0.34 - Node
v24.11.0 - official Svelte template
- Tested with pnpm
v11.28.2; build-script behavior also checked on pnpmv10.34.9andv12.16.1.
Reproduce
stellar scaffold init my-app --template svelte -p pnpm
cd my-app && pnpm install
Problems
-
Install fails.
app/package.jsondepends on"@stellar-scaffold/app-lib": "*". npm links that to the workspace package, but pnpm doesn't link workspace packages by default, so it looks for the package on the npm registry and throws an error something like:ERR_PNPM_FETCH_404 ... @stellar-scaffold/app-lib is not in the npm registryinit's own install step hits this, butrun_installonly warns on it, soinitstill reports success. pnpm needsworkspace:*here, and npm rejects that protocol, so the template can't use one spec for both. -
Scripts are npm-only. pnpm has no
--workspace/--workspacesflags. Replacing the wordnpmwithpnpmmakesstartcall itself in a loop, because pnpm forwards the extra arguments to the root script.Script Template pnpm equivalent root startnpm start --workspace apppnpm --filter ./app startroot lintnpm run lint --workspaces --if-presentpnpm -r --if-present lintroot devnpm startpnpm startappdevnpm startpnpm start -
Dependency build scripts block every command on pnpm 11+. pnpm blocks dependency build scripts by default. On pnpm 10 that produces a warning, but pnpm 11/12, install fails with
ERR_PNPM_IGNORED_BUILDSuntil each package is approved or denied. The template needs those build script entries for@reown/appkit,bufferutil,secp256k1,unrs-resolver, andutf-8-validate. All five work withfalse, in my own testing: most of them even ship prebuilt binaries and/or have JS fallbacks. -
Leftover npm config. The root
workspacesfield is left in place inpackage.json(pnpm ignores it and needs it inpnpm-workspace.yamlinstead). Also, nopackageManagerfield is written topackage.json, which might be a nice touch. (Though, i do see some comments incrates/stellar-scaffold-cli/src/commands/mod.rsindicating the absence frompackage.jsonis maybe intentional.)
Proposal
I'm thinking we could leave the template(s) as they are, and make the init command do whatever conversions/fixes/find-n-replaces necessary. apply_package_manager in init/instantiate.rs already handles pnpm partially (it writes pnpm-workspace.yaml and removes package-lock.json). Extending that function so the instantiated project is fully converted would cover everything above:
app/package.json: rewrite@stellar-scaffold/app-libtoworkspace:*- Root and
app/package.jsonscripts: replace npm invocations with their pnpm equivalents (table above) - Root
package.json: removeworkspaces, addpackageManager(again, if it's not intentionally kept out of here) pnpm-workspace.yaml: add build-script entries for the recorded pnpm version (allowBuildson pnpm 11+,ignoredBuiltDependencieson pnpm 10)
One way to accomplish this might be to follow the existing pattern of rewrite_root_workspaces, which loads the root package.json with serde_json, edits it, and writes it back. A similar helper function could apply a pnpm-specific transform to each instantiated manifest file: rewrite workspace dependency specs, and map script commands through a small npm-to-pnpm lookup. Since only official templates go through apply_package_manager, the lookup can match the known template scripts exactly. Unrecognized scripts would be left alone, rather than guessed at.
Yarn, Bun, and Deno would likely need similar handling. But, I'm less familiar with those, and have only tested with pnpm myself. I'd start there and structure the helper so other managers can be added more easily. I'm happy to take a stab at a first-draft run of a fix, if it would help.
Related
- fix(stellar-scaffold-cli): pass pnpm reporter flag before run #653 fixes
pnpm run build --reporter=silentbreaking client generation - fix: don't rely on npm hoisting for Prettier and TypeScript configs ui#289 removes the template's reliance on npm hoisting for Prettier and TypeScript configs
Activity
zachfedor commentedon Nov 3, 2026
Adding #658 to the list of
pnpmfixes