Skip to content

Commit

Permalink
fix(runScript): obey silent loglevel
Browse files Browse the repository at this point in the history
If the user has specified a silent loglevel, we should pass that intention on
when we call runScript

Also a small cleanup in lib/run-script.js so that the reference to
@npmcli/run-script is named the same as other files.
  • Loading branch information
wraithgar committed Feb 17, 2021
1 parent e703362 commit 0071184
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions lib/ci.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ const ci = async () => {
scriptShell,
stdio: 'inherit',
stdioString: true,
banner: log.level !== 'silent',
event,
})
}
Expand Down
1 change: 1 addition & 0 deletions lib/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ const install = async args => {
scriptShell,
stdio: 'inherit',
stdioString: true,
banner: log.level !== 'silent',
event,
})
}
Expand Down
3 changes: 3 additions & 0 deletions lib/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ const publish_ = async (arg, opts) => {
path: spec.fetchSpec,
stdio: 'inherit',
pkg: manifest,
banner: log.level !== 'silent',
})
}

Expand Down Expand Up @@ -121,13 +122,15 @@ const publish_ = async (arg, opts) => {
path: spec.fetchSpec,
stdio: 'inherit',
pkg: manifest,
banner: log.level !== 'silent',
})

await runScript({
event: 'postpublish',
path: spec.fetchSpec,
stdio: 'inherit',
pkg: manifest,
banner: log.level !== 'silent',
})
}

Expand Down
10 changes: 5 additions & 5 deletions lib/run-script.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const run = require('@npmcli/run-script')
const { isServerPackage } = run
const runScript = require('@npmcli/run-script')
const { isServerPackage } = runScript
const npm = require('./npm.js')
const readJson = require('read-package-json-fast')
const { resolve } = require('path')
Expand Down Expand Up @@ -27,11 +27,11 @@ const completion = async (opts, cb) => {
}

const cmd = (args, cb) => {
const fn = args.length ? runScript : list
const fn = args.length ? doRun : list
return fn(args).then(() => cb()).catch(cb)
}

const runScript = async (args) => {
const doRun = async (args) => {
const path = npm.localPrefix
const event = args.shift()
const { scriptShell } = npm.flatOptions
Expand Down Expand Up @@ -76,7 +76,7 @@ const runScript = async (args) => {
}

for (const [event, args] of events) {
await run({
await runScript({
...opts,
event,
args,
Expand Down

0 comments on commit 0071184

Please sign in to comment.