libnpmexec 5.0.0-pre.4 → 5.0.0-pre.5
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/file-exists.js +2 -2
- package/lib/index.js +13 -15
- package/package.json +12 -14
package/lib/file-exists.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
const { resolve } = require('path')
|
|
2
|
-
const
|
|
2
|
+
const { stat } = require('fs/promises')
|
|
3
3
|
const walkUp = require('walk-up-path')
|
|
4
4
|
|
|
5
5
|
const fileExists = async (file) => {
|
|
6
6
|
try {
|
|
7
|
-
const res = await
|
|
7
|
+
const res = await stat(file)
|
|
8
8
|
return res.isFile()
|
|
9
9
|
} catch {
|
|
10
10
|
return false
|
package/lib/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
const { mkdir } = require('fs/promises')
|
|
3
4
|
const { promisify } = require('util')
|
|
4
5
|
|
|
5
6
|
const Arborist = require('@npmcli/arborist')
|
|
6
7
|
const ciDetect = require('@npmcli/ci-detect')
|
|
7
8
|
const crypto = require('crypto')
|
|
8
9
|
const log = require('proc-log')
|
|
9
|
-
const mkdirp = require('mkdirp-infer-owner')
|
|
10
10
|
const npa = require('npm-package-arg')
|
|
11
11
|
const npmlog = require('npmlog')
|
|
12
12
|
const pacote = require('pacote')
|
|
@@ -38,23 +38,21 @@ const getManifest = async (spec, flatOptions) => {
|
|
|
38
38
|
// Returns the required manifest if the spec is missing from the tree
|
|
39
39
|
// Returns the found node if it is in the tree
|
|
40
40
|
const missingFromTree = async ({ spec, tree, flatOptions }) => {
|
|
41
|
-
if (spec.registry &&
|
|
41
|
+
if (spec.registry && spec.type !== 'tag') {
|
|
42
42
|
// registry spec that is not a specific tag.
|
|
43
43
|
const nodesBySpec = tree.inventory.query('packageName', spec.name)
|
|
44
44
|
for (const node of nodesBySpec) {
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
// package requested by name only (or name@*)
|
|
46
|
+
if (spec.rawSpec === '*') {
|
|
47
|
+
return { node }
|
|
48
|
+
}
|
|
49
|
+
// package requested by specific version
|
|
50
|
+
if (spec.type === 'version' && (node.pkgid === spec.raw)) {
|
|
51
|
+
return { node }
|
|
52
|
+
}
|
|
53
|
+
// package requested by version range, only remaining registry type
|
|
54
|
+
if (semver.satisfies(node.package.version, spec.rawSpec)) {
|
|
47
55
|
return { node }
|
|
48
|
-
} else if (spec.type === 'version') {
|
|
49
|
-
// package requested by specific version
|
|
50
|
-
if (node.pkgid === spec.raw) {
|
|
51
|
-
return { node }
|
|
52
|
-
}
|
|
53
|
-
} else {
|
|
54
|
-
// package requested by version range, only remaining registry type
|
|
55
|
-
if (semver.satisfies(node.package.version, spec.rawSpec)) {
|
|
56
|
-
return { node }
|
|
57
|
-
}
|
|
58
56
|
}
|
|
59
57
|
}
|
|
60
58
|
const manifest = await getManifest(spec, flatOptions)
|
|
@@ -205,7 +203,7 @@ const exec = async (opts) => {
|
|
|
205
203
|
.digest('hex')
|
|
206
204
|
.slice(0, 16)
|
|
207
205
|
const installDir = resolve(npxCache, hash)
|
|
208
|
-
await
|
|
206
|
+
await mkdir(installDir, { recursive: true })
|
|
209
207
|
const npxArb = new Arborist({
|
|
210
208
|
...flatOptions,
|
|
211
209
|
path: installDir,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "libnpmexec",
|
|
3
|
-
"version": "5.0.0-pre.
|
|
3
|
+
"version": "5.0.0-pre.5",
|
|
4
4
|
"files": [
|
|
5
5
|
"bin/",
|
|
6
6
|
"lib/"
|
|
@@ -50,32 +50,30 @@
|
|
|
50
50
|
]
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@npmcli/eslint-config": "^
|
|
54
|
-
"@npmcli/template-oss": "4.
|
|
55
|
-
"bin-links": "^
|
|
53
|
+
"@npmcli/eslint-config": "^4.0.0",
|
|
54
|
+
"@npmcli/template-oss": "4.6.2",
|
|
55
|
+
"bin-links": "^4.0.1",
|
|
56
56
|
"minify-registry-metadata": "^2.2.0",
|
|
57
57
|
"mkdirp": "^1.0.4",
|
|
58
58
|
"tap": "^16.0.1"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@npmcli/arborist": "^6.0.0-pre.
|
|
61
|
+
"@npmcli/arborist": "^6.0.0-pre.5",
|
|
62
62
|
"@npmcli/ci-detect": "^3.0.0",
|
|
63
|
-
"@npmcli/
|
|
64
|
-
"@npmcli/run-script": "^4.2.0",
|
|
63
|
+
"@npmcli/run-script": "^5.0.0",
|
|
65
64
|
"chalk": "^4.1.0",
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"proc-log": "^2.0.0",
|
|
65
|
+
"npm-package-arg": "^10.0.0",
|
|
66
|
+
"npmlog": "^7.0.1",
|
|
67
|
+
"pacote": "^15.0.2",
|
|
68
|
+
"proc-log": "^3.0.0",
|
|
71
69
|
"read": "^1.0.7",
|
|
72
|
-
"read-package-json-fast": "^
|
|
70
|
+
"read-package-json-fast": "^3.0.1",
|
|
73
71
|
"semver": "^7.3.7",
|
|
74
72
|
"walk-up-path": "^1.0.0"
|
|
75
73
|
},
|
|
76
74
|
"templateOSS": {
|
|
77
75
|
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
|
|
78
|
-
"version": "4.
|
|
76
|
+
"version": "4.6.2",
|
|
79
77
|
"content": "../../scripts/template-oss/index.js"
|
|
80
78
|
}
|
|
81
79
|
}
|