Skip to content

Commit

Permalink
docs: package aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
claudiahdz committed Nov 15, 2019
1 parent 454c7dd commit 7ba97b0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions docs/content/cli-commands/npm-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ npm install [<@scope>/]<name>
npm install [<@scope>/]<name>@<tag>
npm install [<@scope>/]<name>@<version>
npm install [<@scope>/]<name>@<version range>
npm install <alias>@npm:<name>
npm install <git-host>:<git-user>/<repo-name>
npm install <git repo url>
npm install <tarball file>
Expand Down Expand Up @@ -113,6 +114,19 @@ after packing it up into a tarball (b).

npm install sax

* `npm install <alias>@npm:<name>`:

Install a package under a custom alias. Allows multiple versions of a same-name package side-by-side, more convenient import names for packages with otherwise long ones and using git forks replacements or forked npm packages as replacements. Aliasing works only on your project and does
not rename packages in transitive dependencies. Aliases should follow
the naming conventions stated in [`validate-npm-package-name`](https://www.npmjs.com/package/validate-npm-package-name#naming-rules).

Examples:

npm install my-react@npm:react
npm install jquery2@npm:jquery@2
npm install jquery3@npm:jquery@3
npm install npa@npm:npm-package-arg

`npm install` saves any specified packages into `dependencies` by default.
Additionally, you can control where and how they get saved with some
additional flags:
Expand Down
1 change: 1 addition & 0 deletions lib/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ install.usage = usage(
'\nnpm install [<@scope>/]<pkg>@<tag>' +
'\nnpm install [<@scope>/]<pkg>@<version>' +
'\nnpm install [<@scope>/]<pkg>@<version range>' +
'\nnpm install <alias>@npm:<name>' +
'\nnpm install <folder>' +
'\nnpm install <tarball file>' +
'\nnpm install <tarball url>' +
Expand Down

0 comments on commit 7ba97b0

Please sign in to comment.