Closed ayu-exorcist closed 4 months ago
EDIT sorry I read this as an issue, not a PR. Looking
Attention: Patch coverage is 69.56522%
with 7 lines
in your changes missing coverage. Please review.
Project coverage is 95.93%. Comparing base (
79e2c97
) to head (b8d3ded
). Report is 28 commits behind head on master.
Files | Patch % | Lines |
---|---|---|
lib/index.js | 69.56% | 7 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
This seems fine. Let's try it out. If this causes issues for anyone, please open an issue!
@bcomnes Before this change, the following was working fine but is now broken:
"build:tailwindcss": "run-p 'build:tailwindcss:* {@}' --",
"build:tailwindcss:admin": "tailwindcss --postcss -i ./app/assets/stylesheets/admin/application.tailwind.css -o ./app/assets/builds/admin/application.css",
"build:tailwindcss:pages": "tailwindcss --postcss -i ./app/assets/stylesheets/application.tailwind.css -o ./app/assets/builds/application.css",
…and then called via yarn build:tailwindcss -- --watch
Am I missing something?
Ok good to know. I'll revert and take a closer look at the change.
I'm leaning to thinking this is probably a correct behavior change, but will likely need to go out in a breaking change. I didn't realize that earlier today. Sorry about that.
Will take a closer look tomorrow and update tests to cover the breaking change.
@ayu-exorcist can you clarify the problem more? What do you need to do right now to get it to work? What doesn't work in that arrangement? What will we need to break to implement your behavior? Specific examples are helpful. I'm trying to read upstream but your insight will be helpful here as well.
"build:tailwindcss": "run-p 'build:tailwindcss:* {@}' --",
Please change "run-p 'build:tailwindcss:* {@}' --"
to *`"run-p 'build:tailwindcss: -- {@}' --"`**
For NPM, --
should not be omitted. When running with Yarn/PNPM, npm-run-all2
will remove it internally.
@ur5us
@ayu-exorcist No, that does not work!
@bcomnes I don't familiar with npm-run-all2
. Needs some help to proceed with the modifications.
@ur5us You need update npm-run-all2
to v6.2.2
@ayu-exorcist just to clarify I reverted this change in v6.2.2 for now. If it goes in it needs to be a breaking change.
@ayu-exorcist just to clarify I reverted this change in v6.2.2 for now. If it goes in it needs to be a breaking change.
@bcomnes Yep, we need to have a provide unified command that is compatible with npm/yarn/pnpm double-dash.
Ok reading through this again.
This should be resolved in the upstream npm-run-all2
Here is my understanding:
npm run foo -- --args-go-here
originally. --
: yarn run foo --args-go-here
, but also supported the --
yarn run foo -- --this-also-works
pnpm run --args-go-here
. pnpm
doesn't handle --
in any special way (it just gets passed as a flag), meaning that its incompatible with the npm
style of passing flags to scripts. Unfortunately this is the worst of all worlds. yarn
introduces a cute omission feature with npm compatibility, pnpm adopts the cute omission pattern, but drops npm compatibility, and npm is what it is. In general, these tools are not interchangeable when it comes to writing run scripts. Pick a pattern, and assert which package manager you expect them to work with. I'm guessing this is what people have worked around for quite a long time.
So the breaking change here would be:
--
args passing, as the examples are written in the docs for nom-run-all2, even if you are running yarn or pnpm.--
args when run with yarn/pnpmI'm going to have to think this over a bit more, since in general as mentioned, pick one and adjust is generally the most pragmatic approach. Trying to support all 3 at once opens up a ton of edge cases to deal with. Also people using yarn and pnpm probably have opinions about adding --
where it's not conventional to do so.
@bcomnes @ayu-exorcist Not sure whether it’s any helpful but here’s the issue when using "run-p 'build:tailwindcss:* -- {@}' --"
on v6.2.1:
With the following in my package.json
"build:tailwindcss": "run-p 'build:tailwindcss:* -- {@}' --",
"build:tailwindcss:admin": "tailwindcss --postcss -i ./app/assets/stylesheets/admin/application.tailwind.css -o ./app/assets/builds/admin/application.css",
"build:tailwindcss:pages": "tailwindcss --postcss -i ./app/assets/stylesheets/application.tailwind.css -o ./app/assets/builds/application.css",
I then get this:
yarn build:tailwindcss --watch
yarn run v1.22.22
$ run-p 'build:tailwindcss:* -- {@}' -- --watch
$ tailwindcss --postcss -i ./app/assets/stylesheets/booking/application.tailwind.css -o ./app/assets/builds/booking/application.css {@}
$ tailwindcss --postcss -i ./app/assets/stylesheets/application.tailwind.css -o ./app/assets/builds/application.css {@}
Note the literal {@}
at the end of command invocation. So the argument forwarding is not working. On v6.2.0 and now v6.2.2 where this change was reverted the {@}
is properly substituted to --watch
.
Solved it! More see: RegExp/test in MDN
@ur5us Just want to reiterate, you should have not had to change anything with this going in. Sorry about the disruption.
Moving discussion over to the new PR: https://github.com/bcomnes/npm-run-all2/pull/144
Fix downstream issue: https://github.com/vuejs/create-vue/issues/393
Related downstream PR: https://github.com/vuejs/create-vue/pull/394
--
double dash behavior in npm/yarn/pnpm