Content-Length: 413758 | pFad | http://github.com/npm/cli/commit/c68b9a05abd672cab99c12439b3068018adab55b

93 fix: pass arborist constructor to manifest call · npm/cli@c68b9a0 · GitHub
Skip to content

Commit c68b9a0

Browse files
committed
fix: pass arborist constructor to manifest call
1 parent 534ad77 commit c68b9a0

File tree

5 files changed

+18
-3
lines changed

5 files changed

+18
-3
lines changed

lib/commands/pack.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,13 @@ class Pack extends BaseCommand {
2929
const unicode = this.npm.config.get('unicode')
3030
const json = this.npm.config.get('json')
3131

32+
const Arborist = require('@npmcli/arborist')
3233
// Get the manifests and filenames first so we can bail early on manifest
3334
// errors before making any tarballs
3435
const manifests = []
3536
for (const arg of args) {
3637
const spec = npa(arg)
37-
const manifest = await pacote.manifest(spec, this.npm.flatOptions)
38+
const manifest = await pacote.manifest(spec, { ...this.npm.flatOptions, Arborist })
3839
if (!manifest._id) {
3940
throw new Error('Invalid package, must have name and version')
4041
}

workspaces/libnpmexec/lib/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const manifests = new Map()
2424

2525
const getManifest = async (spec, flatOptions) => {
2626
if (!manifests.has(spec.raw)) {
27-
const manifest = await pacote.manifest(spec, { ...flatOptions, preferOnline: true })
27+
const manifest = await pacote.manifest(spec, { ...flatOptions, preferOnline: true, Arborist })
2828
manifests.set(spec.raw, manifest)
2929
}
3030
return manifests.get(spec.raw)

workspaces/libnpmpack/lib/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ async function pack (spec = 'file:.', opts = {}) {
1212
// gets spec
1313
spec = npa(spec)
1414

15-
const manifest = await pacote.manifest(spec, opts)
15+
const manifest = await pacote.manifest(spec, { ...opts, Arborist })
1616

1717
const stdio = opts.foregroundScripts ? 'inherit' : 'pipe'
1818

245 Bytes
Binary file not shown.

workspaces/libnpmpack/test/index.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const spawk = tspawk(t)
77

88
const fs = require('node:fs')
99
const path = require('node:path')
10+
const { resolve } = require('node:path')
1011
const pack = require('../lib/index.js')
1112
const tnock = require('./fixtures/tnock.js')
1213

@@ -133,6 +134,19 @@ t.test('packs from registry spec', async t => {
133134
t.ok(tarball)
134135
})
135136

137+
t.test('packs from git spec', async t => {
138+
const spec = 'test/test#111111aaaaaaaabbbbbbbbccccccdddddddeeeee'
139+
const pkgPath = resolve(__dirname, 'fixtures/git-test.tgz')
140+
141+
const srv = tnock(t, 'https://codeload.github.com')
142+
srv.get('/test/test/tar.gz/111111aaaaaaaabbbbbbbbccccccdddddddeeeee')
143+
.times(2)
144+
.reply(200, fs.readFileSync(pkgPath))
145+
146+
const tarball = await pack(spec, { ...OPTS })
147+
t.ok(tarball)
148+
})
149+
136150
t.test('runs scripts in foreground when foregroundScripts === true', async t => {
137151
const testDir = t.testdir({
138152
'package.json': JSON.stringify({

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/npm/cli/commit/c68b9a05abd672cab99c12439b3068018adab55b

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy