-
-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compatibility: npm, yarn and pnpm run scripts #144
Conversation
if (!isNPM) { | ||
// yarn | pnpm | ||
patterns = patterns.map((pattern) => { | ||
const match = pattern.match(ARGS_PATTERN) |
Check failure
Code scanning / CodeQL
Polynomial regular expression used on uncontrolled data High
regular expression
library input
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #144 +/- ##
==========================================
+ Coverage 95.93% 96.07% +0.14%
==========================================
Files 35 35
Lines 2142 2142
==========================================
+ Hits 2055 2058 +3
+ Misses 87 84 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@bcomnes Can you rerun the error test? I can't see any error logs. Thanks! |
Can you clarify what the intended end user changes this will require will be? ie what did you have to do before, and what will you need to do after this change. Also, which version of yarn are you targeting? |
I have modified the commit logs and added more descriptions. |
Do I understand correctly: You want to enable people to write a run script like this: {
"scripts": {
"start": "run-s build \"start-server -- --port {1}\" --"
}
} That is invoked like this: $ npm run start 8080 And that prior to your proposed change, this run script wasn't compatible with yarn/pnpm as written, and required the following modification to work with yarn/pnpm: {
"scripts": {
"start": "run-s build \"start-server --port {1}\" --"
}
} But in doing so, breaks compatibility with Your change works by targeting any quoted |
Your understanding is correct. |
Current thoughts on the change (assuming my understanding is correct):
I have a fever right now but I'm going to think about the change some more. cc @ur5us if you have any thoughts. |
Sorry for the delay, I had a fever and was traveling. After thinking about it some more, I don’t think I want to land this. Let me try and convince you why: This is how I understand the issue:
Why I think introducing compatibility layers in npm-run-all2 is undesirable:
My advice: For templates/starter projects that want to support various package mangers, you should make a single selection on generation and adjust your templates based on these incompatibilities. Also if you steer people towards yarn, be sure to start them off on v4 which requires corepack iirc. Older version have bugs that will never be fixed. |
I agree with @bcomnes 👍 |
Some of the explanations can be made in the doc |
Open to that. |
@bcomnes I, too, am slow to respond because of sickness. Anyway, I don’t have many thoughts other than wanting this package to work the way it was advertised to begin with and more specifically the way I ended up using it, i.e. building multiple CSS bundles with TailwindCSS, executed either via a If there’s a good and maintainable way to unify various package managers’ behavior, great. But the previous attempt broke it. Maybe this one is better, dunno. I haven’t looked closely at the proposed code change and haven’t tried for my use case. My gut feeling aligns with your thoughts, i.e. it’s probably futile to try “fix” package managers’ behavior for |
Since I haven't seen any compelling reasons against the above arguments, I'm going to close for now. I don't have bandwidth to document yarn/pnpm concerns but open to PRs that improve that. |
This is a destructive change.
These commits purpose of this PR is to unify the usage of downstream calling because
npm (each version), yarn(v1.x, more see https://github.com/yarnpkg/yarn/pull/4152) and pnpm(v7+, more see https://github.com/pnpm/pnpm/pull/4290 https://github.com/pnpm/pnpm/pull/3492, https://github.com/pnpm/pnpm/pull/7370) handle double-das differently.
Examples:
npm
run scripts with args with thenpm run foo -- --args-go-here
.yarn
run scripts with args with theyarn foo -- --args-go-here
oryarn foo --args-go-here
pnpm
run scripts with args with thepnpm foo --args-go-here
After merged:
We can run
npm|yarn|pnpm [run] foo -- --args-go-here
only becasenpm-run-all2
will changeyarn
andpnpm
script toyarn|pnpm [run] foo --args-go-here
for compatibility. (Based on the use of NPM run-scripts!)More details see: #143