From 4156f053ee8712a4b53a210e62fba1e6562ba43a Mon Sep 17 00:00:00 2001 From: Ruy Adorno Date: Fri, 30 Oct 2020 13:57:48 -0400 Subject: [PATCH] @npmcli/run-script@1.7.4 --- .../@npmcli/run-script/lib/is-server-package.js | 10 ++++++++++ .../@npmcli/run-script/lib/run-script-pkg.js | 3 +++ .../@npmcli/run-script/lib/signal-manager.js | 3 +-- node_modules/@npmcli/run-script/package.json | 2 +- package-lock.json | 14 +++++++------- package.json | 2 +- 6 files changed, 23 insertions(+), 11 deletions(-) create mode 100644 node_modules/@npmcli/run-script/lib/is-server-package.js diff --git a/node_modules/@npmcli/run-script/lib/is-server-package.js b/node_modules/@npmcli/run-script/lib/is-server-package.js new file mode 100644 index 0000000000000..667a3c4f2c3ea --- /dev/null +++ b/node_modules/@npmcli/run-script/lib/is-server-package.js @@ -0,0 +1,10 @@ +const { stat } = require('fs').promises +const { resolve } = require('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/@npmcli/run-script/lib/run-script-pkg.js b/node_modules/@npmcli/run-script/lib/run-script-pkg.js index e7d7368beded6..5980376f558f4 100644 --- a/node_modules/@npmcli/run-script/lib/run-script-pkg.js +++ b/node_modules/@npmcli/run-script/lib/run-script-pkg.js @@ -3,6 +3,7 @@ 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') // you wouldn't like me when I'm angry... const bruce = (id, event, cmd) => `\n> ${id ? id + ' ' : ''}${event}\n> ${cmd}\n` @@ -35,6 +36,8 @@ const runScriptPkg = async options => { await isNodeGypPackage(path) ) cmd = defaultGypInstallScript + else if (event === 'start' && await isServerPackage(path)) + cmd = 'node server.js' + args.map(a => ` ${JSON.stringify(a)}`).join('') if (!cmd) return { code: 0, signal: null } diff --git a/node_modules/@npmcli/run-script/lib/signal-manager.js b/node_modules/@npmcli/run-script/lib/signal-manager.js index 30627e5dad4b8..556e758c254f0 100644 --- a/node_modules/@npmcli/run-script/lib/signal-manager.js +++ b/node_modules/@npmcli/run-script/lib/signal-manager.js @@ -33,8 +33,7 @@ const add = proc => { if (!handlersInstalled) setupListeners() - proc.once('exit', ({ code }) => { - process.exitCode = process.exitCode || code + proc.once('exit', () => { runningProcs.delete(proc) cleanupListeners() }) diff --git a/node_modules/@npmcli/run-script/package.json b/node_modules/@npmcli/run-script/package.json index 3a1598fad12f1..5ec3bb5b66876 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": "1.7.3", + "version": "1.7.4", "description": "Run a lifecycle script for a package (descendant of npm-lifecycle)", "author": "Isaac Z. Schlueter (https://izs.me)", "license": "ISC", diff --git a/package-lock.json b/package-lock.json index af5583e23580c..ef9dfa732e7c0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -81,7 +81,7 @@ "@npmcli/arborist": "^1.0.4", "@npmcli/ci-detect": "^1.2.0", "@npmcli/config": "^1.2.1", - "@npmcli/run-script": "^1.7.0", + "@npmcli/run-script": "^1.7.4", "abbrev": "~1.1.1", "ansicolors": "~0.3.2", "ansistyles": "~0.1.3", @@ -524,9 +524,9 @@ } }, "node_modules/@npmcli/run-script": { - "version": "1.7.3", - "resolved": "https://registry.npmjs.org/@npmcli/run-script/-/run-script-1.7.3.tgz", - "integrity": "sha512-kijsbIhpdai+DjZJ8NiHpAl/bQdJf0+hv2qy4pES7QuEXdfulB04HCMbgmmpwAulE88aOXjAj1zo1h8LVMKcWg==", + "version": "1.7.4", + "resolved": "https://registry.npmjs.org/@npmcli/run-script/-/run-script-1.7.4.tgz", + "integrity": "sha512-GAeOB6P4/aYyvEbROVHXuSGPgy4wwQN/fGfXP993o9btyuCAOaz0T2cr5Y1y4nSeaBPfhk5W/E/AfFKDt6yG7w==", "inBundle": true, "dependencies": { "@npmcli/node-gyp": "^1.0.0", @@ -9166,9 +9166,9 @@ } }, "@npmcli/run-script": { - "version": "1.7.3", - "resolved": "https://registry.npmjs.org/@npmcli/run-script/-/run-script-1.7.3.tgz", - "integrity": "sha512-kijsbIhpdai+DjZJ8NiHpAl/bQdJf0+hv2qy4pES7QuEXdfulB04HCMbgmmpwAulE88aOXjAj1zo1h8LVMKcWg==", + "version": "1.7.4", + "resolved": "https://registry.npmjs.org/@npmcli/run-script/-/run-script-1.7.4.tgz", + "integrity": "sha512-GAeOB6P4/aYyvEbROVHXuSGPgy4wwQN/fGfXP993o9btyuCAOaz0T2cr5Y1y4nSeaBPfhk5W/E/AfFKDt6yG7w==", "requires": { "@npmcli/node-gyp": "^1.0.0", "@npmcli/promise-spawn": "^1.3.0", diff --git a/package.json b/package.json index 74e0e7a82f6a2..3709d26dea0ac 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "@npmcli/arborist": "^1.0.4", "@npmcli/ci-detect": "^1.2.0", "@npmcli/config": "^1.2.1", - "@npmcli/run-script": "^1.7.0", + "@npmcli/run-script": "^1.7.4", "abbrev": "~1.1.1", "ansicolors": "~0.3.2", "ansistyles": "~0.1.3",