Skip to content

Instantly share code, notes, and snippets.

@fand
Created March 23, 2016 10:41
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 fand/65afa35bdea73e57d2ab to your computer and use it in GitHub Desktop.
Save fand/65afa35bdea73e57d2ab to your computer and use it in GitHub Desktop.
npm3 tree structure

a -> c

$ npm i -S mod-a@1.0.0
$ npm i -S mod-c@1.0.0
$ npm shrinkwrap
$ cat npm-shrinkwrap.json
{
  "name": "hoi",
  "version": "1.0.0",
  "dependencies": {
    "mod-a": {
      "version": "1.0.0",
      "from": "mod-a@1.0.0",
      "resolved": "https://registry.npmjs.org/mod-a/-/mod-a-1.0.0.tgz"
    },
    "mod-b": {
      "version": "1.0.0",
      "from": "mod-b@>=1.0.0 <2.0.0",
      "resolved": "https://registry.npmjs.org/mod-b/-/mod-b-1.0.0.tgz"
    },
    "mod-c": {
      "version": "1.0.0",
      "from": "mod-c@1.0.0",
      "resolved": "https://registry.npmjs.org/mod-c/-/mod-c-1.0.0.tgz",
      "dependencies": {
        "mod-b": {
          "version": "2.0.0",
          "from": "mod-b@>=2.0.0 <3.0.0",
          "resolved": "https://registry.npmjs.org/mod-b/-/mod-b-2.0.0.tgz"
        }
      }
    }
  }
}

#c -> a

$ npm i -S mod-c@1.0.0
$ npm i -S mod-a@1.0.0
$ npm shrinkwrap
$ cat npm-shrinkwrap.json
{
  "name": "hoi",
  "version": "1.0.0",
  "dependencies": {
    "mod-a": {
      "version": "1.0.0",
      "from": "mod-a@1.0.0",
      "resolved": "https://registry.npmjs.org/mod-a/-/mod-a-1.0.0.tgz",
      "dependencies": {
        "mod-b": {
          "version": "1.0.0",
          "from": "mod-b@>=1.0.0 <2.0.0",
          "resolved": "https://registry.npmjs.org/mod-b/-/mod-b-1.0.0.tgz"
        }
      }
    },
    "mod-b": {
      "version": "2.0.0",
      "from": "mod-b@>=2.0.0 <3.0.0",
      "resolved": "https://registry.npmjs.org/mod-b/-/mod-b-2.0.0.tgz"
    },
    "mod-c": {
      "version": "1.0.0",
      "from": "mod-c@1.0.0",
      "resolved": "https://registry.npmjs.org/mod-c/-/mod-c-1.0.0.tgz"
    }
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment