libnpmexec 8.0.0 → 8.1.1

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.
Files changed (2) hide show
  1. package/lib/index.js +11 -15
  2. package/package.json +8 -8
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 missingPackages = add.map(a => `${a.replace(/@$/, '')}`)
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(missingPackages)}`)
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
- log.warn('exec', `The following package${
255
- add.length === 1 ? ' was' : 's were'
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 addList = missingPackages.join('\n') + '\n'
261
- const prompt = `Need to install the following packages:\n${
262
- addList
263
- }Ok to proceed? `
264
- const confirm = await read({ prompt, default: 'y' })
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.0.0",
3
+ "version": "8.1.1",
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": [
@@ -51,19 +51,19 @@
51
51
  "devDependencies": {
52
52
  "@npmcli/eslint-config": "^4.0.0",
53
53
  "@npmcli/mock-registry": "^1.0.0",
54
- "@npmcli/template-oss": "4.21.3",
55
- "bin-links": "^4.0.1",
54
+ "@npmcli/template-oss": "4.22.0",
55
+ "bin-links": "^4.0.4",
56
56
  "chalk": "^5.2.0",
57
57
  "just-extend": "^6.2.0",
58
58
  "just-safe-set": "^4.2.1",
59
59
  "tap": "^16.3.8"
60
60
  },
61
61
  "dependencies": {
62
- "@npmcli/arborist": "^7.2.1",
63
- "@npmcli/run-script": "^8.0.0",
62
+ "@npmcli/arborist": "^7.5.2",
63
+ "@npmcli/run-script": "^8.1.0",
64
64
  "ci-info": "^4.0.0",
65
65
  "npm-package-arg": "^11.0.2",
66
- "pacote": "^18.0.1",
66
+ "pacote": "^18.0.6",
67
67
  "proc-log": "^4.2.0",
68
68
  "read": "^3.0.1",
69
69
  "read-package-json-fast": "^3.0.2",
@@ -72,7 +72,7 @@
72
72
  },
73
73
  "templateOSS": {
74
74
  "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
75
- "version": "4.21.3",
75
+ "version": "4.22.0",
76
76
  "content": "../../scripts/template-oss/index.js"
77
77
  }
78
78
  }