Skip to content

Conversation

@alexsch01
Copy link
Contributor

@alexsch01 alexsch01 commented May 12, 2025

Backport of #8278 for npm 10 series

Continuation of #8267 @mbtools --- This fixes the command `npm test -- hello -p1 world -p2 "hello world" --q1=hello world --q2="hello world"` in Windows PowerShell and pwsh7 - where the "test" script prints all the arguments passed after the first "--" in the command above Before this change ``` PS> npm test -- hello -p1 world -p2 "hello world" --q1=hello world --q2="hello world" npm warn "world" is being parsed as a normal command line argument. npm warn "hello world" is being parsed as a normal command line argument. npm warn Unknown cli config "--p1". This will stop working in the next major version of npm. npm warn Unknown cli config "--p2". This will stop working in the next major version of npm. npm warn Unknown cli config "--q1". This will stop working in the next major version of npm. npm warn Unknown cli config "--q2". This will stop working in the next major version of npm. > test@1.0.0 test > node args.js hello world hello world world hello world hello world world ``` With this change ``` PS> npm test -- hello -p1 world -p2 "hello world" --q1=hello world --q2="hello world" > test@1.0.0 test > node args.js hello -p1 world -p2 hello world --q1=hello world --q2=hello world hello -p1 world -p2 hello world --q1=hello world --q2=hello world ``` --- Also, fixes comma-separated values in Windows PowerShell and pwsh7 Before this change ``` PS> npm help a=1,b=2,c=3 No matches in help for: a=1 b=2 c=3 ``` With this change ``` PS> npm help a=1,b=2,c=3 No matches in help for: a=1,b=2,c=3 ```
@alexsch01 alexsch01 requested a review from a team as a code owner May 12, 2025 17:08
@wraithgar
Copy link
Member

Since npm 10 is in a maintenance mode we're gonna sit on this PR till the next npm 11 release is out and folks have had a chance to test this new script out. If there are any hiccups that'll cut back on the backporting we have to do.

@alexsch01
Copy link
Contributor Author

going to remake this at some point

@alexsch01 alexsch01 closed this May 15, 2025
@alexsch01 alexsch01 deleted the release/v10 branch May 15, 2025 15:57
@alexsch01 alexsch01 mentioned this pull request May 15, 2025
@alexsch01 alexsch01 changed the title fix(powershell): use Invoke-Expression to pass args invalid May 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants