A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/npm/cli/commit/7f541e82a0b2908cc0cfef9a36b714eeab40c029 below:

make pack and exec work with git hash refs (#7815) · npm/cli@7f541e8 · GitHub

File tree Expand file treeCollapse file tree 7 files changed

+42

-3

lines changed

Filter options

Expand file treeCollapse file tree 7 files changed

+42

-3

lines changed Original file line number Diff line number Diff line change

@@ -29,12 +29,13 @@ class Pack extends BaseCommand {

29 29

const unicode = this.npm.config.get('unicode')

30 30

const json = this.npm.config.get('json')

31 31 32 +

const Arborist = require('@npmcli/arborist')

32 33

// Get the manifests and filenames first so we can bail early on manifest

33 34

// errors before making any tarballs

34 35

const manifests = []

35 36

for (const arg of args) {

36 37

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 })

38 39

if (!manifest._id) {

39 40

throw new Error('Invalid package, must have name and version')

40 41

}

Original file line number Diff line number Diff line change

@@ -254,3 +254,27 @@ t.test('npx --no-install @npmcli/npx-test', async t => {

254 254

)

255 255

}

256 256

})

257 + 258 +

t.test('packs from git spec', async t => {

259 +

const spec = 'test/test#111111aaaaaaaabbbbbbbbccccccdddddddeeeee'

260 +

const pkgPath = path.resolve(__dirname, '../../fixtures/git-test.tgz')

261 + 262 +

const srv = MockRegistry.tnock(t, 'https://codeload.github.com')

263 +

srv.get('/test/test/tar.gz/111111aaaaaaaabbbbbbbbccccccdddddddeeeee')

264 +

.times(2)

265 +

.reply(200, await fs.readFile(pkgPath))

266 + 267 +

const { npm } = await loadMockNpm(t, {

268 +

config: {

269 +

audit: false,

270 +

yes: true,

271 +

},

272 +

})

273 +

try {

274 +

await npm.exec('exec', [spec])

275 +

const exists = await fs.stat(path.join(npm.prefix, 'npm-exec-test-success'))

276 +

t.ok(exists.isFile(), 'bin ran, creating file')

277 +

} catch (err) {

278 +

t.fail(err, "shouldn't throw")

279 +

}

280 +

})

Original file line number Diff line number Diff line change

@@ -24,7 +24,7 @@ const manifests = new Map()

24 24 25 25

const getManifest = async (spec, flatOptions) => {

26 26

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 })

28 28

manifests.set(spec.raw, manifest)

29 29

}

30 30

return manifests.get(spec.raw)

Original file line number Diff line number Diff line change

@@ -12,7 +12,7 @@ async function pack (spec = 'file:.', opts = {}) {

12 12

// gets spec

13 13

spec = npa(spec)

14 14 15 -

const manifest = await pacote.manifest(spec, opts)

15 +

const manifest = await pacote.manifest(spec, { ...opts, Arborist })

16 16 17 17

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

18 18 Original file line number Diff line number Diff line change

@@ -7,6 +7,7 @@ const spawk = tspawk(t)

7 7 8 8

const fs = require('node:fs')

9 9

const path = require('node:path')

10 +

const { resolve } = require('node:path')

10 11

const pack = require('../lib/index.js')

11 12

const tnock = require('./fixtures/tnock.js')

12 13

@@ -133,6 +134,19 @@ t.test('packs from registry spec', async t => {

133 134

t.ok(tarball)

134 135

})

135 136 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 + 136 150

t.test('runs scripts in foreground when foregroundScripts === true', async t => {

137 151

const testDir = t.testdir({

138 152

'package.json': JSON.stringify({

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4