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

Commit

Permalink
lifecycle: Add info log when ignore-scripts is true
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bfred-it authored and iarna committed Apr 7, 2016
1 parent c615182 commit 38cf79f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/utils/lifecycle.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,12 @@ function lifecycle (pkg, stage, wd, unsafe, failOk, cb) {
if (!pkg) return cb(new Error('Invalid package data'))

log.info('lifecycle', logid(pkg, stage), pkg._id)
if (!pkg.scripts || npm.config.get('ignore-scripts')) pkg.scripts = {}
if (!pkg.scripts) pkg.scripts = {}

if (npm.config.get('ignore-scripts')) {
log.info('lifecycle', logid(pkg, stage), 'ignored because ignore-scripts is set to true', pkg._id)
pkg.scripts = {}
}

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

0 comments on commit 38cf79f

Please sign in to comment.