Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't use FileFetcher.manifest() for git pkgs #314

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions lib/git.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,15 +309,13 @@ class GitFetcher extends Fetcher {
return Promise.resolve(this.package)
}

return this.spec.hosted && this.resolved
? FileFetcher.prototype.manifest.apply(this)
: this[_clone](dir =>
this[_readPackageJson](dir + '/package.json')
.then(mani => this.package = {
...mani,
_resolved: this.resolved,
_from: this.from,
}))
return this[_clone](dir =>
this[_readPackageJson](dir + '/package.json')
.then(mani => this.package = {
...mani,
_resolved: this.resolved,
_from: this.from,
}))
}

packument () {
Expand Down
17 changes: 15 additions & 2 deletions test/git.js
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ t.test('extract from tarball from hosted git service', async t => {
scripts: { prepare: 'node prepare.js', test: 'node index.js' },
files: ['index.js'],
_id: '[email protected]',
_integrity: /^sha512-/,
_integrity: undefined,
_resolved: `${remoteHosted}#${REPO_HEAD}`,
})
const p = await g.packument()
Expand All @@ -524,7 +524,7 @@ t.test('extract from tarball from hosted git service', async t => {
scripts: { prepare: 'node prepare.js', test: 'node index.js' },
files: ['index.js'],
_id: '[email protected]',
_integrity: /^sha512-/,
_integrity: undefined,
_resolved: `${remoteHosted}#${REPO_HEAD}`,
dist: {},
},
Expand All @@ -541,6 +541,19 @@ t.test('extract from tarball from hosted git service', async t => {
}
})

t.test('can get manifest without arborist constructor', async t => {
const spec = `localhost:repo/x#${REPO_HEAD}`
const noArbOpts = { ...opts, Arborist: null }
const g = new GitFetcher(spec, noArbOpts)
const m = await g.manifest()
t.match(m, {
name: 'repo',
version: '1.0.0',
_integrity: undefined,
_resolved: `${remoteHosted}#${REPO_HEAD}`,
})
})

t.test('include auth with hosted https when provided', async t => {
const spec = `git+https://user:[email protected]/repo`
const g = new GitFetcher(spec, opts)
Expand Down