libnpmexec 3.0.2 → 4.0.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.
- package/README.md +0 -1
- package/lib/index.js +3 -6
- package/lib/run-script.js +4 -7
- package/package.json +18 -11
package/README.md
CHANGED
|
@@ -35,7 +35,6 @@ await libexec({
|
|
|
35
35
|
- `color`: Output should use color? **Boolean**, defaults to `false`
|
|
36
36
|
- `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.
|
|
37
37
|
- `locationMsg`: Overrides "at location" message when entering interactive mode **String**
|
|
38
|
-
- `log`: Sets an optional logger **Object**, defaults to `proc-log` module usage.
|
|
39
38
|
- `globalBin`: Location to the global space bin folder, same as: `$(npm bin -g)` **String**, defaults to empty string.
|
|
40
39
|
- `output`: A function to print output to **Function**
|
|
41
40
|
- `packages`: A list of packages to be used (possibly fetch from the registry) **Array<String>**, defaults to `[]`
|
package/lib/index.js
CHANGED
|
@@ -4,7 +4,8 @@ const read = promisify(require('read'))
|
|
|
4
4
|
|
|
5
5
|
const Arborist = require('@npmcli/arborist')
|
|
6
6
|
const ciDetect = require('@npmcli/ci-detect')
|
|
7
|
-
const
|
|
7
|
+
const log = require('proc-log')
|
|
8
|
+
const npmlog = require('npmlog')
|
|
8
9
|
const mkdirp = require('mkdirp-infer-owner')
|
|
9
10
|
const npa = require('npm-package-arg')
|
|
10
11
|
const pacote = require('pacote')
|
|
@@ -39,7 +40,6 @@ const exec = async (opts) => {
|
|
|
39
40
|
yes = undefined,
|
|
40
41
|
...flatOptions
|
|
41
42
|
} = opts
|
|
42
|
-
const log = flatOptions.log || logger
|
|
43
43
|
|
|
44
44
|
// dereferences values because we manipulate it later
|
|
45
45
|
const packages = [..._packages]
|
|
@@ -50,7 +50,6 @@ const exec = async (opts) => {
|
|
|
50
50
|
color,
|
|
51
51
|
flatOptions,
|
|
52
52
|
locationMsg,
|
|
53
|
-
log,
|
|
54
53
|
output,
|
|
55
54
|
path,
|
|
56
55
|
pathArr,
|
|
@@ -169,9 +168,7 @@ const exec = async (opts) => {
|
|
|
169
168
|
const prompt = `Need to install the following packages:\n${
|
|
170
169
|
addList
|
|
171
170
|
}Ok to proceed? `
|
|
172
|
-
|
|
173
|
-
log.clearProgress()
|
|
174
|
-
}
|
|
171
|
+
npmlog.clearProgress()
|
|
175
172
|
const confirm = await read({ prompt, default: 'y' })
|
|
176
173
|
if (confirm.trim().toLowerCase().charAt(0) !== 'y') {
|
|
177
174
|
throw new Error('canceled')
|
package/lib/run-script.js
CHANGED
|
@@ -4,6 +4,8 @@ const chalk = require('chalk')
|
|
|
4
4
|
const ciDetect = require('@npmcli/ci-detect')
|
|
5
5
|
const runScript = require('@npmcli/run-script')
|
|
6
6
|
const readPackageJson = require('read-package-json-fast')
|
|
7
|
+
const npmlog = require('npmlog')
|
|
8
|
+
const log = require('proc-log')
|
|
7
9
|
const noTTY = require('./no-tty.js')
|
|
8
10
|
|
|
9
11
|
const nocolor = {
|
|
@@ -18,7 +20,6 @@ const run = async ({
|
|
|
18
20
|
color,
|
|
19
21
|
flatOptions,
|
|
20
22
|
locationMsg,
|
|
21
|
-
log,
|
|
22
23
|
output = () => {},
|
|
23
24
|
path,
|
|
24
25
|
pathArr,
|
|
@@ -41,9 +42,7 @@ const run = async ({
|
|
|
41
42
|
},
|
|
42
43
|
}
|
|
43
44
|
|
|
44
|
-
|
|
45
|
-
log.disableProgress()
|
|
46
|
-
}
|
|
45
|
+
npmlog.disableProgress()
|
|
47
46
|
|
|
48
47
|
try {
|
|
49
48
|
if (script === scriptShell) {
|
|
@@ -80,9 +79,7 @@ const run = async ({
|
|
|
80
79
|
stdio: 'inherit',
|
|
81
80
|
})
|
|
82
81
|
} finally {
|
|
83
|
-
|
|
84
|
-
log.enableProgress()
|
|
85
|
-
}
|
|
82
|
+
npmlog.enableProgress()
|
|
86
83
|
}
|
|
87
84
|
}
|
|
88
85
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "libnpmexec",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"files": [
|
|
5
5
|
"bin",
|
|
6
6
|
"lib"
|
|
@@ -10,7 +10,11 @@
|
|
|
10
10
|
"node": "^12.13.0 || ^14.15.0 || >=16"
|
|
11
11
|
},
|
|
12
12
|
"description": "npm exec (npx) programmatic API",
|
|
13
|
-
"repository":
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "https://github.com/npm/cli",
|
|
16
|
+
"directory": "workspaces/libnpmexec"
|
|
17
|
+
},
|
|
14
18
|
"keywords": [
|
|
15
19
|
"npm",
|
|
16
20
|
"npmcli",
|
|
@@ -37,7 +41,8 @@
|
|
|
37
41
|
"postversion": "npm publish",
|
|
38
42
|
"prepublishOnly": "git push origin --follow-tags",
|
|
39
43
|
"postlint": "npm-template-check",
|
|
40
|
-
"lintfix": "npm run lint -- --fix"
|
|
44
|
+
"lintfix": "npm run lint -- --fix",
|
|
45
|
+
"template-copy": "npm-template-copy --force"
|
|
41
46
|
},
|
|
42
47
|
"tap": {
|
|
43
48
|
"color": true,
|
|
@@ -45,23 +50,25 @@
|
|
|
45
50
|
"files": "test/*.js"
|
|
46
51
|
},
|
|
47
52
|
"devDependencies": {
|
|
48
|
-
"
|
|
53
|
+
"@npmcli/template-oss": "^2.4.2",
|
|
54
|
+
"bin-links": "^3.0.0",
|
|
49
55
|
"tap": "^15.0.6"
|
|
50
56
|
},
|
|
51
57
|
"dependencies": {
|
|
52
|
-
"@npmcli/arborist": "^
|
|
53
|
-
"@npmcli/ci-detect": "^
|
|
54
|
-
"@npmcli/run-script": "^
|
|
58
|
+
"@npmcli/arborist": "^5.0.0",
|
|
59
|
+
"@npmcli/ci-detect": "^2.0.0",
|
|
60
|
+
"@npmcli/run-script": "^3.0.0",
|
|
55
61
|
"chalk": "^4.1.0",
|
|
56
62
|
"mkdirp-infer-owner": "^2.0.0",
|
|
57
|
-
"npm-package-arg": "^
|
|
58
|
-
"
|
|
59
|
-
"
|
|
63
|
+
"npm-package-arg": "^9.0.0",
|
|
64
|
+
"npmlog": "^6.0.1",
|
|
65
|
+
"pacote": "^13.0.2",
|
|
66
|
+
"proc-log": "^2.0.0",
|
|
60
67
|
"read": "^1.0.7",
|
|
61
68
|
"read-package-json-fast": "^2.0.2",
|
|
62
69
|
"walk-up-path": "^1.0.0"
|
|
63
70
|
},
|
|
64
71
|
"templateOSS": {
|
|
65
|
-
"version": "2.
|
|
72
|
+
"version": "2.9.2"
|
|
66
73
|
}
|
|
67
74
|
}
|