pacote 11.2.6 → 11.2.7
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/dir.js +9 -0
- package/lib/git.js +2 -10
- package/lib/util/add-git-sha.js +15 -0
- package/package.json +1 -1
package/lib/dir.js
CHANGED
|
@@ -33,11 +33,20 @@ class DirFetcher extends Fetcher {
|
|
|
33
33
|
// we *only* run prepare.
|
|
34
34
|
// pre/post-pack is run by the npm CLI for publish and pack,
|
|
35
35
|
// but this function is *also* run when installing git deps
|
|
36
|
+
const stdio = this.opts.foregroundScripts ? 'inherit' : 'pipe'
|
|
37
|
+
|
|
38
|
+
// hide the banner if loglevel is silent, or if prepare running
|
|
39
|
+
// in the background.
|
|
40
|
+
const banner = this.opts.log && this.opts.log.level === 'silent' ? false
|
|
41
|
+
: stdio === 'inherit'
|
|
42
|
+
|
|
36
43
|
return runScript({
|
|
37
44
|
pkg: mani,
|
|
38
45
|
event: 'prepare',
|
|
39
46
|
path: this.resolved,
|
|
40
47
|
stdioString: true,
|
|
48
|
+
stdio,
|
|
49
|
+
banner,
|
|
41
50
|
env: {
|
|
42
51
|
npm_package_resolved: this.resolved,
|
|
43
52
|
npm_package_integrity: this.integrity,
|
package/lib/git.js
CHANGED
|
@@ -18,6 +18,7 @@ const _resolvedFromHosted = Symbol('_resolvedFromHosted')
|
|
|
18
18
|
const _resolvedFromClone = Symbol('_resolvedFromClone')
|
|
19
19
|
const _tarballFromResolved = Symbol.for('pacote.Fetcher._tarballFromResolved')
|
|
20
20
|
const _addGitSha = Symbol('_addGitSha')
|
|
21
|
+
const addGitSha = require('./util/add-git-sha.js')
|
|
21
22
|
const _clone = Symbol('_clone')
|
|
22
23
|
const _cloneHosted = Symbol('_cloneHosted')
|
|
23
24
|
const _cloneRepo = Symbol('_cloneRepo')
|
|
@@ -131,16 +132,7 @@ class GitFetcher extends Fetcher {
|
|
|
131
132
|
// when we get the git sha, we affix it to our spec to build up
|
|
132
133
|
// either a git url with a hash, or a tarball download URL
|
|
133
134
|
[_addGitSha] (sha) {
|
|
134
|
-
|
|
135
|
-
const h = this.spec.hosted
|
|
136
|
-
const opt = { noCommittish: true }
|
|
137
|
-
const base = h.https && h.auth ? h.https(opt) : h.shortcut(opt)
|
|
138
|
-
|
|
139
|
-
this[_setResolvedWithSha](`${base}#${sha}`)
|
|
140
|
-
} else {
|
|
141
|
-
const u = url.format(new url.URL(`#${sha}`, this.spec.rawSpec))
|
|
142
|
-
this[_setResolvedWithSha](url.format(u))
|
|
143
|
-
}
|
|
135
|
+
this[_setResolvedWithSha](addGitSha(this.spec, sha))
|
|
144
136
|
}
|
|
145
137
|
|
|
146
138
|
[_resolvedFromClone] () {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// add a sha to a git remote url spec
|
|
2
|
+
const addGitSha = (spec, sha) => {
|
|
3
|
+
if (spec.hosted) {
|
|
4
|
+
const h = spec.hosted
|
|
5
|
+
const opt = { noCommittish: true }
|
|
6
|
+
const base = h.https && h.auth ? h.https(opt) : h.shortcut(opt)
|
|
7
|
+
|
|
8
|
+
return `${base}#${sha}`
|
|
9
|
+
} else {
|
|
10
|
+
// don't use new URL for this, because it doesn't handle scp urls
|
|
11
|
+
return spec.rawSpec.replace(/#.*$/, '') + `#${sha}`
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
module.exports = addGitSha
|