From 7b17efb7afce12989b51e44aef154de2a4b95d67 Mon Sep 17 00:00:00 2001 From: claudiahdz Date: Fri, 15 Nov 2019 19:16:23 +0200 Subject: [PATCH] docs: package aliases --- docs/content/cli-commands/npm-install.md | 19 +++++++++++++++++++ lib/install.js | 1 + 2 files changed, 20 insertions(+) diff --git a/docs/content/cli-commands/npm-install.md b/docs/content/cli-commands/npm-install.md index cfb96aeedd939..2c4e2e4c32c57 100644 --- a/docs/content/cli-commands/npm-install.md +++ b/docs/content/cli-commands/npm-install.md @@ -16,6 +16,7 @@ npm install [<@scope>/] npm install [<@scope>/]@ npm install [<@scope>/]@ npm install [<@scope>/]@ +npm install @npm: npm install :/ npm install npm install @@ -113,6 +114,24 @@ after packing it up into a tarball (b). npm install sax +* `npm install @npm:`: + + 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: diff --git a/lib/install.js b/lib/install.js index a4cf2b186de51..528a3a0b59a75 100644 --- a/lib/install.js +++ b/lib/install.js @@ -26,6 +26,7 @@ install.usage = usage( '\nnpm install [<@scope>/]@' + '\nnpm install [<@scope>/]@' + '\nnpm install [<@scope>/]@' + + '\nnpm install @npm:' + '\nnpm install ' + '\nnpm install ' + '\nnpm install ' +