Skip to content
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

fix(runScript): obey silent loglevel #2719

Merged
merged 1 commit into from Feb 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/ci.js
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
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
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
@@ -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