Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authornlf <quitlahok@gmail.com>2022-02-08 23:24:55 +0300
committernlf <nlf@github.com>2022-02-09 00:48:23 +0300
commit0e231d4a40526608411aca0a6e7cf27c750f2409 (patch)
treea629ecca2945a56214eab072c2a7ee8b5b940390 /lib
parent4884821f637ca1992b494fbdbd94d000e4428a40 (diff)
fix(pack): let libnpmpack take care of file writes
Diffstat (limited to 'lib')
-rw-r--r--lib/commands/pack.js17
1 files changed, 2 insertions, 15 deletions
diff --git a/lib/commands/pack.js b/lib/commands/pack.js
index 0719fa3b8..74c29699a 100644
--- a/lib/commands/pack.js
+++ b/lib/commands/pack.js
@@ -1,11 +1,8 @@
-const util = require('util')
const pacote = require('pacote')
const libpack = require('libnpmpack')
const npa = require('npm-package-arg')
-const path = require('path')
const log = require('../utils/log-shim')
const { getContents, logTar } = require('../utils/tar.js')
-const writeFile = util.promisify(require('fs').writeFile)
const BaseCommand = require('../base-command.js')
class Pack extends BaseCommand {
@@ -28,7 +25,6 @@ class Pack extends BaseCommand {
}
const unicode = this.npm.config.get('unicode')
- const dryRun = this.npm.config.get('dry-run')
const json = this.npm.config.get('json')
// Get the manifests and filenames first so we can bail early on manifest
@@ -40,24 +36,15 @@ class Pack extends BaseCommand {
if (!manifest._id) {
throw new Error('Invalid package, must have name and version')
}
-
- const filename = `${manifest.name}-${manifest.version}.tgz`
- .replace(/^@/, '').replace(/\//, '-')
- manifests.push({ arg, filename, manifest })
+ manifests.push({ arg, manifest })
}
// Load tarball names up for printing afterward to isolate from the
// noise generated during packing
const tarballs = []
- for (const { arg, filename, manifest } of manifests) {
+ for (const { arg, manifest } of manifests) {
const tarballData = await libpack(arg, this.npm.flatOptions)
const pkgContents = await getContents(manifest, tarballData)
- const tarballFilename = path.resolve(this.npm.config.get('pack-destination'), filename)
-
- if (!dryRun) {
- await writeFile(tarballFilename, tarballData)
- }
-
tarballs.push(pkgContents)
}