Skip to content

Instantly share code, notes, and snippets.

@isaacs
Created May 24, 2021 18:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save isaacs/da57f6261183bb9ca741b8032c998dff to your computer and use it in GitHub Desktop.
Save isaacs/da57f6261183bb9ca741b8032c998dff to your computer and use it in GitHub Desktop.
diff --git a/lib/shrinkwrap.js b/lib/shrinkwrap.js
index cff9f096..0a19ef93 100644
--- a/lib/shrinkwrap.js
+++ b/lib/shrinkwrap.js
@@ -714,6 +714,7 @@ class Shrinkwrap {
resolved,
integrity,
hasShrinkwrap,
+ version,
} = this.get(node.path)
const pathFixed = !resolved ? null
@@ -727,8 +728,12 @@ class Shrinkwrap {
node.resolved === pathFixed
const integrityOk = !integrity || !node.integrity ||
node.integrity === integrity
+ const versionOk = !version || !node.version || version === node.version
- if ((resolved || integrity) && resolvedOk && integrityOk) {
+ const allOk = (resolved || integrity || version) &&
+ resolvedOk && integrityOk && versionOk
+
+ if (allOk) {
node.resolved = node.resolved || pathFixed || null
node.integrity = node.integrity || integrity || null
node.hasShrinkwrap = node.hasShrinkwrap || hasShrinkwrap || false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment