summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/pacote/lib/fetchers/directory.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/node_modules/pacote/lib/fetchers/directory.js')
-rw-r--r--deps/npm/node_modules/pacote/lib/fetchers/directory.js21
1 files changed, 18 insertions, 3 deletions
diff --git a/deps/npm/node_modules/pacote/lib/fetchers/directory.js b/deps/npm/node_modules/pacote/lib/fetchers/directory.js
index f6e680f660..83f3d7d558 100644
--- a/deps/npm/node_modules/pacote/lib/fetchers/directory.js
+++ b/deps/npm/node_modules/pacote/lib/fetchers/directory.js
@@ -14,16 +14,31 @@ const readFileAsync = BB.promisify(require('fs').readFile)
const fetchDirectory = module.exports = Object.create(null)
Fetcher.impl(fetchDirectory, {
+ packument (spec, opts) {
+ return this.manifest(spec, opts).then(manifest => {
+ return Object.assign({}, manifest, {
+ 'dist-tags': {
+ 'latest': manifest.version
+ },
+ time: {
+ [manifest.version]: (new Date()).toISOString()
+ },
+ versions: {
+ [manifest.version]: manifest
+ }
+ })
+ })
+ },
// `directory` manifests come from the actual manifest/lockfile data.
manifest (spec, opts) {
const pkgPath = path.join(spec.fetchSpec, 'package.json')
const srPath = path.join(spec.fetchSpec, 'npm-shrinkwrap.json')
return BB.join(
- readFileAsync(pkgPath).then(JSON.parse).catch({code: 'ENOENT'}, err => {
+ readFileAsync(pkgPath).then(JSON.parse).catch({ code: 'ENOENT' }, err => {
err.code = 'ENOPACKAGEJSON'
throw err
}),
- readFileAsync(srPath).then(JSON.parse).catch({code: 'ENOENT'}, () => null),
+ readFileAsync(srPath).then(JSON.parse).catch({ code: 'ENOENT' }, () => null),
(pkg, sr) => {
pkg._shrinkwrap = sr
pkg._hasShrinkwrap = !!sr
@@ -35,7 +50,7 @@ Fetcher.impl(fetchDirectory, {
).then(pkg => {
if (!pkg.bin && pkg.directories && pkg.directories.bin) {
const dirBin = pkg.directories.bin
- return glob(path.join(spec.fetchSpec, dirBin, '/**'), {nodir: true}).then(matches => {
+ return glob(path.join(spec.fetchSpec, dirBin, '/**'), { nodir: true }).then(matches => {
matches.forEach(filePath => {
const relative = path.relative(spec.fetchSpec, filePath)
if (relative && relative[0] !== '.') {