libnpmexec 8.0.0 → 8.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +11 -15
- package/package.json +3 -3
package/lib/index.js
CHANGED
|
@@ -4,18 +4,16 @@ const { mkdir } = require('fs/promises')
|
|
|
4
4
|
const Arborist = require('@npmcli/arborist')
|
|
5
5
|
const ciInfo = require('ci-info')
|
|
6
6
|
const crypto = require('crypto')
|
|
7
|
-
const { log } = require('proc-log')
|
|
7
|
+
const { log, input } = require('proc-log')
|
|
8
8
|
const npa = require('npm-package-arg')
|
|
9
9
|
const pacote = require('pacote')
|
|
10
10
|
const { read } = require('read')
|
|
11
11
|
const semver = require('semver')
|
|
12
|
-
|
|
13
12
|
const { fileExists, localFileExists } = require('./file-exists.js')
|
|
14
13
|
const getBinFromManifest = require('./get-bin-from-manifest.js')
|
|
15
14
|
const noTTY = require('./no-tty.js')
|
|
16
15
|
const runScript = require('./run-script.js')
|
|
17
16
|
const isWindows = require('./is-windows.js')
|
|
18
|
-
|
|
19
17
|
const { dirname, resolve } = require('path')
|
|
20
18
|
|
|
21
19
|
const binPaths = []
|
|
@@ -242,26 +240,24 @@ const exec = async (opts) => {
|
|
|
242
240
|
|
|
243
241
|
if (add.length) {
|
|
244
242
|
if (!yes) {
|
|
245
|
-
const
|
|
243
|
+
const addList = add.map(a => `${a.replace(/@$/, '')}`)
|
|
244
|
+
|
|
246
245
|
// set -n to always say no
|
|
247
246
|
if (yes === false) {
|
|
248
247
|
// Error message lists missing package(s) when process is canceled
|
|
249
248
|
/* eslint-disable-next-line max-len */
|
|
250
|
-
throw new Error(`npx canceled due to missing packages and no YES option: ${JSON.stringify(
|
|
249
|
+
throw new Error(`npx canceled due to missing packages and no YES option: ${JSON.stringify(addList)}`)
|
|
251
250
|
}
|
|
252
251
|
|
|
253
252
|
if (noTTY() || ciInfo.isCI) {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
} not found and will be installed: ${
|
|
257
|
-
add.map((pkg) => pkg.replace(/@$/, '')).join(', ')
|
|
258
|
-
}`)
|
|
253
|
+
/* eslint-disable-next-line max-len */
|
|
254
|
+
log.warn('exec', `The following package${add.length === 1 ? ' was' : 's were'} not found and will be installed: ${addList.join(', ')}`)
|
|
259
255
|
} else {
|
|
260
|
-
const
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
256
|
+
const confirm = await input.read(() => read({
|
|
257
|
+
/* eslint-disable-next-line max-len */
|
|
258
|
+
prompt: `Need to install the following packages:\n${addList.join('\n')}\nOk to proceed? `,
|
|
259
|
+
default: 'y',
|
|
260
|
+
}))
|
|
265
261
|
if (confirm.trim().toLowerCase().charAt(0) !== 'y') {
|
|
266
262
|
throw new Error('canceled')
|
|
267
263
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "libnpmexec",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.1.0",
|
|
4
4
|
"files": [
|
|
5
5
|
"bin/",
|
|
6
6
|
"lib/"
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"description": "npm exec (npx) programmatic API",
|
|
13
13
|
"repository": {
|
|
14
14
|
"type": "git",
|
|
15
|
-
"url": "https://github.com/npm/cli.git",
|
|
15
|
+
"url": "git+https://github.com/npm/cli.git",
|
|
16
16
|
"directory": "workspaces/libnpmexec"
|
|
17
17
|
},
|
|
18
18
|
"keywords": [
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"@npmcli/arborist": "^7.2.1",
|
|
63
|
-
"@npmcli/run-script": "^8.
|
|
63
|
+
"@npmcli/run-script": "^8.1.0",
|
|
64
64
|
"ci-info": "^4.0.0",
|
|
65
65
|
"npm-package-arg": "^11.0.2",
|
|
66
66
|
"pacote": "^18.0.1",
|