Skip to content
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

Passing args to npm run script - command failed #143

Closed
unlight opened this issue Dec 11, 2020 · 2 comments
Closed

Passing args to npm run script - command failed #143

unlight opened this issue Dec 11, 2020 · 2 comments
Assignees
Labels

Comments

@unlight
Copy link

unlight commented Dec 11, 2020

https://docs.npmjs.com/cli/v6/commands/npm-run-script#synopsis

// package.json (partial)
  "scripts": {
    "lint:src": "eslint \"src/**/*.{ts,tsx}\"",
    "lint:src:fix": "npm run lint:src -- --fix",
    "lint:fix": "npm run lint:src:fix"
  },
ultra lint:fix

Result

>ultra lint:fix
× lint:fix 2.906s
  × lint:src:fix 2.905s
    × lint:src 2.903s
      × $ eslint "src/**/*.{ts,tsx}" -- --fix 2.901s
        │
        │ Oops! Something went wrong! :(
        │
        │ ESLint: 7.15.0
        │
        │ No files matching the pattern "--fix" were found.
        │ Please check for typing mistakes in the pattern.
        │
        │
error
error Command eslint failed with exit code 2

npm run lint:fix works ok, no errors.

Env: Windows 10, Node 12 LTS, ultra installed globally (v3.6.0)

@folke
Copy link
Owner

folke commented Dec 13, 2020

Thank you for reporting this!

Ultra actually supports passing arguments out of the box, like:

$ npm run lint:src --fix

So in your example you could simply leave out the '--' and it would work:

{"scripts": {
    "lint:src": "eslint \"src/**/*.{ts,tsx}\"",
    "lint:src:fix": "npm run lint:src -- --fix",
    "lint:fix": "npm run lint:src:fix"
  }}

However, that would break running it with npm run instead of ultra.

I'll add support for the -- to ultra too.

@folke folke closed this as completed in b095a8a Dec 14, 2020
folke pushed a commit that referenced this issue Dec 14, 2020
### [3.7.1](v3.7.0...v3.7.1) (2020-12-14)

### Bug Fixes

* 🐛 support script run args `npm run test -- --help` (fixes [#143](#143)) ([b095a8a](b095a8a))

### Other

* 👷 fixed pnpm stuff ([994dc09](994dc09))
* 👷 fixed pnpm test ([2cda3cb](2cda3cb))
* 👷 pnpm recursive=false ([e93c8f5](e93c8f5))
* 👷 use babel for code coverage ([c851fe1](c851fe1))
* 👷 use pnpm action ([0f88b3f](0f88b3f))
* 📦️ semantic release config ([7f8e9c4](7f8e9c4))
* **deps:** 🔗 update ([4187c20](4187c20))
* 📦️ update to node v14.15.1 ([9ff679e](9ff679e))
* 📦️ use pnpm instead of yarn ([32d5b6f](32d5b6f))
* 📦️ use pnpm instead of yarn ([0c14c19](0c14c19))
* 📦️ use semantic-release instead of standard-version ([cad9d7e](cad9d7e))
* **deps:** update all non-major dependencies ([#145](#145)) ([003ecdd](003ecdd))
@folke
Copy link
Owner

folke commented Dec 14, 2020

🎉 This issue has been resolved in version 3.7.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@folke folke added the released label Dec 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants