`"pnpm run '/^fmt:.*/'"` doesn't work on Windows
Task description
First of all, thank you for creating this amazing project!!!
I found that "pnpm run '/^fmt:.*/'", which is the script defined in package.json, doesn't work on Windows
Here's the error message run by bash or powershell or CMD
$ pnpm run fmt
> [email protected] fmt C:\Users\samue\Desktop\daily\ThirdParty\liam
> pnpm run '/^fmt:.*/'
ERR_PNPM_NO_SCRIPT Missing script: '/fmt:.*/'
Command "'/fmt:.*/'" not found.
ELIFECYCLE Command failed with exit code 1.
I guess Windows doesn't support this syntax '/^fmt:.*/'
Solutions
I have 3 solutions that an address this issue, before submitting a PR, I would like to discuss the best solution with you.
Solution 1: create a new script for Windows contributors.
package.json
"windows:fmt": "pnpm run fmt:syncpack-fix && pnpm run fmt:syncpack-format && pnpm run fmt:turbo",
"fmt": "pnpm run '/^fmt:.*/'"
Solution 2: use npm-run-all as devDependencies
package.json
"fmt": "npm-run-all fmt:*"
Solution 3: use concurrently as devDependencies
package.json
"fmt": "concurrently \"pnpm:fmt:*\""
The above 3 solutions are tested and worked fine locally in my Windows 11 computer, and I hope to discuss the best solution with you.
Background
TODO (Optional)
- [ ]
- [ ]
- [ ]
Additional notes (Optional)
Hi @samuel871211, Thanks for creating issue!
I see, Could you fix to use concurrently? There are many places in this project where pnpm run is used, so it would be great if you could fix them all at once.
Also, this is a pnpm issue, which I think many users are having trouble with. If you don't mind, could you please try to open an issue with pnpm as well?
@MH4GF Ok!!! I'll work on it ASAP.
@MH4GF
I check the pnpm official doc again
Run all scripts that start with watch::
pnpm run "/^watch:.*/"
regex should be double quoted
I try locally with Windows CMD, powershell, bash
"ttt": "pnpm run \"/^fmt:.*/\"", => works fine
"aaa": "pnpm run '/^fmt:.*/'", => throws an error
In conclusion, I think this might not be a pnpm issue
We will have 2 Solutions
- Keep
concurrentlyas this PR - I'll submit a new PR, to remove
concurrentlyand replace with double quotoed version"pnpm run \"/^fmt:.*/\""
@samuel871211
I didn't know that, thanks!
Keep concurrently is fine for now. It's easier to see the logs this way.