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

Commit

Permalink
Omit name from shrinkwrap when not needed
Browse files Browse the repository at this point in the history
Now that we load the name when creating Node objects in loadVirtual,
there's no need to include it in the shrinkwrap metadata entry.

PR-URL: #74
Credit: @isaacs
Close: #74
Reviewed-by: @ruyadorno
  • Loading branch information
isaacs authored and ruyadorno committed May 14, 2020
1 parent 3f94af2 commit c6d9e46
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 217 deletions.
6 changes: 5 additions & 1 deletion lib/shrinkwrap.js
Expand Up @@ -86,7 +86,7 @@ const maybeStatFile = file => {
}

const pkgMetaKeys = [
'name',
// note: name is included if necessary, for alias packages
'version',
'dependencies',
'peerDependencies',
Expand Down Expand Up @@ -172,6 +172,10 @@ class Shrinkwrap {
if (val)
meta[key.replace(/^_/, '')] = val
})
// we only include name if different from the node path name
const pname = node.package.name
if (pname && pname !== node.name)
meta.name = pname

if (node.isTop && node.package.devDependencies)
meta.devDependencies = node.package.devDependencies
Expand Down

0 comments on commit c6d9e46

Please sign in to comment.