fix(sv-utils): detect pnpm version from the target project, not the invoker cwd - #1320
Open
cpruijsen wants to merge 1 commit into
Open
fix(sv-utils): detect pnpm version from the target project, not the invoker cwd#1320cpruijsen wants to merge 1 commit into
cpruijsen wants to merge 1 commit into
Conversation
|
Install the latest version of pnx https://pkg.svelte.dev/sv/c/a01d82993a4f745b0b53aecc94de6aa0d6fe9d75 createOpen in Note This PR is from a fork. A maintainer must approve approve each commit before it can be built and installed. |
🦋 Changeset detectedLatest commit: a01d829 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1306
Description
pnpm.allowBuildsnow takes{ cwd, pnpmVersion }and detects the pnpm major from the target project, not the invoker cwd.sv create/sv add(addPnpmAllowBuilds) and the Cloudflare adapter pass the target path. Whencwdis omitted, detection runs inos.tmpdir()so the invoker's pin is not inherited.Previously,
pnpm.allowBuildschose betweenallowBuilds(pnpm 11+) andonlyBuiltDependencies(pnpm 10) by runningpnpm --versionwith nocwd, so Node used the invoker's working directory. From this repo (packageManager: pnpm@10.33.4),sv create ../test --install pnpmwrote the legacy key even when the new project would run pnpm 11.pnpm --versionfollowspackage.json#packageManager/devEngines.packageManagerby walking up fromcwd. This repo reports 10.33.4;os.tmpdir()reports 11.26.0; a directory pinned topnpm@11.0.0reports 11.0.0 (same numbers underpnpm exec).Decision: pass target
{ cwd }from first-party callers, accept{ pnpmVersion }for explicit writes, default omitted cwd toos.tmpdir().Alternative: only
cwd: os.tmpdir()insidedetectPnpmMajor(the one-line diff in the issue).Why: tmpdir-only does not fix
pnx sv addin a project whose pin differs from global pnpm (as the issue notes). Can drop the tmpdir default and/or{ pnpmVersion }for a smaller public API; first-party{ cwd }alone fixessv createandsv add.Checklist
api-surface.mdregenerated; CLI create snapshots unchanged (in-repo test apps still see this repo's pnpm 10 pin)