pnpm: persist global data and add to path #6762
Open
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.
Following off of the similar python and rustup manifests, I have updated pnpm to make use of the $PNPM_HOME env variable in order to install global packages or cli utilities into a scoop-managed and persisted directory (instead of the default on windows:
~/AppData/Local/pnpm/global
An alternative approach would be to:
a) Leave the pnpm default global directory as is, and simply add
~/AppData/Local/pnpm/global
to PATH when installing the manifest. This would also fix issues like #6713. But the application data would not be contained within the~/scoop
folder (generally prefered).b) Instruct users to run
pnpm setup
after installation, which will- create a home directory for the pnpm CLI (
~/AppData/Local/pnpm/global
)- adds the pnpm home directory to the PATH environment variable
- copies the pnpm executable to the pnpm home directory
In this case however, scoop will no longer manage pnpm at all, and it will be no different than installing manually (without scoop).
Note: $PNPM_HOME cannot be set to "$persist_dir\pnpm_data" because it seems that
pnpm
checks at runtime if the exact directory $PNPM_HOME is in $PATH, and doesn't follow symlinks.Fixes: #6713
<manifest-name[@version]|chore>: <general summary of the pull request>