-
Notifications
You must be signed in to change notification settings - Fork 240
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
RFC: Add ability to skip script hooks #185
Conversation
It turns out we're already running the specified script for The whole diff to do this in v7 is: diff --git a/lib/run-script.js b/lib/run-script.js
index 270a91ab7..733534421 100644
--- a/lib/run-script.js
+++ b/lib/run-script.js
@@ -80,11 +80,13 @@ const runScript = async (args) => {
// positional args only added to the main event, not pre/post
const events = [[event, args]]
- if (scripts[`pre${event}`]) {
- events.unshift([`pre${event}`, []])
- }
- if (scripts[`post${event}`]) {
- events.push([`post${event}`, []])
+ if (!npm.flatOptions.ignoreScripts) {
+ if (scripts[`pre${event}`]) {
+ events.unshift([`pre${event}`, []])
+ }
+ if (scripts[`post${event}`]) {
+ events.push([`post${event}`, []])
+ }
}
const opts = {
|
ooh, so to confirm, |
Well... in the current implementation on the beta branch, it'll run test with pretest/posttest. If we accept this RFC, it'll run without pretest/posttest. If we do a different thing, it'll do a different thing :) Whether the current implementation is a feature or a bug is something we'll discuss wednesday in the call. |
Personally, I'm of the opinion that |
I agree - but it shouldnt run the pre and post scripts, ie, I’m strongly in favor of this rfc. The behavior in npm <= 6 is bizarre in that it runs nothing :-) |
Related: #158 |
Besides, is it ok that /* ./package.json */
{
"scripts": {
"preinstall": "echo 'main preinstall'",
"postinstall": "echo 'main postinstall'"
},
"dependencies": {
"sub": "file:sub"
}
}
/* ./sub/package.json */
"name": "sub",
"version": "1.0.0",
"scripts": {
"preinstall": "echo 'sub preinstall'",
"postinstall": "echo 'sub postinstall'"
}, Output: $ npm install
# main preinstall
# main postinstall
$ npm install ./sub
# sub preinstall
# sub postinstall |
We discussed this on the call last week and consensus was that adding another term for this (even the term Going to ratify this proposal as-is, and get the implementation in one of the next few v7 beta releases for play-testing. |
@isaacs Do we merge this or what's the process for the PR? |
See content.