libnpmpack 3.0.1 → 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/lib/index.js +12 -1
- package/package.json +10 -7
package/lib/index.js
CHANGED
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
const pacote = require('pacote')
|
|
4
4
|
const npa = require('npm-package-arg')
|
|
5
5
|
const runScript = require('@npmcli/run-script')
|
|
6
|
+
const path = require('path')
|
|
7
|
+
const util = require('util')
|
|
8
|
+
const writeFile = util.promisify(require('fs').writeFile)
|
|
6
9
|
|
|
7
10
|
module.exports = pack
|
|
8
11
|
async function pack (spec = 'file:.', opts = {}) {
|
|
@@ -13,7 +16,7 @@ async function pack (spec = 'file:.', opts = {}) {
|
|
|
13
16
|
|
|
14
17
|
// Default to true if no log options passed, set to false if we're in silent
|
|
15
18
|
// mode
|
|
16
|
-
const banner = !opts.
|
|
19
|
+
const banner = !opts.silent
|
|
17
20
|
|
|
18
21
|
if (spec.type === 'directory') {
|
|
19
22
|
// prepack
|
|
@@ -33,6 +36,14 @@ async function pack (spec = 'file:.', opts = {}) {
|
|
|
33
36
|
integrity: manifest._integrity,
|
|
34
37
|
})
|
|
35
38
|
|
|
39
|
+
// check for explicit `false` so the default behavior is to skip writing to disk
|
|
40
|
+
if (opts.dryRun === false) {
|
|
41
|
+
const filename = `${manifest.name}-${manifest.version}.tgz`
|
|
42
|
+
.replace(/^@/, '').replace(/\//, '-')
|
|
43
|
+
const destination = path.resolve(opts.packDestination, filename)
|
|
44
|
+
await writeFile(destination, tarball)
|
|
45
|
+
}
|
|
46
|
+
|
|
36
47
|
if (spec.type === 'directory') {
|
|
37
48
|
// postpack
|
|
38
49
|
await runScript({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "libnpmpack",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"description": "Programmatic API for the bits behind npm pack",
|
|
5
5
|
"author": "GitHub Inc.",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -21,30 +21,33 @@
|
|
|
21
21
|
"posttest": "npm run lint",
|
|
22
22
|
"postlint": "npm-template-check",
|
|
23
23
|
"lintfix": "npm run lint -- --fix",
|
|
24
|
-
"snap": "tap"
|
|
24
|
+
"snap": "tap",
|
|
25
|
+
"template-copy": "npm-template-copy --force"
|
|
25
26
|
},
|
|
26
27
|
"tap": {
|
|
27
28
|
"check-coverage": true
|
|
28
29
|
},
|
|
29
30
|
"devDependencies": {
|
|
31
|
+
"@npmcli/template-oss": "^2.4.2",
|
|
30
32
|
"nock": "^13.0.7",
|
|
31
33
|
"tap": "^15.0.0"
|
|
32
34
|
},
|
|
33
35
|
"repository": {
|
|
34
36
|
"type": "git",
|
|
35
|
-
"url": "https://github.com/npm/
|
|
37
|
+
"url": "https://github.com/npm/cli",
|
|
38
|
+
"directory": "workspaces/libnpmpack"
|
|
36
39
|
},
|
|
37
40
|
"bugs": "https://github.com/npm/libnpmpack/issues",
|
|
38
41
|
"homepage": "https://npmjs.com/package/libnpmpack",
|
|
39
42
|
"dependencies": {
|
|
40
|
-
"@npmcli/run-script": "^
|
|
41
|
-
"npm-package-arg": "^
|
|
42
|
-
"pacote": "^
|
|
43
|
+
"@npmcli/run-script": "^3.0.0",
|
|
44
|
+
"npm-package-arg": "^9.0.0",
|
|
45
|
+
"pacote": "^13.0.2"
|
|
43
46
|
},
|
|
44
47
|
"engines": {
|
|
45
48
|
"node": "^12.13.0 || ^14.15.0 || >=16"
|
|
46
49
|
},
|
|
47
50
|
"templateOSS": {
|
|
48
|
-
"version": "2.
|
|
51
|
+
"version": "2.9.2"
|
|
49
52
|
}
|
|
50
53
|
}
|