Skip to content

Commit

Permalink
deps: @npmcli/run-script@7.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
wraithgar committed Jan 23, 2024
1 parent 8382fb3 commit 6883743
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 47 deletions.
13 changes: 7 additions & 6 deletions DEPENDENCIES.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,8 @@ graph LR;
npmcli-package-json-->proc-log;
npmcli-package-json-->semver;
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-->read-package-json-fast;
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"];
Expand Down Expand Up @@ -702,8 +702,8 @@ graph LR;
npmcli-query-->postcss-selector-parser;
npmcli-run-script-->node-gyp;
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-->read-package-json-fast;
npmcli-run-script-->which;
npmcli-smoke-tests-->npmcli-eslint-config["@npmcli/eslint-config"];
npmcli-smoke-tests-->npmcli-mock-registry["@npmcli/mock-registry"];
Expand Down Expand Up @@ -823,9 +823,10 @@ packages higher up the chain.
- @npmcli/mock-registry, libnpmdiff, libnpmfund, libnpmpack
- @npmcli/arborist
- @npmcli/metavuln-calculator
- pacote, libnpmhook, libnpmorg, libnpmsearch, libnpmteam, npm-profile
- npm-registry-fetch, @npmcli/package-json, libnpmversion
- pacote, libnpmversion
- @npmcli/run-script, libnpmhook, libnpmorg, libnpmsearch, libnpmteam, npm-profile
- @npmcli/package-json, npm-registry-fetch
- @npmcli/git, make-fetch-happen, @npmcli/config, init-package-json
- @npmcli/installed-package-contents, @npmcli/map-workspaces, cacache, npm-pick-manifest, @npmcli/run-script, read-package-json, promzard
- @npmcli/docs, @npmcli/fs, npm-bundled, read-package-json-fast, unique-filename, npm-install-checks, npm-package-arg, npm-packlist, normalize-package-data, bin-links, nopt, npmlog, parse-conflict-json, @npmcli/mock-globals, read
- @npmcli/installed-package-contents, @npmcli/map-workspaces, cacache, npm-pick-manifest, read-package-json, promzard
- @npmcli/docs, @npmcli/fs, npm-bundled, read-package-json-fast, unique-filename, npm-install-checks, npm-package-arg, normalize-package-data, npm-packlist, bin-links, nopt, npmlog, parse-conflict-json, @npmcli/mock-globals, read
- @npmcli/eslint-config, @npmcli/template-oss, ignore-walk, semver, npm-normalize-package-bin, @npmcli/name-from-folder, json-parse-even-better-errors, fs-minipass, ssri, unique-slug, @npmcli/promise-spawn, hosted-git-info, proc-log, validate-npm-package-name, @npmcli/node-gyp, @npmcli/agent, minipass-fetch, @npmcli/query, cmd-shim, read-cmd-shim, write-file-atomic, abbrev, are-we-there-yet, gauge, minify-registry-metadata, ini, @npmcli/disparity-colors, mute-stream, npm-audit-report, npm-user-validate
7 changes: 3 additions & 4 deletions node_modules/@npmcli/run-script/lib/is-server-package.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const util = require('util')
const fs = require('fs')
const { stat } = fs.promises || { stat: util.promisify(fs.stat) }
const { resolve } = require('path')
const { stat } = require('node:fs/promises')
const { resolve } = require('node:path')

module.exports = async path => {
try {
const st = await stat(resolve(path, 'server.js'))
Expand Down
2 changes: 0 additions & 2 deletions node_modules/@npmcli/run-script/lib/is-windows.js

This file was deleted.

4 changes: 2 additions & 2 deletions node_modules/@npmcli/run-script/lib/make-spawn-args.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ const makeSpawnArgs = options => {
path,
scriptShell = true,
binPaths,
env = {},
env,
stdio,
cmd,
args = [],
args,
stdioString,
} = options

Expand Down
37 changes: 20 additions & 17 deletions node_modules/@npmcli/run-script/lib/package-envs.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
// https://github.com/npm/rfcs/pull/183

const envVal = val => Array.isArray(val) ? val.map(v => envVal(v)).join('\n\n')
: val === null || val === false ? ''
: String(val)

const packageEnvs = (env, vals, prefix) => {
const packageEnvs = (vals, prefix, env = {}) => {
for (const [key, val] of Object.entries(vals)) {
if (val === undefined) {
continue
} else if (val && !Array.isArray(val) && typeof val === 'object') {
packageEnvs(env, val, `${prefix}${key}_`)
} 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}`] = envVal(val)
env[`${prefix}${key}`] = String(val)
}
}
return env
}

module.exports = (env, pkg) => packageEnvs({ ...env }, {
name: pkg.name,
version: pkg.version,
config: pkg.config,
engines: pkg.engines,
bin: pkg.bin,
}, 'npm_package_')
// 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_')
}
4 changes: 3 additions & 1 deletion node_modules/@npmcli/run-script/lib/run-script-pkg.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const runScriptPkg = async options => {
path,
scriptShell,
binPaths,
env: packageEnvs(env, pkg),
env: { ...env, ...packageEnvs(pkg) },
stdio,
cmd,
args,
Expand All @@ -93,6 +93,8 @@ const runScriptPkg = async options => {

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
Expand Down
13 changes: 7 additions & 6 deletions node_modules/@npmcli/run-script/lib/run-script.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
const rpj = require('read-package-json-fast')
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 = options => {
const runScript = async options => {
validateOptions(options)
const { pkg, path } = options
return pkg ? runScriptPkg(options)
: rpj(path + '/package.json')
.then(readPackage => runScriptPkg({ ...options, pkg: readPackage }))
if (options.pkg) {
return runScriptPkg(options)
}
const { content: pkg } = await PackageJson.normalize(options.path)
return runScriptPkg({ ...options, pkg })
}

module.exports = Object.assign(runScript, { isServerPackage })
6 changes: 3 additions & 3 deletions node_modules/@npmcli/run-script/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@npmcli/run-script",
"version": "7.0.3",
"version": "7.0.4",
"description": "Run a lifecycle script for a package (descendant of npm-lifecycle)",
"author": "GitHub Inc.",
"license": "ISC",
Expand All @@ -17,14 +17,14 @@
"devDependencies": {
"@npmcli/eslint-config": "^4.0.0",
"@npmcli/template-oss": "4.21.3",
"require-inject": "^1.4.4",
"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",
"read-package-json-fast": "^3.0.0",
"which": "^4.0.0"
},
"files": [
Expand Down
10 changes: 5 additions & 5 deletions package-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
"@npmcli/map-workspaces": "^3.0.4",
"@npmcli/package-json": "^5.0.0",
"@npmcli/promise-spawn": "^7.0.1",
"@npmcli/run-script": "^7.0.3",
"@npmcli/run-script": "^7.0.4",
"@sigstore/tuf": "^2.3.0",
"abbrev": "^2.0.0",
"archy": "~1.0.0",
Expand Down Expand Up @@ -1877,15 +1877,15 @@
}
},
"node_modules/@npmcli/run-script": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/@npmcli/run-script/-/run-script-7.0.3.tgz",
"integrity": "sha512-ZMWGLHpzMq3rBGIwPyeaoaleaLMvrBrH8nugHxTi5ACkJZXTxXPtVuEH91ifgtss5hUwJQ2VDnzDBWPmz78rvg==",
"version": "7.0.4",
"resolved": "https://registry.npmjs.org/@npmcli/run-script/-/run-script-7.0.4.tgz",
"integrity": "sha512-9ApYM/3+rBt9V80aYg6tZfzj3UWdiYyCt7gJUD1VJKvWF5nwKDSICXbYIQbspFTq6TOpbsEtIC0LArB8d9PFmg==",
"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",
"read-package-json-fast": "^3.0.0",
"which": "^4.0.0"
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"@npmcli/map-workspaces": "^3.0.4",
"@npmcli/package-json": "^5.0.0",
"@npmcli/promise-spawn": "^7.0.1",
"@npmcli/run-script": "^7.0.3",
"@npmcli/run-script": "^7.0.4",
"@sigstore/tuf": "^2.3.0",
"abbrev": "^2.0.0",
"archy": "~1.0.0",
Expand Down

0 comments on commit 6883743

Please sign in to comment.