Skip to content

fix(create): honor system package manager versions - #2699

Open
SaKaNa-Y wants to merge 6 commits into
voidzero-dev:mainfrom
SaKaNa-Y:fix/create-system-package-manager-version
Open

SaKaNa-Y wants to merge 6 commits into
voidzero-dev:mainfrom
SaKaNa-Y:fix/create-system-package-manager-version

Conversation

@SaKaNa-Y

@SaKaNa-Y SaKaNa-Y commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

vp create always downloaded a managed package-manager release before scaffolding, even when that family was configured to use the system installation. The generated devEngines.packageManager.version could therefore disagree with the executable used for installation. With npm, this can fail with EBADDEVENGINES; the same incorrect pinning also affects pnpm, Yarn, and Bun.

Resolve the selected family through vp env current before scaffolding. When it selects a system executable, use that version and binary directory. Keep managed downloads and the missing-system fallback, locate the global resolver through the shared directory API, and preserve local-only creation when it is absent. Narrow scaffold metadata to the fields consumers actually need.

System Yarn Classic also needs a compatible template runner: Yarn 1 has no dlx command. Select npx --yes from the resolved Yarn version, matching the existing vp dlx fallback; Yarn 2+ continues to use yarn dlx. This runner choice does not change the selected package-manager family or version.

The Unix external-template fixture sets npm's script shell to /bin/sh. The snapshot runner exposes sh through a symlink, while fspy identifies system shells by their canonical parent directory for macOS compatibility. Real npx execution and generated-file assertions remain covered.

Verification

  • 647 create, workspace, and migration unit tests pass, including Yarn 1/2/4 runner selection and differing ambient/system versions.

  • All 15 system package-manager snapshots pass with --test-threads=2 and cover all four families, managed selection, missing-system fallback, and a real npm dependency installation.

  • The default-concurrency run hit seven 50-second timeouts; the lower-concurrency run passed without changing timeouts or expectations.

  • New local/global snapshots verify Yarn Classic external-template execution and, separately, its version pin in a built-in template.

  • Format, lint, type checks, and whitespace checks pass.

  • npm version-pin mismatch reproduced before the fix and corrected afterward.

  • After setting the canonical script shell, all 15 system package-manager snapshots pass again; JavaScript syntax and whitespace checks pass. All three macOS snapshot shards pass in CI, including both previously failing external-template cases. The final CI run passes across macOS, Linux, and Windows.

Limitations

Executable fixtures are Unix-only. The external-template cases verify real execution and generated files; they do not assert every subsequent migration step.

Use the selected system executable and version when scaffolding so the generated package-manager pin agrees with installation. Preserve managed downloads and local-only creation, and cover system selection, fallback, and npm installation.
Use the resolved Yarn version to select the existing npx fallback for Classic, which has no dlx command. Preserve Yarn 2+ template execution and cover runner selection, external scaffolding, and the built-in template version pin.
@SaKaNa-Y
SaKaNa-Y marked this pull request as ready for review September 15, 2026 13:47
The external-template regressions reached an npm shell launcher that crashes under fspy on macOS CI with an arm64/arm64e loader mismatch. Provision a fixed real npm and expose its npx JavaScript entry through a test-owned Node launcher. Keep both CLI flavors, real template execution, existing assertions, and snapshot expectations.
Avoid the system env interpreter as well as npm shell launchers under macOS file tracing. Use a temporary short symlink to the selected Node executable so the shebang stays within the tracer parser limit, assert that bound, and remove the symlink directory on exit.
Verify that external scaffolding actually enters the fixture-provided npx executable with the expected arguments. Include launcher-entry information when scaffolding fails so runner selection failures can be distinguished from downstream process failures.
The snapshot runner exposes sh through a symlink, but fspy recognizes system shells by their /bin or /usr/bin parent. npm resolves its default sh through PATH, bypassing the macOS injectable-shell substitution.

Set npm_config_script_shell to /bin/sh for the Unix external-template fixture. Remove the unnecessary custom npx launcher and its temporary interpreter; keep real template execution and generated-file assertions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant