bcomnes / npm-run-all2

A CLI tool to run multiple npm-scripts in parallel or sequential. (Maintenance fork)
MIT License
250 stars 12 forks source link

[Bug]: run fail in pnpm with read third-party config define #150

Closed Gehbt closed 2 weeks ago

Gehbt commented 3 weeks ago

config define, as long as have it image

script define image

run image

Reproduction

https://github.com/Gehbt/nra2-bug-repo


In yarn or npm, It is fine.

bcomnes commented 2 weeks ago

Thank you for the report, will investigate soon.

bcomnes commented 2 weeks ago

It looks like npm-run-all2 is parsing out the special config field defined in the package.json spec:

https://docs.npmjs.com/cli/v10/configuring-npm/package-json?v=true#config

and passing it as a flag in the form of:

{
  execPath: '/opt/homebrew/Cellar/node/22.8.0/bin/node',
  spawnArgs: [
    '/opt/homebrew/Cellar/pnpm/9.9.0/libexec/lib/node_modules/pnpm/bin/pnpm.cjs',
    'run',
    '--nra2-bug-repo:commitizen_path=cz-conventional-changelog',
    'lint.check'
  ],
...
}

To be perfectly honest, I'm super unfamiliar with the config field in package.json and the various ways it gets used. Npm doesn't seem to care about it (and maybe even uses it somehow, I'm not sure). pnpm OTOH doesn't like extra fields. It looks like yarn also doesn't like the extra fields? Anyway, I'll skip adding those for pnpm as well since it clearly doesn't work when they are passed, and we also skip passing them for yarn classic..

bcomnes commented 2 weeks ago

Try out https://github.com/bcomnes/npm-run-all2/releases/tag/v6.2.3 and please let me know if that works for you.