libnpmexec 10.0.0 → 10.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.
- package/lib/index.js +10 -3
- package/package.json +3 -2
package/lib/index.js
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
const { dirname, resolve } = require('node:path')
|
|
4
|
+
const crypto = require('node:crypto')
|
|
3
5
|
const { mkdir } = require('node:fs/promises')
|
|
4
6
|
const Arborist = require('@npmcli/arborist')
|
|
5
7
|
const ciInfo = require('ci-info')
|
|
6
|
-
const crypto = require('node:crypto')
|
|
7
8
|
const { log, input } = require('proc-log')
|
|
8
9
|
const npa = require('npm-package-arg')
|
|
9
10
|
const pacote = require('pacote')
|
|
10
11
|
const { read } = require('read')
|
|
11
12
|
const semver = require('semver')
|
|
13
|
+
const PackageJson = require('@npmcli/package-json')
|
|
12
14
|
const { fileExists, localFileExists } = require('./file-exists.js')
|
|
13
15
|
const getBinFromManifest = require('./get-bin-from-manifest.js')
|
|
14
16
|
const noTTY = require('./no-tty.js')
|
|
15
17
|
const runScript = require('./run-script.js')
|
|
16
18
|
const isWindows = require('./is-windows.js')
|
|
17
|
-
const { dirname, resolve } = require('node:path')
|
|
18
19
|
|
|
19
20
|
const binPaths = []
|
|
20
21
|
|
|
@@ -37,6 +38,7 @@ const missingFromTree = async ({ spec, tree, flatOptions, isNpxTree, shallow })
|
|
|
37
38
|
// - In local or global mode go with anything in the tree that matches
|
|
38
39
|
// - If looking in the npx cache check if a newer version is available
|
|
39
40
|
const npxByNameOnly = isNpxTree && spec.name === spec.raw
|
|
41
|
+
// If they gave a range and not a tag we still need to check if it's outdated.
|
|
40
42
|
if (spec.registry && spec.type !== 'tag' && !npxByNameOnly) {
|
|
41
43
|
// registry spec that is not a specific tag.
|
|
42
44
|
const nodesBySpec = tree.inventory.query('packageName', spec.name)
|
|
@@ -53,7 +55,8 @@ const missingFromTree = async ({ spec, tree, flatOptions, isNpxTree, shallow })
|
|
|
53
55
|
return { node }
|
|
54
56
|
}
|
|
55
57
|
// package requested by version range, only remaining registry type
|
|
56
|
-
|
|
58
|
+
// the npx tree shouldn't be ok w/ an outdated version
|
|
59
|
+
if (!isNpxTree && semver.satisfies(node.package.version, spec.rawSpec)) {
|
|
57
60
|
return { node }
|
|
58
61
|
}
|
|
59
62
|
}
|
|
@@ -289,10 +292,14 @@ const exec = async (opts) => {
|
|
|
289
292
|
}
|
|
290
293
|
await npxArb.reify({
|
|
291
294
|
...flatOptions,
|
|
295
|
+
save: true,
|
|
292
296
|
add,
|
|
293
297
|
})
|
|
294
298
|
}
|
|
295
299
|
binPaths.push(resolve(installDir, 'node_modules/.bin'))
|
|
300
|
+
const pkgJson = await PackageJson.load(installDir)
|
|
301
|
+
pkgJson.update({ _npx: { packages } })
|
|
302
|
+
await pkgJson.save()
|
|
296
303
|
}
|
|
297
304
|
|
|
298
305
|
return await run()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "libnpmexec",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.1.1",
|
|
4
4
|
"files": [
|
|
5
5
|
"bin/",
|
|
6
6
|
"lib/"
|
|
@@ -60,7 +60,8 @@
|
|
|
60
60
|
"tap": "^16.3.8"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@npmcli/arborist": "^9.0.
|
|
63
|
+
"@npmcli/arborist": "^9.0.2",
|
|
64
|
+
"@npmcli/package-json": "^6.1.1",
|
|
64
65
|
"@npmcli/run-script": "^9.0.1",
|
|
65
66
|
"ci-info": "^4.0.0",
|
|
66
67
|
"npm-package-arg": "^12.0.0",
|