From b8f8b414d8ad9635e3efedc6e491c8c6e3df0973 Mon Sep 17 00:00:00 2001 From: Luke Karrys Date: Fri, 12 Apr 2024 15:49:59 -0700 Subject: [PATCH] deps: @npmcli/run-script@8.0.0 --- DEPENDENCIES.md | 2 + lib/commands/ci.js | 1 - lib/commands/explore.js | 1 - lib/commands/install.js | 1 - lib/commands/publish.js | 3 - lib/commands/run-script.js | 1 - node_modules/.gitignore | 5 - .../@npmcli/run-script/lib/run-script-pkg.js | 32 +++-- node_modules/@npmcli/run-script/package.json | 3 +- .../node_modules/@npmcli/run-script/LICENSE | 15 --- .../run-script/lib/is-server-package.js | 11 -- .../@npmcli/run-script/lib/make-spawn-args.js | 40 ------- .../run-script/lib/node-gyp-bin/node-gyp | 2 - .../run-script/lib/node-gyp-bin/node-gyp.cmd | 1 - .../@npmcli/run-script/lib/package-envs.js | 29 ----- .../@npmcli/run-script/lib/run-script-pkg.js | 110 ------------------ .../@npmcli/run-script/lib/run-script.js | 15 --- .../@npmcli/run-script/lib/set-path.js | 45 ------- .../@npmcli/run-script/lib/signal-manager.js | 50 -------- .../run-script/lib/validate-options.js | 39 ------- .../@npmcli/run-script/package.json | 54 --------- package-lock.json | 34 ++---- package.json | 2 +- test/lib/commands/run-script.js | 2 - workspaces/arborist/package.json | 2 +- workspaces/libnpmexec/lib/run-script.js | 1 - workspaces/libnpmexec/package.json | 2 +- workspaces/libnpmpack/package.json | 2 +- workspaces/libnpmversion/lib/version.js | 3 - workspaces/libnpmversion/package.json | 2 +- workspaces/libnpmversion/test/version.js | 12 +- 31 files changed, 38 insertions(+), 484 deletions(-) delete mode 100644 node_modules/pacote/node_modules/@npmcli/run-script/LICENSE delete mode 100644 node_modules/pacote/node_modules/@npmcli/run-script/lib/is-server-package.js delete mode 100644 node_modules/pacote/node_modules/@npmcli/run-script/lib/make-spawn-args.js delete mode 100755 node_modules/pacote/node_modules/@npmcli/run-script/lib/node-gyp-bin/node-gyp delete mode 100755 node_modules/pacote/node_modules/@npmcli/run-script/lib/node-gyp-bin/node-gyp.cmd delete mode 100644 node_modules/pacote/node_modules/@npmcli/run-script/lib/package-envs.js delete mode 100644 node_modules/pacote/node_modules/@npmcli/run-script/lib/run-script-pkg.js delete mode 100644 node_modules/pacote/node_modules/@npmcli/run-script/lib/run-script.js delete mode 100644 node_modules/pacote/node_modules/@npmcli/run-script/lib/set-path.js delete mode 100644 node_modules/pacote/node_modules/@npmcli/run-script/lib/signal-manager.js delete mode 100644 node_modules/pacote/node_modules/@npmcli/run-script/lib/validate-options.js delete mode 100644 node_modules/pacote/node_modules/@npmcli/run-script/package.json diff --git a/DEPENDENCIES.md b/DEPENDENCIES.md index 170be45ba13d9..4fc45a8c584ea 100644 --- a/DEPENDENCIES.md +++ b/DEPENDENCIES.md @@ -228,6 +228,7 @@ graph LR; npmcli-run-script-->npmcli-node-gyp["@npmcli/node-gyp"]; npmcli-run-script-->npmcli-package-json["@npmcli/package-json"]; npmcli-run-script-->npmcli-promise-spawn["@npmcli/promise-spawn"]; + npmcli-run-script-->proc-log; npmcli-smoke-tests-->npmcli-eslint-config["@npmcli/eslint-config"]; npmcli-smoke-tests-->npmcli-mock-registry["@npmcli/mock-registry"]; npmcli-smoke-tests-->npmcli-promise-spawn["@npmcli/promise-spawn"]; @@ -700,6 +701,7 @@ graph LR; npmcli-run-script-->npmcli-node-gyp["@npmcli/node-gyp"]; npmcli-run-script-->npmcli-package-json["@npmcli/package-json"]; npmcli-run-script-->npmcli-promise-spawn["@npmcli/promise-spawn"]; + npmcli-run-script-->proc-log; npmcli-run-script-->which; npmcli-smoke-tests-->npmcli-eslint-config["@npmcli/eslint-config"]; npmcli-smoke-tests-->npmcli-mock-registry["@npmcli/mock-registry"]; diff --git a/lib/commands/ci.js b/lib/commands/ci.js index 395b2167e41d9..9977c776ddf57 100644 --- a/lib/commands/ci.js +++ b/lib/commands/ci.js @@ -109,7 +109,6 @@ class CI extends ArboristWorkspaceCmd { args: [], scriptShell, stdio: 'inherit', - banner: !this.npm.silent, event, }) } diff --git a/lib/commands/explore.js b/lib/commands/explore.js index c9c5618a87cf6..c24565b5c0c42 100644 --- a/lib/commands/explore.js +++ b/lib/commands/explore.js @@ -56,7 +56,6 @@ class Explore extends BaseCommand { return runScript({ ...this.npm.flatOptions, pkg, - banner: false, path, event: '_explore', stdio: 'inherit', diff --git a/lib/commands/install.js b/lib/commands/install.js index 41e5f336f4232..13883499c13f0 100644 --- a/lib/commands/install.js +++ b/lib/commands/install.js @@ -168,7 +168,6 @@ class Install extends ArboristWorkspaceCmd { args: [], scriptShell, stdio: 'inherit', - banner: !this.npm.silent, event, }) } diff --git a/lib/commands/publish.js b/lib/commands/publish.js index 0e2607fb14af5..94a36d8d41212 100644 --- a/lib/commands/publish.js +++ b/lib/commands/publish.js @@ -72,7 +72,6 @@ class Publish extends BaseCommand { path: spec.fetchSpec, stdio: 'inherit', pkg: manifest, - banner: !silent, }) } @@ -131,7 +130,6 @@ class Publish extends BaseCommand { path: spec.fetchSpec, stdio: 'inherit', pkg: manifest, - banner: !silent, }) await runScript({ @@ -139,7 +137,6 @@ class Publish extends BaseCommand { path: spec.fetchSpec, stdio: 'inherit', pkg: manifest, - banner: !silent, }) } diff --git a/lib/commands/run-script.js b/lib/commands/run-script.js index e6c9ceb1aacb8..2a7142a881941 100644 --- a/lib/commands/run-script.js +++ b/lib/commands/run-script.js @@ -114,7 +114,6 @@ class RunScript extends BaseCommand { scriptShell, stdio: 'inherit', pkg, - banner: !this.npm.silent, event: ev, args: evArgs, }) diff --git a/node_modules/.gitignore b/node_modules/.gitignore index d0027e69cf656..5d6f586978e63 100644 --- a/node_modules/.gitignore +++ b/node_modules/.gitignore @@ -181,11 +181,6 @@ !/npm-user-validate !/p-map !/pacote -!/pacote/node_modules/ -/pacote/node_modules/* -!/pacote/node_modules/@npmcli/ -/pacote/node_modules/@npmcli/* -!/pacote/node_modules/@npmcli/run-script !/parse-conflict-json !/path-key !/path-scurry diff --git a/node_modules/@npmcli/run-script/lib/run-script-pkg.js b/node_modules/@npmcli/run-script/lib/run-script-pkg.js index ea33db5629858..a4f27b500718c 100644 --- a/node_modules/@npmcli/run-script/lib/run-script-pkg.js +++ b/node_modules/@npmcli/run-script/lib/run-script-pkg.js @@ -5,19 +5,6 @@ const { isNodeGypPackage, defaultGypInstallScript } = require('@npmcli/node-gyp' const signalManager = require('./signal-manager.js') const isServerPackage = require('./is-server-package.js') -// you wouldn't like me when I'm angry... -const bruce = (id, event, cmd, args) => { - let banner = id - ? `\n> ${id} ${event}\n` - : `\n> ${event}\n` - banner += `> ${cmd.trim().replace(/\n/g, '\n> ')}` - if (args.length) { - banner += ` ${args.join(' ')}` - } - banner += '\n' - return banner -} - const runScriptPkg = async options => { const { event, @@ -29,8 +16,6 @@ const runScriptPkg = async options => { pkg, args = [], stdioString, - // note: only used when stdio:inherit - banner = true, // how long to wait for a process.kill signal // only exposed here so that we can make the test go a bit faster. signalTimeout = 500, @@ -59,9 +44,20 @@ const runScriptPkg = async options => { return { code: 0, signal: null } } - if (stdio === 'inherit' && banner !== false) { - // we're dumping to the parent's stdout, so print the banner - console.log(bruce(pkg._id, event, cmd, args)) + if (stdio === 'inherit') { + let banner + if (pkg._id) { + banner = `\n> ${pkg._id} ${event}\n` + } else { + banner = `\n> ${event}\n` + } + banner += `> ${cmd.trim().replace(/\n/g, '\n> ')}` + if (args.length) { + banner += ` ${args.join(' ')}` + } + banner += '\n' + const { output } = require('proc-log') + output.standard(banner) } const [spawnShell, spawnArgs, spawnOpts] = makeSpawnArgs({ diff --git a/node_modules/@npmcli/run-script/package.json b/node_modules/@npmcli/run-script/package.json index 1c98b1b170e26..dc780ad3ecbec 100644 --- a/node_modules/@npmcli/run-script/package.json +++ b/node_modules/@npmcli/run-script/package.json @@ -1,6 +1,6 @@ { "name": "@npmcli/run-script", - "version": "7.0.4", + "version": "8.0.0", "description": "Run a lifecycle script for a package (descendant of npm-lifecycle)", "author": "GitHub Inc.", "license": "ISC", @@ -25,6 +25,7 @@ "@npmcli/package-json": "^5.0.0", "@npmcli/promise-spawn": "^7.0.0", "node-gyp": "^10.0.0", + "proc-log": "^4.0.0", "which": "^4.0.0" }, "files": [ diff --git a/node_modules/pacote/node_modules/@npmcli/run-script/LICENSE b/node_modules/pacote/node_modules/@npmcli/run-script/LICENSE deleted file mode 100644 index 19cec97b18468..0000000000000 --- a/node_modules/pacote/node_modules/@npmcli/run-script/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) npm, Inc. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/pacote/node_modules/@npmcli/run-script/lib/is-server-package.js b/node_modules/pacote/node_modules/@npmcli/run-script/lib/is-server-package.js deleted file mode 100644 index c36c40d4898d5..0000000000000 --- a/node_modules/pacote/node_modules/@npmcli/run-script/lib/is-server-package.js +++ /dev/null @@ -1,11 +0,0 @@ -const { stat } = require('node:fs/promises') -const { resolve } = require('node:path') - -module.exports = async path => { - try { - const st = await stat(resolve(path, 'server.js')) - return st.isFile() - } catch (er) { - return false - } -} diff --git a/node_modules/pacote/node_modules/@npmcli/run-script/lib/make-spawn-args.js b/node_modules/pacote/node_modules/@npmcli/run-script/lib/make-spawn-args.js deleted file mode 100644 index 8a32d7198cb2e..0000000000000 --- a/node_modules/pacote/node_modules/@npmcli/run-script/lib/make-spawn-args.js +++ /dev/null @@ -1,40 +0,0 @@ -/* eslint camelcase: "off" */ -const setPATH = require('./set-path.js') -const { resolve } = require('path') -const npm_config_node_gyp = require.resolve('node-gyp/bin/node-gyp.js') - -const makeSpawnArgs = options => { - const { - event, - path, - scriptShell = true, - binPaths, - env, - stdio, - cmd, - args, - stdioString, - } = options - - const spawnEnv = setPATH(path, binPaths, { - // we need to at least save the PATH environment var - ...process.env, - ...env, - npm_package_json: resolve(path, 'package.json'), - npm_lifecycle_event: event, - npm_lifecycle_script: cmd, - npm_config_node_gyp, - }) - - const spawnOpts = { - env: spawnEnv, - stdioString, - stdio, - cwd: path, - shell: scriptShell, - } - - return [cmd, args, spawnOpts] -} - -module.exports = makeSpawnArgs diff --git a/node_modules/pacote/node_modules/@npmcli/run-script/lib/node-gyp-bin/node-gyp b/node_modules/pacote/node_modules/@npmcli/run-script/lib/node-gyp-bin/node-gyp deleted file mode 100755 index 5bec64d961a3a..0000000000000 --- a/node_modules/pacote/node_modules/@npmcli/run-script/lib/node-gyp-bin/node-gyp +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env sh -node "$npm_config_node_gyp" "$@" diff --git a/node_modules/pacote/node_modules/@npmcli/run-script/lib/node-gyp-bin/node-gyp.cmd b/node_modules/pacote/node_modules/@npmcli/run-script/lib/node-gyp-bin/node-gyp.cmd deleted file mode 100755 index 4c6987ac9868b..0000000000000 --- a/node_modules/pacote/node_modules/@npmcli/run-script/lib/node-gyp-bin/node-gyp.cmd +++ /dev/null @@ -1 +0,0 @@ -@node "%npm_config_node_gyp%" %* diff --git a/node_modules/pacote/node_modules/@npmcli/run-script/lib/package-envs.js b/node_modules/pacote/node_modules/@npmcli/run-script/lib/package-envs.js deleted file mode 100644 index 612f850fb076c..0000000000000 --- a/node_modules/pacote/node_modules/@npmcli/run-script/lib/package-envs.js +++ /dev/null @@ -1,29 +0,0 @@ -const packageEnvs = (vals, prefix, env = {}) => { - for (const [key, val] of Object.entries(vals)) { - if (val === undefined) { - continue - } else if (val === null || val === false) { - env[`${prefix}${key}`] = '' - } else if (Array.isArray(val)) { - val.forEach((item, index) => { - packageEnvs({ [`${key}_${index}`]: item }, `${prefix}`, env) - }) - } else if (typeof val === 'object') { - packageEnvs(val, `${prefix}${key}_`, env) - } else { - env[`${prefix}${key}`] = String(val) - } - } - return env -} - -// https://github.com/npm/rfcs/pull/183 defines which fields we put into the environment -module.exports = pkg => { - return packageEnvs({ - name: pkg.name, - version: pkg.version, - config: pkg.config, - engines: pkg.engines, - bin: pkg.bin, - }, 'npm_package_') -} diff --git a/node_modules/pacote/node_modules/@npmcli/run-script/lib/run-script-pkg.js b/node_modules/pacote/node_modules/@npmcli/run-script/lib/run-script-pkg.js deleted file mode 100644 index a4f27b500718c..0000000000000 --- a/node_modules/pacote/node_modules/@npmcli/run-script/lib/run-script-pkg.js +++ /dev/null @@ -1,110 +0,0 @@ -const makeSpawnArgs = require('./make-spawn-args.js') -const promiseSpawn = require('@npmcli/promise-spawn') -const packageEnvs = require('./package-envs.js') -const { isNodeGypPackage, defaultGypInstallScript } = require('@npmcli/node-gyp') -const signalManager = require('./signal-manager.js') -const isServerPackage = require('./is-server-package.js') - -const runScriptPkg = async options => { - const { - event, - path, - scriptShell, - binPaths = false, - env = {}, - stdio = 'pipe', - pkg, - args = [], - stdioString, - // how long to wait for a process.kill signal - // only exposed here so that we can make the test go a bit faster. - signalTimeout = 500, - } = options - - const { scripts = {}, gypfile } = pkg - let cmd = null - if (options.cmd) { - cmd = options.cmd - } else if (pkg.scripts && pkg.scripts[event]) { - cmd = pkg.scripts[event] - } else if ( - // If there is no preinstall or install script, default to rebuilding node-gyp packages. - event === 'install' && - !scripts.install && - !scripts.preinstall && - gypfile !== false && - await isNodeGypPackage(path) - ) { - cmd = defaultGypInstallScript - } else if (event === 'start' && await isServerPackage(path)) { - cmd = 'node server.js' - } - - if (!cmd) { - return { code: 0, signal: null } - } - - if (stdio === 'inherit') { - let banner - if (pkg._id) { - banner = `\n> ${pkg._id} ${event}\n` - } else { - banner = `\n> ${event}\n` - } - banner += `> ${cmd.trim().replace(/\n/g, '\n> ')}` - if (args.length) { - banner += ` ${args.join(' ')}` - } - banner += '\n' - const { output } = require('proc-log') - output.standard(banner) - } - - const [spawnShell, spawnArgs, spawnOpts] = makeSpawnArgs({ - event, - path, - scriptShell, - binPaths, - env: { ...env, ...packageEnvs(pkg) }, - stdio, - cmd, - args, - stdioString, - }) - - const p = promiseSpawn(spawnShell, spawnArgs, spawnOpts, { - event, - script: cmd, - pkgid: pkg._id, - path, - }) - - if (stdio === 'inherit') { - signalManager.add(p.process) - } - - if (p.stdin) { - p.stdin.end() - } - - return p.catch(er => { - const { signal } = er - // coverage disabled because win32 never emits signals - /* istanbul ignore next */ - if (stdio === 'inherit' && signal) { - // by the time we reach here, the child has already exited. we send the - // signal back to ourselves again so that npm will exit with the same - // status as the child - process.kill(process.pid, signal) - - // just in case we don't die, reject after 500ms - // this also keeps the node process open long enough to actually - // get the signal, rather than terminating gracefully. - return new Promise((res, rej) => setTimeout(() => rej(er), signalTimeout)) - } else { - throw er - } - }) -} - -module.exports = runScriptPkg diff --git a/node_modules/pacote/node_modules/@npmcli/run-script/lib/run-script.js b/node_modules/pacote/node_modules/@npmcli/run-script/lib/run-script.js deleted file mode 100644 index b00304c8d6e7f..0000000000000 --- a/node_modules/pacote/node_modules/@npmcli/run-script/lib/run-script.js +++ /dev/null @@ -1,15 +0,0 @@ -const PackageJson = require('@npmcli/package-json') -const runScriptPkg = require('./run-script-pkg.js') -const validateOptions = require('./validate-options.js') -const isServerPackage = require('./is-server-package.js') - -const runScript = async options => { - validateOptions(options) - if (options.pkg) { - return runScriptPkg(options) - } - const { content: pkg } = await PackageJson.normalize(options.path) - return runScriptPkg({ ...options, pkg }) -} - -module.exports = Object.assign(runScript, { isServerPackage }) diff --git a/node_modules/pacote/node_modules/@npmcli/run-script/lib/set-path.js b/node_modules/pacote/node_modules/@npmcli/run-script/lib/set-path.js deleted file mode 100644 index c59c270d9969a..0000000000000 --- a/node_modules/pacote/node_modules/@npmcli/run-script/lib/set-path.js +++ /dev/null @@ -1,45 +0,0 @@ -const { resolve, dirname, delimiter } = require('path') -// the path here is relative, even though it does not need to be -// in order to make the posix tests pass in windows -const nodeGypPath = resolve(__dirname, '../lib/node-gyp-bin') - -// Windows typically calls its PATH environ 'Path', but this is not -// guaranteed, nor is it guaranteed to be the only one. Merge them -// all together in the order they appear in the object. -const setPATH = (projectPath, binPaths, env) => { - const PATH = Object.keys(env).filter(p => /^path$/i.test(p) && env[p]) - .map(p => env[p].split(delimiter)) - .reduce((set, p) => set.concat(p.filter(concatted => !set.includes(concatted))), []) - .join(delimiter) - - const pathArr = [] - if (binPaths) { - pathArr.push(...binPaths) - } - // unshift the ./node_modules/.bin from every folder - // walk up until dirname() does nothing, at the root - // XXX we should specify a cwd that we don't go above - let p = projectPath - let pp - do { - pathArr.push(resolve(p, 'node_modules', '.bin')) - pp = p - p = dirname(p) - } while (p !== pp) - pathArr.push(nodeGypPath, PATH) - - const pathVal = pathArr.join(delimiter) - - // XXX include the node-gyp-bin path somehow? Probably better for - // npm or arborist or whoever to just provide that by putting it in - // the PATH environ, since that's preserved anyway. - for (const key of Object.keys(env)) { - if (/^path$/i.test(key)) { - env[key] = pathVal - } - } - - return env -} - -module.exports = setPATH diff --git a/node_modules/pacote/node_modules/@npmcli/run-script/lib/signal-manager.js b/node_modules/pacote/node_modules/@npmcli/run-script/lib/signal-manager.js deleted file mode 100644 index a099a4af2b9be..0000000000000 --- a/node_modules/pacote/node_modules/@npmcli/run-script/lib/signal-manager.js +++ /dev/null @@ -1,50 +0,0 @@ -const runningProcs = new Set() -let handlersInstalled = false - -const forwardedSignals = [ - 'SIGINT', - 'SIGTERM', -] - -// no-op, this is so receiving the signal doesn't cause us to exit immediately -// instead, we exit after all children have exited when we re-send the signal -// to ourselves. see the catch handler at the bottom of run-script-pkg.js -const handleSignal = signal => { - for (const proc of runningProcs) { - proc.kill(signal) - } -} - -const setupListeners = () => { - for (const signal of forwardedSignals) { - process.on(signal, handleSignal) - } - handlersInstalled = true -} - -const cleanupListeners = () => { - if (runningProcs.size === 0) { - for (const signal of forwardedSignals) { - process.removeListener(signal, handleSignal) - } - handlersInstalled = false - } -} - -const add = proc => { - runningProcs.add(proc) - if (!handlersInstalled) { - setupListeners() - } - - proc.once('exit', () => { - runningProcs.delete(proc) - cleanupListeners() - }) -} - -module.exports = { - add, - handleSignal, - forwardedSignals, -} diff --git a/node_modules/pacote/node_modules/@npmcli/run-script/lib/validate-options.js b/node_modules/pacote/node_modules/@npmcli/run-script/lib/validate-options.js deleted file mode 100644 index 8d855916ecd15..0000000000000 --- a/node_modules/pacote/node_modules/@npmcli/run-script/lib/validate-options.js +++ /dev/null @@ -1,39 +0,0 @@ -const validateOptions = options => { - if (typeof options !== 'object' || !options) { - throw new TypeError('invalid options object provided to runScript') - } - - const { - event, - path, - scriptShell, - env = {}, - stdio = 'pipe', - args = [], - cmd, - } = options - - if (!event || typeof event !== 'string') { - throw new TypeError('valid event not provided to runScript') - } - if (!path || typeof path !== 'string') { - throw new TypeError('valid path not provided to runScript') - } - if (scriptShell !== undefined && typeof scriptShell !== 'string') { - throw new TypeError('invalid scriptShell option provided to runScript') - } - if (typeof env !== 'object' || !env) { - throw new TypeError('invalid env option provided to runScript') - } - if (typeof stdio !== 'string' && !Array.isArray(stdio)) { - throw new TypeError('invalid stdio option provided to runScript') - } - if (!Array.isArray(args) || args.some(a => typeof a !== 'string')) { - throw new TypeError('invalid args option provided to runScript') - } - if (cmd !== undefined && typeof cmd !== 'string') { - throw new TypeError('invalid cmd option provided to runScript') - } -} - -module.exports = validateOptions diff --git a/node_modules/pacote/node_modules/@npmcli/run-script/package.json b/node_modules/pacote/node_modules/@npmcli/run-script/package.json deleted file mode 100644 index dc780ad3ecbec..0000000000000 --- a/node_modules/pacote/node_modules/@npmcli/run-script/package.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@npmcli/run-script", - "version": "8.0.0", - "description": "Run a lifecycle script for a package (descendant of npm-lifecycle)", - "author": "GitHub Inc.", - "license": "ISC", - "scripts": { - "test": "tap", - "eslint": "eslint", - "lint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"", - "lintfix": "npm run lint -- --fix", - "postlint": "template-oss-check", - "snap": "tap", - "posttest": "npm run lint", - "template-oss-apply": "template-oss-apply --force" - }, - "devDependencies": { - "@npmcli/eslint-config": "^4.0.0", - "@npmcli/template-oss": "4.21.3", - "spawk": "^1.8.1", - "tap": "^16.0.1" - }, - "dependencies": { - "@npmcli/node-gyp": "^3.0.0", - "@npmcli/package-json": "^5.0.0", - "@npmcli/promise-spawn": "^7.0.0", - "node-gyp": "^10.0.0", - "proc-log": "^4.0.0", - "which": "^4.0.0" - }, - "files": [ - "bin/", - "lib/" - ], - "main": "lib/run-script.js", - "repository": { - "type": "git", - "url": "https://github.com/npm/run-script.git" - }, - "engines": { - "node": "^16.14.0 || >=18.0.0" - }, - "templateOSS": { - "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.21.3", - "publish": "true" - }, - "tap": { - "nyc-arg": [ - "--exclude", - "tap-snapshots/**" - ] - } -} diff --git a/package-lock.json b/package-lock.json index ee971e33b0179..48ca2de9367f9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -97,7 +97,7 @@ "@npmcli/package-json": "^5.0.3", "@npmcli/promise-spawn": "^7.0.1", "@npmcli/redact": "^1.1.0", - "@npmcli/run-script": "^7.0.4", + "@npmcli/run-script": "^8.0.0", "@sigstore/tuf": "^2.3.2", "abbrev": "^2.0.0", "archy": "~1.0.0", @@ -1901,15 +1901,16 @@ } }, "node_modules/@npmcli/run-script": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/@npmcli/run-script/-/run-script-7.0.4.tgz", - "integrity": "sha512-9ApYM/3+rBt9V80aYg6tZfzj3UWdiYyCt7gJUD1VJKvWF5nwKDSICXbYIQbspFTq6TOpbsEtIC0LArB8d9PFmg==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/@npmcli/run-script/-/run-script-8.0.0.tgz", + "integrity": "sha512-5noc+eCQmX1W9nlFUe65n5MIteikd3vOA2sEPdXtlUv68KWyHNFZnT/LDRXu/E4nZ5yxjciP30pADr/GQ97W1w==", "inBundle": true, "dependencies": { "@npmcli/node-gyp": "^3.0.0", "@npmcli/package-json": "^5.0.0", "@npmcli/promise-spawn": "^7.0.0", "node-gyp": "^10.0.0", + "proc-log": "^4.0.0", "which": "^4.0.0" }, "engines": { @@ -10764,23 +10765,6 @@ "node": "^16.14.0 || >=18.0.0" } }, - "node_modules/pacote/node_modules/@npmcli/run-script": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/@npmcli/run-script/-/run-script-8.0.0.tgz", - "integrity": "sha512-5noc+eCQmX1W9nlFUe65n5MIteikd3vOA2sEPdXtlUv68KWyHNFZnT/LDRXu/E4nZ5yxjciP30pADr/GQ97W1w==", - "inBundle": true, - "dependencies": { - "@npmcli/node-gyp": "^3.0.0", - "@npmcli/package-json": "^5.0.0", - "@npmcli/promise-spawn": "^7.0.0", - "node-gyp": "^10.0.0", - "proc-log": "^4.0.0", - "which": "^4.0.0" - }, - "engines": { - "node": "^16.14.0 || >=18.0.0" - } - }, "node_modules/parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -16229,7 +16213,7 @@ "@npmcli/package-json": "^5.0.3", "@npmcli/query": "^3.1.0", "@npmcli/redact": "^1.1.0", - "@npmcli/run-script": "^7.0.2", + "@npmcli/run-script": "^8.0.0", "bin-links": "^4.0.1", "cacache": "^18.0.0", "common-ancestor-path": "^1.0.1", @@ -16341,7 +16325,7 @@ "license": "ISC", "dependencies": { "@npmcli/arborist": "^7.2.1", - "@npmcli/run-script": "^7.0.2", + "@npmcli/run-script": "^8.0.0", "ci-info": "^4.0.0", "npm-package-arg": "^11.0.2", "pacote": "^18.0.0", @@ -16420,7 +16404,7 @@ "license": "ISC", "dependencies": { "@npmcli/arborist": "^7.2.1", - "@npmcli/run-script": "^7.0.2", + "@npmcli/run-script": "^8.0.0", "npm-package-arg": "^11.0.2", "pacote": "^18.0.0" }, @@ -16498,7 +16482,7 @@ "license": "ISC", "dependencies": { "@npmcli/git": "^5.0.6", - "@npmcli/run-script": "^7.0.2", + "@npmcli/run-script": "^8.0.0", "json-parse-even-better-errors": "^3.0.0", "proc-log": "^4.0.0", "semver": "^7.3.7" diff --git a/package.json b/package.json index 1a19a9f2f8565..19198f3e3449d 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,7 @@ "@npmcli/package-json": "^5.0.3", "@npmcli/promise-spawn": "^7.0.1", "@npmcli/redact": "^1.1.0", - "@npmcli/run-script": "^7.0.4", + "@npmcli/run-script": "^8.0.0", "@sigstore/tuf": "^2.3.2", "abbrev": "^2.0.0", "archy": "~1.0.0", diff --git a/test/lib/commands/run-script.js b/test/lib/commands/run-script.js index a110037c8031c..c5bb2b488c053 100644 --- a/test/lib/commands/run-script.js +++ b/test/lib/commands/run-script.js @@ -347,7 +347,6 @@ t.test('skip pre/post hooks when using ignoreScripts', async t => { env: 'env', }, }, - banner: true, event: 'env', }, ]) @@ -388,7 +387,6 @@ t.test('run silent', async t => { }, }, event: 'env', - banner: false, }, { event: 'postenv', diff --git a/workspaces/arborist/package.json b/workspaces/arborist/package.json index 404117ff8c695..2369b3b47c165 100644 --- a/workspaces/arborist/package.json +++ b/workspaces/arborist/package.json @@ -13,7 +13,7 @@ "@npmcli/package-json": "^5.0.3", "@npmcli/query": "^3.1.0", "@npmcli/redact": "^1.1.0", - "@npmcli/run-script": "^7.0.2", + "@npmcli/run-script": "^8.0.0", "bin-links": "^4.0.1", "cacache": "^18.0.0", "common-ancestor-path": "^1.0.1", diff --git a/workspaces/libnpmexec/lib/run-script.js b/workspaces/libnpmexec/lib/run-script.js index 2e8f728c204ae..e85bae81080cd 100644 --- a/workspaces/libnpmexec/lib/run-script.js +++ b/workspaces/libnpmexec/lib/run-script.js @@ -49,7 +49,6 @@ const run = async ({ return runScript({ ...flatOptions, pkg, - banner: false, // we always run in cwd, not --prefix path: runPath, binPaths, diff --git a/workspaces/libnpmexec/package.json b/workspaces/libnpmexec/package.json index 53765d7237668..67da94289092d 100644 --- a/workspaces/libnpmexec/package.json +++ b/workspaces/libnpmexec/package.json @@ -60,7 +60,7 @@ }, "dependencies": { "@npmcli/arborist": "^7.2.1", - "@npmcli/run-script": "^7.0.2", + "@npmcli/run-script": "^8.0.0", "ci-info": "^4.0.0", "npm-package-arg": "^11.0.2", "pacote": "^18.0.0", diff --git a/workspaces/libnpmpack/package.json b/workspaces/libnpmpack/package.json index aa0d821d22e79..518e95420455c 100644 --- a/workspaces/libnpmpack/package.json +++ b/workspaces/libnpmpack/package.json @@ -37,7 +37,7 @@ "homepage": "https://npmjs.com/package/libnpmpack", "dependencies": { "@npmcli/arborist": "^7.2.1", - "@npmcli/run-script": "^7.0.2", + "@npmcli/run-script": "^8.0.0", "npm-package-arg": "^11.0.2", "pacote": "^18.0.0" }, diff --git a/workspaces/libnpmversion/lib/version.js b/workspaces/libnpmversion/lib/version.js index 499a864bb71c0..71b55a21c2889 100644 --- a/workspaces/libnpmversion/lib/version.js +++ b/workspaces/libnpmversion/lib/version.js @@ -65,7 +65,6 @@ module.exports = async (newversion, opts) => { pkg, stdio: 'inherit', event: 'preversion', - banner: !silent, env: { npm_old_version: current, npm_new_version: newV, @@ -101,7 +100,6 @@ module.exports = async (newversion, opts) => { pkg, stdio: 'inherit', event: 'version', - banner: !silent, env: { npm_old_version: current, npm_new_version: newV, @@ -128,7 +126,6 @@ module.exports = async (newversion, opts) => { pkg, stdio: 'inherit', event: 'postversion', - banner: !silent, env: { npm_old_version: current, npm_new_version: newV, diff --git a/workspaces/libnpmversion/package.json b/workspaces/libnpmversion/package.json index 1cac7e02e00ba..62f34509d2882 100644 --- a/workspaces/libnpmversion/package.json +++ b/workspaces/libnpmversion/package.json @@ -38,7 +38,7 @@ }, "dependencies": { "@npmcli/git": "^5.0.6", - "@npmcli/run-script": "^7.0.2", + "@npmcli/run-script": "^8.0.0", "json-parse-even-better-errors": "^3.0.0", "proc-log": "^4.0.0", "semver": "^7.3.7" diff --git a/workspaces/libnpmversion/test/version.js b/workspaces/libnpmversion/test/version.js index e026de900a627..4fee6f5cd2af9 100644 --- a/workspaces/libnpmversion/test/version.js +++ b/workspaces/libnpmversion/test/version.js @@ -333,14 +333,14 @@ t.test('test out bumping the version in all the ways', async t => { t.equal(await version('=v3.2.1', { path, pkg, allowSameVersion: true }), '3.2.1') t.match(actionLog, [ ['run-script', 'preversion', { npm_old_version: '3.2.1', npm_new_version: '3.2.1' }, - { banner: true }], + {}], ['write-json', path + '/package.json', pkg], ['write-json', path + '/npm-shrinkwrap.json', pkg], ['run-script', 'version', { npm_old_version: '3.2.1', npm_new_version: '3.2.1' }, - { banner: true }], + {}], ['verbose', 'version', 'Not tagging: not in a git repo or no git cmd'], ['run-script', 'postversion', { npm_old_version: '3.2.1', npm_new_version: '3.2.1' }, - { banner: true }], + {}], ]) t.equal(pkg.version, '3.2.1') }) @@ -349,14 +349,14 @@ t.test('test out bumping the version in all the ways', async t => { { path, silent: true, pkg, allowSameVersion: true }), '3.2.1') t.match(actionLog, [ ['run-script', 'preversion', { npm_old_version: '3.2.1', npm_new_version: '3.2.1' }, - { banner: false }], + {}], ['write-json', path + '/package.json', pkg], ['write-json', path + '/npm-shrinkwrap.json', pkg], ['run-script', 'version', { npm_old_version: '3.2.1', npm_new_version: '3.2.1' }, - { banner: false }], + {}], ['verbose', 'version', 'Not tagging: not in a git repo or no git cmd'], ['run-script', 'postversion', { npm_old_version: '3.2.1', npm_new_version: '3.2.1' }, - { banner: false }], + {}], ]) t.equal(pkg.version, '3.2.1') })