-
-
Notifications
You must be signed in to change notification settings - Fork 429
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
feat: Remove support for npm scripts #390
Conversation
- Update `findBin` to only resolve binaries installed locally or globally. Also add simple caching. - Update readme. - Remove dependency `app-root-path`. - Update tests. BREAKING CHANGE: Remove implicit support for running npm scripts. Consider example `lint-staged` config: { "name": "My project", "version": "0.1.0", "scripts": { "my-custom-script": "linter --arg1 --arg2", "precommit": "lint-staged" }, "lint-staged": { "*.js": ["my-custom-script", "git add"] } } The list of commands should be changed to the following: "*.js": ["npm run my-custom-script --", "git add"]
Codecov Report
@@ Coverage Diff @@
## next #390 +/- ##
=========================================
+ Coverage 98.11% 98.22% +0.1%
=========================================
Files 10 11 +1
Lines 212 225 +13
Branches 23 24 +1
=========================================
+ Hits 208 221 +13
Misses 4 4
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! Much cleaner this way. LGTM besides the question I asked.
src/findBin.js
Outdated
} catch (err) { | ||
throw new Error(`${bin} could not be found. Try \`npm install ${bin}\`.`) | ||
throw new Error(`${binName} could not be found. Try \`npm install ${binName}\`.`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we try smoothen the migration for users who rely on this feature by checking if it exists in package.json and throwing a different error you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My apologies, it slipped my mind.
Hey @okonet, I have done the changes for the helpful message. Could you take a look? |
- Update `findBin` to only resolve binaries installed locally or globally. Also add simple caching. - Check pkg scripts when `findBin` fails and print useful message to aid users in migration to newer version config. - Update readme. - Remove dependency `app-root-path`. - Update tests. BREAKING CHANGE: Remove implicit support for running npm scripts. Consider example `lint-staged` config: { "name": "My project", "version": "0.1.0", "scripts": { "my-custom-script": "linter --arg1 --arg2", "precommit": "lint-staged" }, "lint-staged": { "*.js": ["my-custom-script", "git add"] } } The list of commands should be changed to the following: "*.js": ["npm run my-custom-script --", "git add"]
- Update `findBin` to only resolve binaries installed locally or globally. Also add simple caching. - Check pkg scripts when `findBin` fails and print useful message to aid users in migration to newer version config. - Update readme. - Remove dependency `app-root-path`. - Update tests. BREAKING CHANGE: Remove implicit support for running npm scripts. Consider example `lint-staged` config: { "name": "My project", "version": "0.1.0", "scripts": { "my-custom-script": "linter --arg1 --arg2", "precommit": "lint-staged" }, "lint-staged": { "*.js": ["my-custom-script", "git add"] } } The list of commands should be changed to the following: "*.js": ["npm run my-custom-script --", "git add"]
- Update `findBin` to only resolve binaries installed locally or globally. Also add simple caching. - Check pkg scripts when `findBin` fails and print useful message to aid users in migration to newer version config. - Update readme. - Remove dependency `app-root-path`. - Update tests. BREAKING CHANGE: Remove implicit support for running npm scripts. Consider example `lint-staged` config: { "name": "My project", "version": "0.1.0", "scripts": { "my-custom-script": "linter --arg1 --arg2", "precommit": "lint-staged" }, "lint-staged": { "*.js": ["my-custom-script", "git add"] } } The list of commands should be changed to the following: "*.js": ["npm run my-custom-script --", "git add"]
This removes support for running scripts defined in package.json using
lint-staged
. The same can be done by specifying the command asnpm run script-name --
. This also adds a slight perf improvement forfindbin
by introducing simple caching to avoid repeatedly resolving binaries(ex:git
).Closes #376.