Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

Commit

Permalink
inflate-shrinkwrap: For git changelings use version as resolved
Browse files Browse the repository at this point in the history
Credit: @iarna
PR-URL: #20390
Reviewed-By: @zkat
  • Loading branch information
iarna committed Apr 20, 2018
1 parent 2facb35 commit 9c1eb94
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/install/inflate-shrinkwrap.js
Expand Up @@ -16,6 +16,7 @@ const path = require('path')
const isRegistry = require('../utils/is-registry.js')
const hasModernMeta = require('./has-modern-meta.js')
const ssri = require('ssri')
const npa = require('npm-package-arg')

module.exports = function (tree, sw, opts, finishInflating) {
if (!fetchPackageMetadata) {
Expand Down Expand Up @@ -108,13 +109,18 @@ function inflatableChild (onDiskChild, name, topPath, tree, sw, requested, opts)
}
}

function isGit (sw) {
const version = npa.resolve(sw.name, sw.version)
return (version && version.type === 'git')
}

function makeFakeChild (name, topPath, tree, sw, requested) {
const from = sw.from || requested.raw
const pkg = {
name: name,
version: sw.version,
_id: name + '@' + sw.version,
_resolved: sw.resolved,
_resolved: sw.resolved || (isGit(sw) && sw.version),
_requested: requested,
_optional: sw.optional,
_development: sw.dev,
Expand Down

0 comments on commit 9c1eb94

Please sign in to comment.