libnpmexec 7.0.9 → 8.0.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/README.md +0 -1
- package/lib/index.js +1 -5
- package/lib/run-script.js +26 -36
- package/package.json +5 -6
package/README.md
CHANGED
|
@@ -35,7 +35,6 @@ await libexec({
|
|
|
35
35
|
- `localBin`: Location to the `node_modules/.bin` folder of the local project to start scanning for bin files **String**, defaults to `./node_modules/.bin`. **libexec** will walk up the directory structure looking for `node_modules/.bin` folders in parent folders that might satisfy the current `arg` and will use that bin if found.
|
|
36
36
|
- `locationMsg`: Overrides "at location" message when entering interactive mode **String**
|
|
37
37
|
- `globalBin`: Location to the global space bin folder, same as: `$(npm bin -g)` **String**, defaults to empty string.
|
|
38
|
-
- `output`: A function to print output to **Function**
|
|
39
38
|
- `packages`: A list of packages to be used (possibly fetch from the registry) **Array<String>**, defaults to `[]`
|
|
40
39
|
- `path`: Location to where to read local project info (`package.json`) **String**, defaults to `.`
|
|
41
40
|
- `runPath`: Location to where to execute the script **String**, defaults to `.`
|
package/lib/index.js
CHANGED
|
@@ -4,9 +4,8 @@ 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 } = require('proc-log')
|
|
8
8
|
const npa = require('npm-package-arg')
|
|
9
|
-
const npmlog = require('npmlog')
|
|
10
9
|
const pacote = require('pacote')
|
|
11
10
|
const { read } = require('read')
|
|
12
11
|
const semver = require('semver')
|
|
@@ -84,7 +83,6 @@ const exec = async (opts) => {
|
|
|
84
83
|
locationMsg = undefined,
|
|
85
84
|
globalBin = '',
|
|
86
85
|
globalPath,
|
|
87
|
-
output,
|
|
88
86
|
// dereference values because we manipulate it later
|
|
89
87
|
packages: [...packages] = [],
|
|
90
88
|
path = '.',
|
|
@@ -99,7 +97,6 @@ const exec = async (opts) => {
|
|
|
99
97
|
call,
|
|
100
98
|
flatOptions,
|
|
101
99
|
locationMsg,
|
|
102
|
-
output,
|
|
103
100
|
path,
|
|
104
101
|
binPaths,
|
|
105
102
|
runPath,
|
|
@@ -264,7 +261,6 @@ const exec = async (opts) => {
|
|
|
264
261
|
const prompt = `Need to install the following packages:\n${
|
|
265
262
|
addList
|
|
266
263
|
}Ok to proceed? `
|
|
267
|
-
npmlog.clearProgress()
|
|
268
264
|
const confirm = await read({ prompt, default: 'y' })
|
|
269
265
|
if (confirm.trim().toLowerCase().charAt(0) !== 'y') {
|
|
270
266
|
throw new Error('canceled')
|
package/lib/run-script.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
const ciInfo = require('ci-info')
|
|
2
2
|
const runScript = require('@npmcli/run-script')
|
|
3
3
|
const readPackageJson = require('read-package-json-fast')
|
|
4
|
-
const
|
|
5
|
-
const log = require('proc-log')
|
|
4
|
+
const { log, output } = require('proc-log')
|
|
6
5
|
const noTTY = require('./no-tty.js')
|
|
7
6
|
|
|
8
7
|
const run = async ({
|
|
@@ -10,7 +9,6 @@ const run = async ({
|
|
|
10
9
|
call,
|
|
11
10
|
flatOptions,
|
|
12
11
|
locationMsg,
|
|
13
|
-
output = () => {},
|
|
14
12
|
path,
|
|
15
13
|
binPaths,
|
|
16
14
|
runPath,
|
|
@@ -21,8 +19,7 @@ const run = async ({
|
|
|
21
19
|
|
|
22
20
|
// do the fakey runScript dance
|
|
23
21
|
// still should work if no package.json in cwd
|
|
24
|
-
const realPkg = await readPackageJson(`${path}/package.json`)
|
|
25
|
-
.catch(() => ({}))
|
|
22
|
+
const realPkg = await readPackageJson(`${path}/package.json`).catch(() => ({}))
|
|
26
23
|
const pkg = {
|
|
27
24
|
...realPkg,
|
|
28
25
|
scripts: {
|
|
@@ -31,41 +28,34 @@ const run = async ({
|
|
|
31
28
|
},
|
|
32
29
|
}
|
|
33
30
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
if (ciInfo.isCI) {
|
|
40
|
-
return log.warn('exec', 'Interactive mode disabled in CI environment')
|
|
41
|
-
}
|
|
31
|
+
if (script === scriptShell) {
|
|
32
|
+
if (!noTTY()) {
|
|
33
|
+
if (ciInfo.isCI) {
|
|
34
|
+
return log.warn('exec', 'Interactive mode disabled in CI environment')
|
|
35
|
+
}
|
|
42
36
|
|
|
43
|
-
|
|
37
|
+
const { chalk } = flatOptions
|
|
44
38
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
39
|
+
output.standard(`${
|
|
40
|
+
chalk.reset('\nEntering npm script environment')
|
|
41
|
+
}${
|
|
42
|
+
chalk.reset(locationMsg || ` at location:\n${chalk.dim(runPath)}`)
|
|
43
|
+
}${
|
|
44
|
+
chalk.bold('\nType \'exit\' or ^D when finished\n')
|
|
45
|
+
}`)
|
|
53
46
|
}
|
|
54
|
-
return await runScript({
|
|
55
|
-
...flatOptions,
|
|
56
|
-
pkg,
|
|
57
|
-
banner: false,
|
|
58
|
-
// we always run in cwd, not --prefix
|
|
59
|
-
path: runPath,
|
|
60
|
-
binPaths,
|
|
61
|
-
event: 'npx',
|
|
62
|
-
args,
|
|
63
|
-
stdio: 'inherit',
|
|
64
|
-
scriptShell,
|
|
65
|
-
})
|
|
66
|
-
} finally {
|
|
67
|
-
npmlog.enableProgress()
|
|
68
47
|
}
|
|
48
|
+
return runScript({
|
|
49
|
+
...flatOptions,
|
|
50
|
+
pkg,
|
|
51
|
+
// we always run in cwd, not --prefix
|
|
52
|
+
path: runPath,
|
|
53
|
+
binPaths,
|
|
54
|
+
event: 'npx',
|
|
55
|
+
args,
|
|
56
|
+
stdio: 'inherit',
|
|
57
|
+
scriptShell,
|
|
58
|
+
})
|
|
69
59
|
}
|
|
70
60
|
|
|
71
61
|
module.exports = run
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "libnpmexec",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0",
|
|
4
4
|
"files": [
|
|
5
5
|
"bin/",
|
|
6
6
|
"lib/"
|
|
@@ -60,12 +60,11 @@
|
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"@npmcli/arborist": "^7.2.1",
|
|
63
|
-
"@npmcli/run-script": "^
|
|
63
|
+
"@npmcli/run-script": "^8.0.0",
|
|
64
64
|
"ci-info": "^4.0.0",
|
|
65
|
-
"npm-package-arg": "^11.0.
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"proc-log": "^3.0.0",
|
|
65
|
+
"npm-package-arg": "^11.0.2",
|
|
66
|
+
"pacote": "^18.0.1",
|
|
67
|
+
"proc-log": "^4.2.0",
|
|
69
68
|
"read": "^3.0.1",
|
|
70
69
|
"read-package-json-fast": "^3.0.2",
|
|
71
70
|
"semver": "^7.3.7",
|