Skip to content

feat: allow npm flags (e.g. --install-links) in default-packages file - #3922

Draft
ousamabenyounes wants to merge 1 commit into
nvm-sh:masterfrom
ousamabenyounes:fix/issue-3866
Draft

ousamabenyounes wants to merge 1 commit into
nvm-sh:masterfrom
ousamabenyounes:fix/issue-3866

Conversation

@ousamabenyounes

Copy link
Copy Markdown
Contributor

nvm_get_default_packages now permits npm flags (tokens starting with -) alongside a package on a line, or on their own line, instead of rejecting any line containing whitespace. Lines with 2+ actual packages are still rejected. Fixes #3866.

Test verification (RED → GREEN)

With the fix reverted, the new test fails (RED):

Only one package per line is allowed in `/tmp/tmp.TK9aPs5jOf/default-packages`. Please remove any lines with multiple space-separated values.
6: expected default packages >rimraf my-internal-tool --install-links --foreground-scripts<; got >rimraf<

With the fix applied, the test passes (GREEN):

GREEN attempt 1/2 (exit 0)
6: ok: >rimraf my-internal-tool --install-links --foreground-scripts<
7: ok: >Only one package per line is allowed in `/tmp/tmp.nLf2gNVUfX/default-packages`. Please remove any lines with multiple space-separated values.<

Full local suite

Command: npm run test/fast

+ type setopt
+ type shopt
+ rm -fR v* src alias test/test-xz
+ cd ../..
+ type setopt
+ type shopt
+ rm -Rf v* src alias
+ mkdir src alias
+ cd ../..
+ type setopt
+ type shopt
+ rm -fR v* src alias test/test-xz
+ cd ../..
+ type setopt
+ type shopt
+ rm -Rf v* src alias
+ mkdir src alias
+ cd ../..
+ type setopt
+ type shopt
+ rm -fR v* src alias test/test-xz
+ cd ../..
+ type setopt
+ type shopt
+ rm -Rf v* src alias
+ mkdir src alias
+ cd ../..
+ type setopt
+ type shopt
+ rm -fR v* src alias test/test-xz
+ cd ../..
+ [ -d bak ]
+ mv bak/alias bak/versions .
+ rmdir bak
+ mkdir -p src alias

Done, took 205 seconds.
223 tests passed.
�[31m6 tests failed.
�[mmake: *** [Makefile:43: test-bash] Error 6

Fix #3866

@ljharb

ljharb commented Sep 11, 2026

Copy link
Copy Markdown
Member

This PR was premature; the issue does not have "help wanted" and it's not certain it's even a feature I want to have.

@ljharb
ljharb marked this pull request as draft September 11, 2026 17:47
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.

Support passing CLI arguments / --install-links to the default packages list

2 participants