Skip to content
This repository was archived by the owner on Aug 11, 2022. It is now read-only.

Commit 38cf79f

Browse files
bfred-itiarna
authored andcommitted
lifecycle: Add info log when ignore-scripts is true
A global setting of `ignore-scripts:true` can cause `npm run-script` to silently fail to run scripts. This will add an info-level log PR-URL: #12083 Credit: @bfred-it Reviewed-By: @iarna
1 parent c615182 commit 38cf79f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/utils/lifecycle.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,12 @@ function lifecycle (pkg, stage, wd, unsafe, failOk, cb) {
4646
if (!pkg) return cb(new Error('Invalid package data'))
4747

4848
log.info('lifecycle', logid(pkg, stage), pkg._id)
49-
if (!pkg.scripts || npm.config.get('ignore-scripts')) pkg.scripts = {}
49+
if (!pkg.scripts) pkg.scripts = {}
50+
51+
if (npm.config.get('ignore-scripts')) {
52+
log.info('lifecycle', logid(pkg, stage), 'ignored because ignore-scripts is set to true', pkg._id)
53+
pkg.scripts = {}
54+
}
5055

5156
validWd(wd || path.resolve(npm.dir, pkg.name), function (er, wd) {
5257
if (er) return cb(er)

0 commit comments

Comments
 (0)