mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
deps: upgrade npm to 7.1.2
PR-URL: https://github.com/nodejs/node/pull/36487 Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Ruy Adorno <ruyadorno@github.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
1 parent
cc544dbfaa
commit
30fe0ff681
135 files changed
+3988
-931
No files matched your search
Vendored
+50
@@ -1,3 +1,53 @@
|
||||
## 7.1.2 (2020-12-11)
|
||||
|
||||
### DEPENDENCIES
|
||||
|
||||
* [`c3ba1daf7`](https://github.com/npm/cli/commit/c3ba1daf7cd335d72aeba80ae0e9f9d215ca9ea5)
|
||||
[#2033](https://github.com/npm/cli/issues/2033) `@npmcli/config@1.2.6`:
|
||||
* Set `INIT_CWD` to initial current working directory
|
||||
* Set `NODE` to initial process.execPath
|
||||
* [`8029608b9`](https://github.com/npm/cli/commit/8029608b914fe5ba35a7cd37ae95ab93b0532e2e)
|
||||
`json-parse-even-better-errors@2.3.1`
|
||||
* [`0233818e6`](https://github.com/npm/cli/commit/0233818e606888b80881b17a2c6aca9f10a619b2)
|
||||
[#2332](https://github.com/npm/cli/issues/2332) `treeverse@1.0.4`
|
||||
* [`e401d6bb3`](https://github.com/npm/cli/commit/e401d6bb37ffc767b4fefe89878dd3c3ef490b2c)
|
||||
`ini@1.3.8`
|
||||
* [`011bb1220`](https://github.com/npm/cli/commit/011bb122035dcd43769ec35982662cca41635068)
|
||||
[#2320](https://github.com/npm/cli/issues/2320) `@npmcli/arborist@2.0.1`:
|
||||
* Do not save with `^` and no version
|
||||
|
||||
### BUGFIXES
|
||||
|
||||
* [`244c2069f`](https://github.com/npm/cli/commit/244c2069fd093f053d3061c85575ac13e72e2454)
|
||||
[#2325](https://github.com/npm/cli/issues/2325) npm search
|
||||
include/exclude ([@ruyadorno](https://github.com/ruyadorno))
|
||||
* [`d825e901e`](https://github.com/npm/cli/commit/d825e901eceea4cf8d860e35238dc30008eb4da4)
|
||||
[#1905](https://github.com/npm/cli/issues/1905)
|
||||
[#2316](https://github.com/npm/cli/issues/2316) run install scripts for
|
||||
root project
|
||||
* [`315449142`](https://github.com/npm/cli/commit/31544914294948085a84097af7f0f5de2a2e8f7e)
|
||||
[#2331](https://github.com/npm/cli/issues/2331)
|
||||
[#2021](https://github.com/npm/cli/issues/2021) Set `NODE_ENV=production`
|
||||
if 'dev' is on the omit list ([@isaacs](https://github.com/isaacs))
|
||||
|
||||
### TESTING
|
||||
|
||||
* [`c243e3b9d`](https://github.com/npm/cli/commit/c243e3b9d9bda0580a0fc1b3e230b4d47412176e)
|
||||
[#2313](https://github.com/npm/cli/issues/2313) tests: completion
|
||||
([@nlf](https://github.com/nlf))
|
||||
* [`7ff6efbb8`](https://github.com/npm/cli/commit/7ff6efbb866591b2330b967215cef8146dff3ebf)
|
||||
[#2314](https://github.com/npm/cli/issues/2314) npm team
|
||||
([@ruyadorno](https://github.com/ruyadorno))
|
||||
* [`7a4f0c96c`](https://github.com/npm/cli/commit/7a4f0c96c2ab9f264f7bda2caf7e72c881571270)
|
||||
[#2323](https://github.com/npm/cli/issues/2323) npm doctor
|
||||
([@nlf](https://github.com/nlf))
|
||||
|
||||
### DOCUMENTATION
|
||||
|
||||
* [`e340cf64b`](https://github.com/npm/cli/commit/e340cf64ba31ef329a9049b60c32ffd0342cfb7d)
|
||||
[#2330](https://github.com/npm/cli/issues/2330) explain through
|
||||
run-script ([@isaacs](https://github.com/isaacs))
|
||||
|
||||
## 7.1.1 (2020-12-08)
|
||||
|
||||
### DEPENDENCIES
|
||||
|
||||
@@ -8,6 +8,8 @@ description: Explain installed packages
|
||||
|
||||
```bash
|
||||
npm explain <folder | specifier>
|
||||
|
||||
alias: why
|
||||
```
|
||||
|
||||
### Description
|
||||
|
||||
+45
-24
@@ -15,41 +15,44 @@ alias: npm ln
|
||||
|
||||
### Description
|
||||
|
||||
This is handy for installing your own stuff, so that you can work on it and
|
||||
test iteratively without having to continually rebuild.
|
||||
|
||||
Package linking is a two-step process.
|
||||
|
||||
First, `npm link` in a package folder will create a symlink in the global folder
|
||||
`{prefix}/lib/node_modules/<package>` that links to the package where the `npm
|
||||
link` command was executed. It will also link any bins in the package to `{prefix}/bin/{name}`.
|
||||
Note that `npm link` uses the global prefix (see `npm prefix -g` for its value).
|
||||
First, `npm link` in a package folder will create a symlink in the global
|
||||
folder `{prefix}/lib/node_modules/<package>` that links to the package
|
||||
where the `npm link` command was executed. It will also link any bins in
|
||||
the package to `{prefix}/bin/{name}`. Note that `npm link` uses the global
|
||||
prefix (see `npm prefix -g` for its value).
|
||||
|
||||
Next, in some other location, `npm link package-name` will create a
|
||||
symbolic link from globally-installed `package-name` to `node_modules/`
|
||||
of the current folder.
|
||||
symbolic link from globally-installed `package-name` to `node_modules/` of
|
||||
the current folder.
|
||||
|
||||
Note that `package-name` is taken from `package.json`,
|
||||
not from directory name.
|
||||
Note that `package-name` is taken from `package.json`, _not_ from the
|
||||
directory name.
|
||||
|
||||
The package name can be optionally prefixed with a scope. See [`scope`](/using-npm/scope).
|
||||
The scope must be preceded by an @-symbol and followed by a slash.
|
||||
The package name can be optionally prefixed with a scope. See
|
||||
[`scope`](/using-npm/scope). The scope must be preceded by an @-symbol and
|
||||
followed by a slash.
|
||||
|
||||
When creating tarballs for `npm publish`, the linked packages are
|
||||
"snapshotted" to their current state by resolving the symbolic links.
|
||||
|
||||
This is handy for installing your own stuff, so that you can work on it and
|
||||
test it iteratively without having to continually rebuild.
|
||||
"snapshotted" to their current state by resolving the symbolic links, if
|
||||
they are included in `bundleDependencies`.
|
||||
|
||||
For example:
|
||||
|
||||
```bash
|
||||
cd ~/projects/node-redis # go into the package directory
|
||||
npm link # creates global link
|
||||
cd ~/projects/node-bloggy # go into some other package directory.
|
||||
npm link redis # link-install the package
|
||||
cd ~/projects/node-redis # go into the package directory
|
||||
npm link # creates global link
|
||||
cd ~/projects/node-bloggy # go into some other package directory.
|
||||
npm link redis # link-install the package
|
||||
```
|
||||
|
||||
Now, any changes to ~/projects/node-redis will be reflected in
|
||||
~/projects/node-bloggy/node_modules/node-redis/. Note that the link should
|
||||
be to the package name, not the directory name for that package.
|
||||
Now, any changes to `~/projects/node-redis` will be reflected in
|
||||
`~/projects/node-bloggy/node_modules/node-redis/`. Note that the link
|
||||
should be to the package name, not the directory name for that package.
|
||||
|
||||
You may also shortcut the two steps in one. For example, to do the
|
||||
above use-case in a shorter way:
|
||||
@@ -69,15 +72,33 @@ npm link redis
|
||||
That is, it first creates a global link, and then links the global
|
||||
installation target into your project's `node_modules` folder.
|
||||
|
||||
Note that in this case, you are referring to the directory name, `node-redis`,
|
||||
rather than the package name `redis`.
|
||||
Note that in this case, you are referring to the directory name,
|
||||
`node-redis`, rather than the package name `redis`.
|
||||
|
||||
If your linked package is scoped (see [`scope`](/using-npm/scope)) your link command must include that scope, e.g.
|
||||
If your linked package is scoped (see [`scope`](/using-npm/scope)) your
|
||||
link command must include that scope, e.g.
|
||||
|
||||
```bash
|
||||
npm link @myorg/privatepackage
|
||||
```
|
||||
|
||||
### Caveat
|
||||
|
||||
Note that package dependencies linked in this way are _not_ saved to
|
||||
`package.json` by default, on the assumption that the intention is to have
|
||||
a link stand in for a regular non-link dependency. Otherwise, for example,
|
||||
if you depend on `redis@^3.0.1`, and ran `npm link redis`, it would replace
|
||||
the `^3.0.1` dependency with `file:../path/to/node-redis`, which you
|
||||
probably don't want! Additionally, other users or developers on your
|
||||
project would run into issues if they do not have their folders set up
|
||||
exactly the same as yours.
|
||||
|
||||
If you are adding a _new_ dependency as a link, you should add it to the
|
||||
relevant metadata by running `npm install <dep> --package-lock-only`.
|
||||
|
||||
If you _want_ to save the `file:` reference in your `package.json` and
|
||||
`package-lock.json` files, you can use `npm link <dep> --save` to do so.
|
||||
|
||||
### See Also
|
||||
|
||||
* [npm developers](/using-npm/developers)
|
||||
|
||||
+6
-6
@@ -12,13 +12,13 @@ npm logout [--registry=<url>] [--scope=<@scope>]
|
||||
|
||||
### Description
|
||||
|
||||
When logged into a registry that supports token-based authentication, tell the
|
||||
server to end this token's session. This will invalidate the token everywhere
|
||||
you're using it, not just for the current environment.
|
||||
When logged into a registry that supports token-based authentication, tell
|
||||
the server to end this token's session. This will invalidate the token
|
||||
everywhere you're using it, not just for the current environment.
|
||||
|
||||
When logged into a legacy registry that uses username and password authentication, this will
|
||||
clear the credentials in your user configuration. In this case, it will _only_ affect
|
||||
the current environment.
|
||||
When logged into a legacy registry that uses username and password
|
||||
authentication, this will clear the credentials in your user configuration.
|
||||
In this case, it will _only_ affect the current environment.
|
||||
|
||||
If `--scope` is provided, this will find the credentials for the registry
|
||||
connected to that scope, if set.
|
||||
|
||||
+51
-9
@@ -15,17 +15,21 @@ aliases: list, la, ll
|
||||
### Description
|
||||
|
||||
This command will print to stdout all the versions of packages that are
|
||||
installed, as well as their dependencies, in a tree-structure.
|
||||
installed, as well as their dependencies when `--all` is specified, in a
|
||||
tree structure.
|
||||
|
||||
Positional arguments are `name@version-range` identifiers, which will
|
||||
limit the results to only the paths to the packages named. Note that
|
||||
nested packages will *also* show the paths to the specified packages.
|
||||
For example, running `npm ls promzard` in npm's source tree will show:
|
||||
Note: to get a "bottoms up" view of why a given package is included in the
|
||||
tree at all, use [`npm explain`](/commands/npm-explain).
|
||||
|
||||
Positional arguments are `name@version-range` identifiers, which will limit
|
||||
the results to only the paths to the packages named. Note that nested
|
||||
packages will *also* show the paths to the specified packages. For
|
||||
example, running `npm ls promzard` in npm's source tree will show:
|
||||
|
||||
```bash
|
||||
npm@@VERSION@ /path/to/npm
|
||||
└─┬ init-package-json@0.0.4
|
||||
└── promzard@0.1.5
|
||||
npm@@VERSION@ /path/to/npm
|
||||
└─┬ init-package-json@0.0.4
|
||||
└── promzard@0.1.5
|
||||
```
|
||||
|
||||
It will print out extraneous, missing, and invalid packages.
|
||||
@@ -35,12 +39,49 @@ in parentheses after the name@version to make it easier for users to
|
||||
recognize potential forks of a project.
|
||||
|
||||
The tree shown is the logical dependency tree, based on package
|
||||
dependencies, not the physical layout of your node_modules folder.
|
||||
dependencies, not the physical layout of your `node_modules` folder.
|
||||
|
||||
When run as `ll` or `la`, it shows extended information by default.
|
||||
|
||||
### Note: Design Changes Pending
|
||||
|
||||
The `npm ls` command's output and behavior made a _ton_ of sense when npm
|
||||
created a `node_modules` folder that naively nested every dependency. In
|
||||
such a case, the logical dependency graph and physical tree of packages on
|
||||
disk would be roughly identical.
|
||||
|
||||
With the advent of automatic install-time deduplication of dependencies in
|
||||
npm v3, the `ls` output was modified to display the logical dependency
|
||||
graph as a tree structure, since this was more useful to most users.
|
||||
However, without using `npm ls -l`, it became impossible show _where_ a
|
||||
package was actually installed much of the time!
|
||||
|
||||
With the advent of automatic installation of `peerDependencies` in npm v7,
|
||||
this gets even more curious, as `peerDependencies` are logically
|
||||
"underneath" their dependents in the dependency graph, but are always
|
||||
physically at or above their location on disk.
|
||||
|
||||
Also, in the years since npm got an `ls` command (in version 0.0.2!),
|
||||
dependency graphs have gotten much larger as a general rule. Therefor, in
|
||||
order to avoid dumping an excessive amount of content to the terminal, `npm
|
||||
ls` now only shows the _top_ level dependencies, unless `--all` is
|
||||
provided.
|
||||
|
||||
A thorough re-examination of the use cases, intention, behavior, and output
|
||||
of this command, is currently underway. Expect significant changes to at
|
||||
least the default human-readable `npm ls` output in npm v8.
|
||||
|
||||
### Configuration
|
||||
|
||||
#### all
|
||||
|
||||
* Default: `false`
|
||||
* Type: Boolean
|
||||
|
||||
When running `npm outdated` and `npm ls`, setting `--all` will show all
|
||||
outdated or installed packages, rather than only those directly depended
|
||||
upon by the current project.
|
||||
|
||||
#### json
|
||||
|
||||
* Default: false
|
||||
@@ -115,6 +156,7 @@ Set it to false in order to use all-ansi output.
|
||||
|
||||
### See Also
|
||||
|
||||
* [npm explain](/commands/npm-explain)
|
||||
* [npm config](/commands/npm-config)
|
||||
* [npmrc](/configuring-npm/npmrc)
|
||||
* [npm folders](/configuring-npm/folders)
|
||||
|
||||
+4
-3
@@ -52,10 +52,11 @@ $ npm org ls my-org @mx-santos
|
||||
|
||||
### Description
|
||||
|
||||
You can use the `npm org` commands to manage and view users of an organization.
|
||||
It supports adding and removing users, changing their roles, listing them, and
|
||||
finding specific ones and their roles.
|
||||
You can use the `npm org` commands to manage and view users of an
|
||||
organization. It supports adding and removing users, changing their roles,
|
||||
listing them, and finding specific ones and their roles.
|
||||
|
||||
### See Also
|
||||
|
||||
* [using orgs](/using-npm/orgs)
|
||||
* [Documentation on npm Orgs](https://docs.npmjs.com/orgs/)
|
||||
+36
-26
@@ -15,25 +15,34 @@ npm outdated [[<@scope>/]<pkg> ...]
|
||||
This command will check the registry to see if any (or, specific) installed
|
||||
packages are currently outdated.
|
||||
|
||||
By default, only the direct dependencies of the root project are shown.
|
||||
Use `--all` to find all outdated meta-dependencies as well.
|
||||
|
||||
In the output:
|
||||
|
||||
* `wanted` is the maximum version of the package that satisfies the semver
|
||||
range specified in `package.json`. If there's no available semver range (i.e.
|
||||
you're running `npm outdated --global`, or the package isn't included in
|
||||
`package.json`), then `wanted` shows the currently-installed version.
|
||||
range specified in `package.json`. If there's no available semver range
|
||||
(i.e. you're running `npm outdated --global`, or the package isn't
|
||||
included in `package.json`), then `wanted` shows the currently-installed
|
||||
version.
|
||||
* `latest` is the version of the package tagged as latest in the registry.
|
||||
Running `npm publish` with no special configuration will publish the package
|
||||
with a dist-tag of `latest`. This may or may not be the maximum version of
|
||||
the package, or the most-recently published version of the package, depending
|
||||
on how the package's developer manages the latest [dist-tag](npm-dist-tag).
|
||||
Running `npm publish` with no special configuration will publish the
|
||||
package with a dist-tag of `latest`. This may or may not be the maximum
|
||||
version of the package, or the most-recently published version of the
|
||||
package, depending on how the package's developer manages the latest
|
||||
[dist-tag](/commands/npm-dist-tag).
|
||||
* `location` is where in the physical tree the package is located.
|
||||
* `depended by` shows which package depends on the displayed dependency
|
||||
* `package type` (when using `--long` / `-l`) tells you whether this package is
|
||||
a `dependency` or a dev/peer/optional dependency. Packages not included in `package.json`
|
||||
are always marked `dependencies`.
|
||||
* `homepage` (when using `--long` / `-l`) is the `homepage` value contained in the package's packument
|
||||
* Red means there's a newer version matching your semver requirements, so you should update now.
|
||||
* Yellow indicates that there's a newer version above your semver requirements (usually new major, or new 0.x minor) so proceed with caution.
|
||||
* `package type` (when using `--long` / `-l`) tells you whether this
|
||||
package is a `dependency` or a dev/peer/optional dependency. Packages not
|
||||
included in `package.json` are always marked `dependencies`.
|
||||
* `homepage` (when using `--long` / `-l`) is the `homepage` value contained
|
||||
in the package's packument
|
||||
* Red means there's a newer version matching your semver requirements, so
|
||||
you should update now.
|
||||
* Yellow indicates that there's a newer version _above_ your semver
|
||||
requirements (usually new major, or new 0.x minor) so proceed with
|
||||
caution.
|
||||
|
||||
### An example
|
||||
|
||||
@@ -59,19 +68,20 @@ With these `dependencies`:
|
||||
|
||||
A few things to note:
|
||||
|
||||
* `glob` requires `^5`, which prevents npm from installing `glob@6`, which is
|
||||
outside the semver range.
|
||||
* Git dependencies will always be reinstalled, because of how they're specified.
|
||||
The installed committish might satisfy the dependency specifier (if it's
|
||||
something immutable, like a commit SHA), or it might not, so `npm outdated` and
|
||||
`npm update` have to fetch Git repos to check. This is why currently doing a
|
||||
reinstall of a Git dependency always forces a new clone and install.
|
||||
* `npm@3.5.2` is marked as "wanted", but "latest" is `npm@3.5.1` because npm
|
||||
uses dist-tags to manage its `latest` and `next` release channels. `npm update`
|
||||
will install the _newest_ version, but `npm install npm` (with no semver range)
|
||||
will install whatever's tagged as `latest`.
|
||||
* `once` is just plain out of date. Reinstalling `node_modules` from scratch or
|
||||
running `npm update` will bring it up to spec.
|
||||
* `glob` requires `^5`, which prevents npm from installing `glob@6`, which
|
||||
is outside the semver range.
|
||||
* Git dependencies will always be reinstalled, because of how they're
|
||||
specified. The installed committish might satisfy the dependency
|
||||
specifier (if it's something immutable, like a commit SHA), or it might
|
||||
not, so `npm outdated` and `npm update` have to fetch Git repos to check.
|
||||
This is why currently doing a reinstall of a Git dependency always forces
|
||||
a new clone and install.
|
||||
* `npm@3.5.2` is marked as "wanted", but "latest" is `npm@3.5.1` because
|
||||
npm uses dist-tags to manage its `latest` and `next` release channels.
|
||||
`npm update` will install the _newest_ version, but `npm install npm`
|
||||
(with no semver range) will install whatever's tagged as `latest`.
|
||||
* `once` is just plain out of date. Reinstalling `node_modules` from
|
||||
scratch or running `npm update` will bring it up to spec.
|
||||
|
||||
### Configuration
|
||||
|
||||
|
||||
+10
-12
@@ -18,26 +18,24 @@ aliases: author
|
||||
|
||||
Manage ownership of published packages.
|
||||
|
||||
* ls:
|
||||
List all the users who have access to modify a package and push new versions.
|
||||
Handy when you need to know who to bug for help.
|
||||
* add:
|
||||
Add a new user as a maintainer of a package. This user is enabled to modify
|
||||
metadata, publish new versions, and add other owners.
|
||||
* rm:
|
||||
Remove a user from the package owner list. This immediately revokes their
|
||||
privileges.
|
||||
* ls: List all the users who have access to modify a package and push new
|
||||
versions. Handy when you need to know who to bug for help.
|
||||
* add: Add a new user as a maintainer of a package. This user is enabled
|
||||
to modify metadata, publish new versions, and add other owners.
|
||||
* rm: Remove a user from the package owner list. This immediately revokes
|
||||
their privileges.
|
||||
|
||||
Note that there is only one level of access. Either you can modify a package,
|
||||
or you can't. Future versions may contain more fine-grained access levels, but
|
||||
that is not implemented at this time.
|
||||
|
||||
If you have two-factor authentication enabled with `auth-and-writes` then
|
||||
you'll need to include an otp on the command line when changing ownership
|
||||
with `--otp`.
|
||||
If you have two-factor authentication enabled with `auth-and-writes` (see
|
||||
[`npm-profile`](/commands/npm-profile)) then you'll need to include an otp
|
||||
on the command line when changing ownership with `--otp`.
|
||||
|
||||
### See Also
|
||||
|
||||
* [npm profile](/commands/npm-profile)
|
||||
* [npm publish](/commands/npm-publish)
|
||||
* [npm registry](/using-npm/registry)
|
||||
* [npm adduser](/commands/npm-adduser)
|
||||
|
||||
+7
-5
@@ -13,10 +13,10 @@ npm pack [[<@scope>/]<pkg>...] [--dry-run]
|
||||
### Description
|
||||
|
||||
For anything that's installable (that is, a package folder, tarball,
|
||||
tarball url, name@tag, name@version, name, or scoped name), this
|
||||
command will fetch it to the cache, and then copy the tarball to the
|
||||
current working directory as `<name>-<version>.tgz`, and then write
|
||||
the filenames out to stdout.
|
||||
tarball url, git url, name@tag, name@version, name, or scoped name), this
|
||||
command will fetch it to the cache, copy the tarball to the current working
|
||||
directory as `<name>-<version>.tgz`, and then write the filenames out to
|
||||
stdout.
|
||||
|
||||
If the same package is specified multiple times, then the file will be
|
||||
overwritten the second time.
|
||||
@@ -24,10 +24,12 @@ overwritten the second time.
|
||||
If no arguments are supplied, then npm packs the current package folder.
|
||||
|
||||
The `--dry-run` argument will do everything that pack usually does without
|
||||
actually packing anything. Reports on what would have gone into the tarball.
|
||||
actually packing anything. That is, it reports on what would have gone
|
||||
into the tarball, but nothing else.
|
||||
|
||||
### See Also
|
||||
|
||||
* [npm-packlist package](http://npm.im/npm-packlist)
|
||||
* [npm cache](/commands/npm-cache)
|
||||
* [npm publish](/commands/npm-publish)
|
||||
* [npm config](/commands/npm-config)
|
||||
|
||||
+1
@@ -25,5 +25,6 @@ Ping error: {*Detail about error}
|
||||
|
||||
### See Also
|
||||
|
||||
* [npm doctor](/commands/npm-doctor)
|
||||
* [npm config](/commands/npm-config)
|
||||
* [npmrc](/configuring-npm/npmrc)
|
||||
+21
-20
@@ -16,12 +16,12 @@ npm profile disable-2fa
|
||||
|
||||
### Description
|
||||
|
||||
Change your profile information on the registry. This not be available if
|
||||
you're using a non-npmjs registry.
|
||||
Change your profile information on the registry. Note that this command
|
||||
depends on the registry implementation, so third-party registries may not
|
||||
support this interface.
|
||||
|
||||
* `npm profile get [<property>]`:
|
||||
Display all of the properties of your profile, or one or more specific
|
||||
properties. It looks like:
|
||||
* `npm profile get [<property>]`: Display all of the properties of your
|
||||
profile, or one or more specific properties. It looks like:
|
||||
|
||||
```bash
|
||||
+-----------------+---------------------------+
|
||||
@@ -46,27 +46,26 @@ you're using a non-npmjs registry.
|
||||
| updated | 2017-10-02T21:29:45.922Z |
|
||||
+-----------------+---------------------------+
|
||||
```
|
||||
|
||||
* `npm profile set <property> <value>`:
|
||||
Set the value of a profile property. You can set the following properties this way:
|
||||
email, fullname, homepage, freenode, twitter, github
|
||||
|
||||
* `npm profile set password`:
|
||||
Change your password. This is interactive, you'll be prompted for your
|
||||
current password and a new password. You'll also be prompted for an OTP
|
||||
if you have two-factor authentication enabled.
|
||||
* `npm profile set <property> <value>`: Set the value of a profile
|
||||
property. You can set the following properties this way: email, fullname,
|
||||
homepage, freenode, twitter, github
|
||||
|
||||
* `npm profile enable-2fa [auth-and-writes|auth-only]`:
|
||||
Enables two-factor authentication. Defaults to `auth-and-writes` mode. Modes are:
|
||||
* `npm profile set password`: Change your password. This is interactive,
|
||||
you'll be prompted for your current password and a new password. You'll
|
||||
also be prompted for an OTP if you have two-factor authentication
|
||||
enabled.
|
||||
|
||||
* `npm profile enable-2fa [auth-and-writes|auth-only]`: Enables two-factor
|
||||
authentication. Defaults to `auth-and-writes` mode. Modes are:
|
||||
* `auth-only`: Require an OTP when logging in or making changes to your
|
||||
account's authentication. The OTP will be required on both the website
|
||||
and the command line.
|
||||
* `auth-and-writes`: Requires an OTP at all the times `auth-only` does, and also requires one when
|
||||
publishing a module, setting the `latest` dist-tag, or changing access
|
||||
via `npm access` and `npm owner`.
|
||||
* `auth-and-writes`: Requires an OTP at all the times `auth-only` does,
|
||||
and also requires one when publishing a module, setting the `latest`
|
||||
dist-tag, or changing access via `npm access` and `npm owner`.
|
||||
|
||||
* `npm profile disable-2fa`:
|
||||
Disables two-factor authentication.
|
||||
* `npm profile disable-2fa`: Disables two-factor authentication.
|
||||
|
||||
### Details
|
||||
|
||||
@@ -76,4 +75,6 @@ available on non npmjs.com registries.
|
||||
|
||||
### See Also
|
||||
|
||||
* [npm adduser](/commands/npm-adduser)
|
||||
* [npm logout](/commands/npm-logout)
|
||||
* [npm config](/commands/npm-config)
|
||||
+11
-14
@@ -12,29 +12,26 @@ npm prune [[<@scope>/]<pkg>...] [--production] [--dry-run] [--json]
|
||||
|
||||
### Description
|
||||
|
||||
This command removes "extraneous" packages. If a package name is
|
||||
provided, then only packages matching one of the supplied names are
|
||||
removed.
|
||||
This command removes "extraneous" packages. If a package name is provided,
|
||||
then only packages matching one of the supplied names are removed.
|
||||
|
||||
Extraneous packages are packages that are not listed on the parent
|
||||
package's dependencies list.
|
||||
Extraneous packages are those present in the `node_modules` folder that are
|
||||
not listed as any package's dependency list.
|
||||
|
||||
If the `--production` flag is specified or the `NODE_ENV` environment
|
||||
variable is set to `production`, this command will remove the packages
|
||||
specified in your `devDependencies`. Setting `--no-production` will
|
||||
negate `NODE_ENV` being set to `production`.
|
||||
specified in your `devDependencies`. Setting `--no-production` will negate
|
||||
`NODE_ENV` being set to `production`.
|
||||
|
||||
If the `--dry-run` flag is used then no changes will actually be made.
|
||||
|
||||
If the `--json` flag is used then the changes `npm prune` made (or would
|
||||
If the `--json` flag is used, then the changes `npm prune` made (or would
|
||||
have made with `--dry-run`) are printed as a JSON object.
|
||||
|
||||
In normal operation with package-locks enabled, extraneous modules are
|
||||
pruned automatically when modules are installed and you'll only need
|
||||
this command with the `--production` flag.
|
||||
|
||||
If you've disabled package-locks then extraneous modules will not be removed
|
||||
and it's up to you to run `npm prune` from time-to-time to remove them.
|
||||
In normal operation, extraneous modules are pruned automatically, so you'll
|
||||
only need this command with the `--production` flag. However, in the real
|
||||
world, operation is not always "normal". When crashes or mistakes happen,
|
||||
this command can help clean up any resulting garbage.
|
||||
|
||||
### See Also
|
||||
|
||||
|
||||
+66
-34
@@ -15,59 +15,91 @@ Sets tag 'latest' if no --tag specified
|
||||
|
||||
### Description
|
||||
|
||||
Publishes a package to the registry so that it can be installed by name. All
|
||||
files in the package directory are included if no local `.gitignore` or
|
||||
`.npmignore` file exists. If both files exist and a file is ignored by
|
||||
`.gitignore` but not by `.npmignore` then it will be included. See
|
||||
[`developers`](/using-npm/developers) for full details on what's included in the published package, as well as details on how the package is built.
|
||||
Publishes a package to the registry so that it can be installed by name.
|
||||
|
||||
By default npm will publish to the public registry. This can be overridden by
|
||||
specifying a different default registry or using a [`scope`](/using-npm/scope) in the name (see [`package.json`](/configuring-npm/package-json)).
|
||||
By default npm will publish to the public registry. This can be overridden
|
||||
by specifying a different default registry or using a
|
||||
[`scope`](/using-npm/scope) in the name (see
|
||||
[`package.json`](/configuring-npm/package-json)).
|
||||
|
||||
* `<folder>`:
|
||||
A folder containing a package.json file
|
||||
* `<folder>`: A folder containing a package.json file
|
||||
|
||||
* `<tarball>`:
|
||||
A url or file path to a gzipped tar archive containing a single folder
|
||||
with a package.json file inside.
|
||||
* `<tarball>`: A url or file path to a gzipped tar archive containing a
|
||||
single folder with a package.json file inside.
|
||||
|
||||
* `[--tag <tag>]`
|
||||
Registers the published package with the given tag, such that
|
||||
`npm install <name>@<tag>` will install this version. By default,
|
||||
* `[--tag <tag>]`: Registers the published package with the given tag, such
|
||||
that `npm install <name>@<tag>` will install this version. By default,
|
||||
`npm publish` updates and `npm install` installs the `latest` tag. See
|
||||
[`npm-dist-tag`](npm-dist-tag) for details about tags.
|
||||
|
||||
* `[--access <public|restricted>]`
|
||||
Tells the registry whether this package should be published as public or
|
||||
restricted. Only applies to scoped packages, which default to `restricted`.
|
||||
If you don't have a paid account, you must publish with `--access public`
|
||||
to publish scoped packages.
|
||||
* `[--access <public|restricted>]`: Tells the registry whether this package
|
||||
should be published as public or restricted. Only applies to scoped
|
||||
packages, which default to `restricted`. If you don't have a paid
|
||||
account, you must publish with `--access public` to publish scoped
|
||||
packages.
|
||||
|
||||
* `[--otp <otpcode>]`
|
||||
If you have two-factor authentication enabled in `auth-and-writes` mode
|
||||
then you can provide a code from your authenticator with this. If you
|
||||
don't include this and you're running from a TTY then you'll be prompted.
|
||||
* `[--otp <otpcode>]`: If you have two-factor authentication enabled in
|
||||
`auth-and-writes` mode then you can provide a code from your
|
||||
authenticator with this. If you don't include this and you're running
|
||||
from a TTY then you'll be prompted.
|
||||
|
||||
* `[--dry-run]`
|
||||
As of `npm@6`, does everything publish would do except actually publishing
|
||||
to the registry. Reports the details of what would have been published.
|
||||
* `[--dry-run]`: As of `npm@6`, does everything publish would do except
|
||||
actually publishing to the registry. Reports the details of what would
|
||||
have been published.
|
||||
|
||||
Fails if the package name and version combination already exists in
|
||||
the specified registry.
|
||||
The publish will fail if the package name and version combination already
|
||||
exists in the specified registry.
|
||||
|
||||
Once a package is published with a given name and version, that
|
||||
specific name and version combination can never be used again, even if
|
||||
it is removed with [`npm unpublish`](/commands/npm-unpublish).
|
||||
Once a package is published with a given name and version, that specific
|
||||
name and version combination can never be used again, even if it is removed
|
||||
with [`npm unpublish`](/commands/npm-unpublish).
|
||||
|
||||
As of `npm@5`, both a sha1sum and an integrity field with a sha512sum of the
|
||||
tarball will be submitted to the registry during publication. Subsequent
|
||||
installs will use the strongest supported algorithm to verify downloads.
|
||||
|
||||
Similar to `--dry-run` see [`npm pack`](/commands/npm-pack), which figures out the files to be
|
||||
included and packs them into a tarball to be uploaded to the registry.
|
||||
Similar to `--dry-run` see [`npm pack`](/commands/npm-pack), which figures
|
||||
out the files to be included and packs them into a tarball to be uploaded
|
||||
to the registry.
|
||||
|
||||
### Files included in package
|
||||
|
||||
To see what will be included in your package, run `npx npm-packlist`. All
|
||||
files are included by default, with the following exceptions:
|
||||
|
||||
- Certain files that are relevant to package installation and distribution
|
||||
are always included. For example, `package.json`, `README.md`,
|
||||
`LICENSE`, and so on.
|
||||
|
||||
- If there is a "files" list in
|
||||
[`package.json`](/configuring-npm/package-json), then only the files
|
||||
specified will be included. (If directories are specified, then they
|
||||
will be walked recursively and their contents included, subject to the
|
||||
same ignore rules.)
|
||||
|
||||
- If there is a `.gitignore` or `.npmignore` file, then ignored files in
|
||||
that and all child directories will be excluded from the package. If
|
||||
_both_ files exist, then the `.gitignore` is ignored, and only the
|
||||
`.npmignore` is used.
|
||||
|
||||
`.npmignore` files follow the [same pattern
|
||||
rules](https://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository#_ignoring)
|
||||
as `.gitignore` files
|
||||
|
||||
- If the file matches certain patterns, then it will _never_ be included,
|
||||
unless explicitly added to the `"files"` list in `package.json`, or
|
||||
un-ignored with a `!` rule in a `.npmignore` or `.gitignore` file.
|
||||
|
||||
- Symbolic links are never included in npm packages.
|
||||
|
||||
|
||||
See [`developers`](/using-npm/developers) for full details on what's
|
||||
included in the published package, as well as details on how the package is
|
||||
built.
|
||||
|
||||
### See Also
|
||||
|
||||
* [npm-packlist package](http://npm.im/npm-packlist)
|
||||
* [npm registry](/using-npm/registry)
|
||||
* [npm scope](/using-npm/scope)
|
||||
* [npm adduser](/commands/npm-adduser)
|
||||
|
||||
+11
-4
@@ -7,16 +7,23 @@ description: Rebuild a package
|
||||
### Synopsis
|
||||
|
||||
```bash
|
||||
npm rebuild [[<@scope>/<name>]...]
|
||||
npm rebuild [[<@scope>/]<name>[@<version>] ...]
|
||||
|
||||
alias: npm rb
|
||||
alias: rb
|
||||
```
|
||||
|
||||
### Description
|
||||
|
||||
This command runs the `npm build` command on the matched folders. This is useful when you install a new version of node, and must recompile all your C++ addons with the new binary.
|
||||
This command runs the `npm build` command on the matched folders. This is
|
||||
useful when you install a new version of node, and must recompile all your
|
||||
C++ addons with the new binary. It is also useful when installing with
|
||||
`--ignore-scripts` and `--no-bin-links`, to explicitly choose which
|
||||
packages to build and/or link bins.
|
||||
|
||||
If one or more package names (and optionally version ranges) are provided,
|
||||
then only packages with a name and version matching one of the specifiers
|
||||
will be rebuilt.
|
||||
|
||||
### See Also
|
||||
|
||||
* [npm build](/commands/npm-build)
|
||||
* [npm install](/commands/npm-install)
|
||||
+3
-3
@@ -13,9 +13,9 @@ npm repo [<pkgname> [<pkgname> ...]]
|
||||
### Description
|
||||
|
||||
This command tries to guess at the likely location of a package's
|
||||
repository URL, and then tries to open it using the `--browser`
|
||||
config param. If no package name is provided, it will search for
|
||||
a `package.json` in the current folder and use the `name` property.
|
||||
repository URL, and then tries to open it using the `--browser` config
|
||||
param. If no package name is provided, it will search for a `package.json`
|
||||
in the current folder and use the `repository` property.
|
||||
|
||||
### Configuration
|
||||
|
||||
|
||||
+11
-12
@@ -12,29 +12,28 @@ npm restart [-- <args>]
|
||||
|
||||
### Description
|
||||
|
||||
This restarts a package.
|
||||
This restarts a project. It is equivalent to running `npm run-script
|
||||
restart`.
|
||||
|
||||
This runs a package's "stop", "restart", and "start" scripts, and associated
|
||||
pre- and post- scripts, in the order given below:
|
||||
If the current project has a `"restart"` script specified in
|
||||
`package.json`, then the following scripts will be run:
|
||||
|
||||
1. prerestart
|
||||
2. restart
|
||||
3. postrestart
|
||||
|
||||
If it does _not_ have a `"restart"` script specified, but it does have
|
||||
`stop` and/or `start` scripts, then the following scripts will be run:
|
||||
|
||||
1. prerestart
|
||||
2. prestop
|
||||
3. stop
|
||||
4. poststop
|
||||
5. restart
|
||||
6. prestart
|
||||
7. start
|
||||
8. poststart
|
||||
9. postrestart
|
||||
|
||||
### Note
|
||||
|
||||
Note that the "restart" script is run **in addition to** the "stop"
|
||||
and "start" scripts, not instead of them.
|
||||
|
||||
This is the behavior as of `npm` major version 2. A change in this
|
||||
behavior will be accompanied by an increase in major version number
|
||||
|
||||
### See Also
|
||||
|
||||
* [npm run-script](/commands/npm-run-script)
|
||||
|
||||
+10
@@ -5,6 +5,7 @@ description: Display npm root
|
||||
---
|
||||
|
||||
### Synopsis
|
||||
|
||||
```bash
|
||||
npm root [-g]
|
||||
```
|
||||
@@ -13,6 +14,15 @@ npm root [-g]
|
||||
|
||||
Print the effective `node_modules` folder to standard out.
|
||||
|
||||
Useful for using npm in shell scripts that do things with the
|
||||
`node_modules` folder. For example:
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
global_node_modules="$(npm root --global)"
|
||||
echo "Global packages installed in: ${global_node_modules}"
|
||||
```
|
||||
|
||||
### See Also
|
||||
|
||||
* [npm prefix](/commands/npm-prefix)
|
||||
|
||||
+21
-22
@@ -7,23 +7,25 @@ description: Run arbitrary package scripts
|
||||
### Synopsis
|
||||
|
||||
```bash
|
||||
npm run-script <command> [--silent] [-- <args>...]
|
||||
npm run-script <command> [--if-present] [--silent] [-- <args>]
|
||||
|
||||
alias: npm run
|
||||
aliases: run, rum, urn
|
||||
```
|
||||
|
||||
### Description
|
||||
|
||||
This runs an arbitrary command from a package's `"scripts"` object. If no
|
||||
`"command"` is provided, it will list the available scripts. `run[-script]` is
|
||||
used by the test, start, restart, and stop commands, but can be called
|
||||
directly, as well. When the scripts in the package are printed out, they're
|
||||
separated into lifecycle (test, start, restart) and directly-run scripts.
|
||||
`"command"` is provided, it will list the available scripts.
|
||||
|
||||
As of [`npm@2.0.0`](https://blog.npmjs.org/post/98131109725/npm-2-0-0), you can
|
||||
use custom arguments when executing scripts. The special option `--` is used by
|
||||
[getopt](https://goo.gl/KxMmtG) to delimit the end of the options. npm will pass
|
||||
all the arguments after the `--` directly to your script:
|
||||
`run[-script]` is used by the test, start, restart, and stop commands, but
|
||||
can be called directly, as well. When the scripts in the package are
|
||||
printed out, they're separated into lifecycle (test, start, restart) and
|
||||
directly-run scripts.
|
||||
|
||||
Any positional arguments are passed to the specified script. Use `--` to
|
||||
pass `-`-prefixed flags and options which would otherwise be parsed by npm.
|
||||
|
||||
For example:
|
||||
|
||||
```bash
|
||||
npm run test -- --grep="pattern"
|
||||
@@ -38,31 +40,28 @@ environment variables that will be available to the script at runtime. If an
|
||||
built-in.
|
||||
|
||||
In addition to the shell's pre-existing `PATH`, `npm run` adds
|
||||
`node_modules/.bin` to the `PATH` provided to scripts. Any binaries provided by
|
||||
locally-installed dependencies can be used without the `node_modules/.bin`
|
||||
prefix. For example, if there is a `devDependency` on `tap` in your package,
|
||||
you should write:
|
||||
`node_modules/.bin` to the `PATH` provided to scripts. Any binaries
|
||||
provided by locally-installed dependencies can be used without the
|
||||
`node_modules/.bin` prefix. For example, if there is a `devDependency` on
|
||||
`tap` in your package, you should write:
|
||||
|
||||
```bash
|
||||
"scripts": {"test": "tap test/\*.js"}
|
||||
"scripts": {"test": "tap test/*.js"}
|
||||
```
|
||||
|
||||
instead of
|
||||
|
||||
```bash
|
||||
"scripts": {"test": "node_modules/.bin/tap test/\*.js"}
|
||||
"scripts": {"test": "node_modules/.bin/tap test/*.js"}
|
||||
```
|
||||
|
||||
to run your tests.
|
||||
|
||||
The actual shell your script is run within is platform dependent. By default,
|
||||
on Unix-like systems it is the `/bin/sh` command, on Windows it is the `cmd.exe`.
|
||||
The actual shell referred to by `/bin/sh` also depends on the system.
|
||||
As of [`npm@5.1.0`](https://github.com/npm/npm/releases/tag/v5.1.0) you can
|
||||
customize the shell with the `script-shell` configuration.
|
||||
You can customize the shell with the `script-shell` configuration.
|
||||
|
||||
Scripts are run from the root of the module, regardless of what your current
|
||||
working directory is when you call `npm run`. If you want your script to
|
||||
Scripts are run from the root of the module, regardless of what the current
|
||||
working directory is when `npm run` is called. If you want your script to
|
||||
use different behavior based on what subdirectory you're in, you can use the
|
||||
`INIT_CWD` environment variable, which holds the full path you were in when
|
||||
you ran `npm run`.
|
||||
|
||||
@@ -34,3 +34,4 @@ You can see all your starred packages using [`npm stars`](/commands/npm-stars)
|
||||
* [npm view](/commands/npm-view)
|
||||
* [npm whoami](/commands/npm-whoami)
|
||||
* [npm adduser](/commands/npm-adduser)
|
||||
|
||||
+35
-40
@@ -47,69 +47,64 @@ git+https://user@hostname/project/blah.git#commit-ish
|
||||
```
|
||||
|
||||
The `commit-ish` can be any tag, sha, or branch which can be supplied as
|
||||
an argument to `git checkout`. The default is `master`.
|
||||
an argument to `git checkout`. The default is whatever the repository uses
|
||||
as its default branch.
|
||||
|
||||
### The package.json File
|
||||
|
||||
You need to have a `package.json` file in the root of your project to do
|
||||
much of anything with npm. That is basically the whole interface.
|
||||
|
||||
See [`package.json`](/configuring-npm/package-json) for details about what goes in that file. At the very
|
||||
least, you need:
|
||||
See [`package.json`](/configuring-npm/package-json) for details about what
|
||||
goes in that file. At the very least, you need:
|
||||
|
||||
* name:
|
||||
This should be a string that identifies your project. Please do not
|
||||
use the name to specify that it runs on node, or is in JavaScript.
|
||||
You can use the "engines" field to explicitly state the versions of
|
||||
node (or whatever else) that your program requires, and it's pretty
|
||||
well assumed that it's JavaScript.
|
||||
* name: This should be a string that identifies your project. Please do
|
||||
not use the name to specify that it runs on node, or is in JavaScript.
|
||||
You can use the "engines" field to explicitly state the versions of node
|
||||
(or whatever else) that your program requires, and it's pretty well
|
||||
assumed that it's JavaScript.
|
||||
|
||||
It does not necessarily need to match your github repository name.
|
||||
|
||||
So, `node-foo` and `bar-js` are bad names. `foo` or `bar` are better.
|
||||
|
||||
* version:
|
||||
A semver-compatible version.
|
||||
* version: A semver-compatible version.
|
||||
|
||||
* engines:
|
||||
Specify the versions of node (or whatever else) that your program
|
||||
runs on. The node API changes a lot, and there may be bugs or new
|
||||
functionality that you depend on. Be explicit.
|
||||
* engines: Specify the versions of node (or whatever else) that your
|
||||
program runs on. The node API changes a lot, and there may be bugs or
|
||||
new functionality that you depend on. Be explicit.
|
||||
|
||||
* author:
|
||||
Take some credit.
|
||||
* author: Take some credit.
|
||||
|
||||
* scripts:
|
||||
If you have a special compilation or installation script, then you
|
||||
should put it in the `scripts` object. You should definitely have at
|
||||
least a basic smoke-test command as the "scripts.test" field.
|
||||
See [scripts](/using-npm/scripts).
|
||||
* scripts: If you have a special compilation or installation script, then
|
||||
you should put it in the `scripts` object. You should definitely have at
|
||||
least a basic smoke-test command as the "scripts.test" field. See
|
||||
[scripts](/using-npm/scripts).
|
||||
|
||||
* main:
|
||||
If you have a single module that serves as the entry point to your
|
||||
program (like what the "foo" package gives you at require("foo")),
|
||||
then you need to specify that in the "main" field.
|
||||
* main: If you have a single module that serves as the entry point to your
|
||||
program (like what the "foo" package gives you at require("foo")), then
|
||||
you need to specify that in the "main" field.
|
||||
|
||||
* directories:
|
||||
This is an object mapping names to folders. The best ones to include are
|
||||
"lib" and "doc", but if you use "man" to specify a folder full of man pages,
|
||||
they'll get installed just like these ones.
|
||||
* directories: This is an object mapping names to folders. The best ones
|
||||
to include are "lib" and "doc", but if you use "man" to specify a folder
|
||||
full of man pages, they'll get installed just like these ones.
|
||||
|
||||
You can use `npm init` in the root of your package in order to get you
|
||||
started with a pretty basic package.json file. See
|
||||
[`npm init`](/commands/npm-init) for more info.
|
||||
started with a pretty basic package.json file. See [`npm
|
||||
init`](/commands/npm-init) for more info.
|
||||
|
||||
### Keeping files *out* of your package
|
||||
|
||||
Use a `.npmignore` file to keep stuff out of your package. If there's
|
||||
no `.npmignore` file, but there *is* a `.gitignore` file, then npm will
|
||||
ignore the stuff matched by the `.gitignore` file. If you *want* to
|
||||
include something that is excluded by your `.gitignore` file, you can
|
||||
create an empty `.npmignore` file to override it. Like `git`, `npm` looks
|
||||
for `.npmignore` and `.gitignore` files in all subdirectories of your
|
||||
package, not only the root directory.
|
||||
Use a `.npmignore` file to keep stuff out of your package. If there's no
|
||||
`.npmignore` file, but there *is* a `.gitignore` file, then npm will ignore
|
||||
the stuff matched by the `.gitignore` file. If you *want* to include
|
||||
something that is excluded by your `.gitignore` file, you can create an
|
||||
empty `.npmignore` file to override it. Like `git`, `npm` looks for
|
||||
`.npmignore` and `.gitignore` files in all subdirectories of your package,
|
||||
not only the root directory.
|
||||
|
||||
`.npmignore` files follow the [same pattern rules](https://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository#_ignoring)
|
||||
`.npmignore` files follow the [same pattern
|
||||
rules](https://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository#_ignoring)
|
||||
as `.gitignore` files:
|
||||
|
||||
* Blank lines or lines starting with `#` are ignored.
|
||||
|
||||
@@ -146,6 +146,8 @@ npm command-line interface
|
||||
|
||||
<div id="_content"><h3 id="synopsis">Synopsis</h3>
|
||||
<pre lang="bash"><code>npm explain <folder | specifier>
|
||||
|
||||
alias: why
|
||||
</code></pre>
|
||||
<h3 id="description">Description</h3>
|
||||
<p>This command will print the chain of dependencies causing a given package
|
||||
|
||||
+43
-25
@@ -141,7 +141,7 @@ npm command-line interface
|
||||
|
||||
<section id="table_of_contents">
|
||||
<h2 id="table-of-contents">Table of contents</h2>
|
||||
<div id="_table_of_contents"><ul><li><a href="#synopsis">Synopsis</a></li><li><a href="#description">Description</a></li><li><a href="#see-also">See Also</a></li></ul></div>
|
||||
<div id="_table_of_contents"><ul><li><a href="#synopsis">Synopsis</a></li><li><a href="#description">Description</a></li><li><a href="#caveat">Caveat</a></li><li><a href="#see-also">See Also</a></li></ul></div>
|
||||
</section>
|
||||
|
||||
<div id="_content"><h3 id="synopsis">Synopsis</h3>
|
||||
@@ -151,30 +151,34 @@ npm link [<@scope>/]<pkg>[@<version>]
|
||||
alias: npm ln
|
||||
</code></pre>
|
||||
<h3 id="description">Description</h3>
|
||||
<p>Package linking is a two-step process.</p>
|
||||
<p>First, <code>npm link</code> in a package folder will create a symlink in the global folder
|
||||
<code>{prefix}/lib/node_modules/<package></code> that links to the package where the <code>npm link</code> command was executed. It will also link any bins in the package to <code>{prefix}/bin/{name}</code>.
|
||||
Note that <code>npm link</code> uses the global prefix (see <code>npm prefix -g</code> for its value).</p>
|
||||
<p>Next, in some other location, <code>npm link package-name</code> will create a
|
||||
symbolic link from globally-installed <code>package-name</code> to <code>node_modules/</code>
|
||||
of the current folder.</p>
|
||||
<p>Note that <code>package-name</code> is taken from <code>package.json</code>,
|
||||
not from directory name.</p>
|
||||
<p>The package name can be optionally prefixed with a scope. See <a href="../using-npm/scope.html"><code>scope</code></a>.
|
||||
The scope must be preceded by an @-symbol and followed by a slash.</p>
|
||||
<p>When creating tarballs for <code>npm publish</code>, the linked packages are
|
||||
“snapshotted” to their current state by resolving the symbolic links.</p>
|
||||
<p>This is handy for installing your own stuff, so that you can work on it and
|
||||
test it iteratively without having to continually rebuild.</p>
|
||||
test iteratively without having to continually rebuild.</p>
|
||||
<p>Package linking is a two-step process.</p>
|
||||
<p>First, <code>npm link</code> in a package folder will create a symlink in the global
|
||||
folder <code>{prefix}/lib/node_modules/<package></code> that links to the package
|
||||
where the <code>npm link</code> command was executed. It will also link any bins in
|
||||
the package to <code>{prefix}/bin/{name}</code>. Note that <code>npm link</code> uses the global
|
||||
prefix (see <code>npm prefix -g</code> for its value).</p>
|
||||
<p>Next, in some other location, <code>npm link package-name</code> will create a
|
||||
symbolic link from globally-installed <code>package-name</code> to <code>node_modules/</code> of
|
||||
the current folder.</p>
|
||||
<p>Note that <code>package-name</code> is taken from <code>package.json</code>, <em>not</em> from the
|
||||
directory name.</p>
|
||||
<p>The package name can be optionally prefixed with a scope. See
|
||||
<a href="../using-npm/scope.html"><code>scope</code></a>. The scope must be preceded by an @-symbol and
|
||||
followed by a slash.</p>
|
||||
<p>When creating tarballs for <code>npm publish</code>, the linked packages are
|
||||
“snapshotted” to their current state by resolving the symbolic links, if
|
||||
they are included in <code>bundleDependencies</code>.</p>
|
||||
<p>For example:</p>
|
||||
<pre lang="bash"><code> cd ~/projects/node-redis # go into the package directory
|
||||
npm link # creates global link
|
||||
cd ~/projects/node-bloggy # go into some other package directory.
|
||||
npm link redis # link-install the package
|
||||
<pre lang="bash"><code>cd ~/projects/node-redis # go into the package directory
|
||||
npm link # creates global link
|
||||
cd ~/projects/node-bloggy # go into some other package directory.
|
||||
npm link redis # link-install the package
|
||||
</code></pre>
|
||||
<p>Now, any changes to ~/projects/node-redis will be reflected in
|
||||
~/projects/node-bloggy/node_modules/node-redis/. Note that the link should
|
||||
be to the package name, not the directory name for that package.</p>
|
||||
<p>Now, any changes to <code>~/projects/node-redis</code> will be reflected in
|
||||
<code>~/projects/node-bloggy/node_modules/node-redis/</code>. Note that the link
|
||||
should be to the package name, not the directory name for that package.</p>
|
||||
<p>You may also shortcut the two steps in one. For example, to do the
|
||||
above use-case in a shorter way:</p>
|
||||
<pre lang="bash"><code>cd ~/projects/node-bloggy # go into the dir of your main project
|
||||
@@ -186,11 +190,25 @@ npm link redis
|
||||
</code></pre>
|
||||
<p>That is, it first creates a global link, and then links the global
|
||||
installation target into your project’s <code>node_modules</code> folder.</p>
|
||||
<p>Note that in this case, you are referring to the directory name, <code>node-redis</code>,
|
||||
rather than the package name <code>redis</code>.</p>
|
||||
<p>If your linked package is scoped (see <a href="../using-npm/scope.html"><code>scope</code></a>) your link command must include that scope, e.g.</p>
|
||||
<p>Note that in this case, you are referring to the directory name,
|
||||
<code>node-redis</code>, rather than the package name <code>redis</code>.</p>
|
||||
<p>If your linked package is scoped (see <a href="../using-npm/scope.html"><code>scope</code></a>) your
|
||||
link command must include that scope, e.g.</p>
|
||||
<pre lang="bash"><code>npm link @myorg/privatepackage
|
||||
</code></pre>
|
||||
<h3 id="caveat">Caveat</h3>
|
||||
<p>Note that package dependencies linked in this way are <em>not</em> saved to
|
||||
<code>package.json</code> by default, on the assumption that the intention is to have
|
||||
a link stand in for a regular non-link dependency. Otherwise, for example,
|
||||
if you depend on <code>redis@^3.0.1</code>, and ran <code>npm link redis</code>, it would replace
|
||||
the <code>^3.0.1</code> dependency with <code>file:../path/to/node-redis</code>, which you
|
||||
probably don’t want! Additionally, other users or developers on your
|
||||
project would run into issues if they do not have their folders set up
|
||||
exactly the same as yours.</p>
|
||||
<p>If you are adding a <em>new</em> dependency as a link, you should add it to the
|
||||
relevant metadata by running <code>npm install <dep> --package-lock-only</code>.</p>
|
||||
<p>If you <em>want</em> to save the <code>file:</code> reference in your <code>package.json</code> and
|
||||
<code>package-lock.json</code> files, you can use <code>npm link <dep> --save</code> to do so.</p>
|
||||
<h3 id="see-also">See Also</h3>
|
||||
<ul>
|
||||
<li><a href="../using-npm/developers.html">npm developers</a></li>
|
||||
|
||||
+6
-6
@@ -148,12 +148,12 @@ npm command-line interface
|
||||
<pre lang="bash"><code>npm logout [--registry=<url>] [--scope=<@scope>]
|
||||
</code></pre>
|
||||
<h3 id="description">Description</h3>
|
||||
<p>When logged into a registry that supports token-based authentication, tell the
|
||||
server to end this token’s session. This will invalidate the token everywhere
|
||||
you’re using it, not just for the current environment.</p>
|
||||
<p>When logged into a legacy registry that uses username and password authentication, this will
|
||||
clear the credentials in your user configuration. In this case, it will <em>only</em> affect
|
||||
the current environment.</p>
|
||||
<p>When logged into a registry that supports token-based authentication, tell
|
||||
the server to end this token’s session. This will invalidate the token
|
||||
everywhere you’re using it, not just for the current environment.</p>
|
||||
<p>When logged into a legacy registry that uses username and password
|
||||
authentication, this will clear the credentials in your user configuration.
|
||||
In this case, it will <em>only</em> affect the current environment.</p>
|
||||
<p>If <code>--scope</code> is provided, this will find the credentials for the registry
|
||||
connected to that scope, if set.</p>
|
||||
<h3 id="configuration">Configuration</h3>
|
||||
|
||||
+43
-10
@@ -141,7 +141,7 @@ npm command-line interface
|
||||
|
||||
<section id="table_of_contents">
|
||||
<h2 id="table-of-contents">Table of contents</h2>
|
||||
<div id="_table_of_contents"><ul><li><a href="#synopsis">Synopsis</a></li><li><a href="#description">Description</a></li><li><a href="#configuration">Configuration</a></li><ul><li><a href="#json">json</a></li><li><a href="#long">long</a></li><li><a href="#parseable">parseable</a></li><li><a href="#global">global</a></li><li><a href="#depth">depth</a></li><li><a href="#prod--production">prod / production</a></li><li><a href="#dev--development">dev / development</a></li><li><a href="#only">only</a></li><li><a href="#link">link</a></li><li><a href="#unicode">unicode</a></li></ul><li><a href="#see-also">See Also</a></li></ul></div>
|
||||
<div id="_table_of_contents"><ul><li><a href="#synopsis">Synopsis</a></li><li><a href="#description">Description</a></li><li><a href="#note-design-changes-pending">Note: Design Changes Pending</a></li><li><a href="#configuration">Configuration</a></li><ul><li><a href="#all">all</a></li><li><a href="#json">json</a></li><li><a href="#long">long</a></li><li><a href="#parseable">parseable</a></li><li><a href="#global">global</a></li><li><a href="#depth">depth</a></li><li><a href="#prod--production">prod / production</a></li><li><a href="#dev--development">dev / development</a></li><li><a href="#only">only</a></li><li><a href="#link">link</a></li><li><a href="#unicode">unicode</a></li></ul><li><a href="#see-also">See Also</a></li></ul></div>
|
||||
</section>
|
||||
|
||||
<div id="_content"><h3 id="synopsis">Synopsis</h3>
|
||||
@@ -151,23 +151,55 @@ aliases: list, la, ll
|
||||
</code></pre>
|
||||
<h3 id="description">Description</h3>
|
||||
<p>This command will print to stdout all the versions of packages that are
|
||||
installed, as well as their dependencies, in a tree-structure.</p>
|
||||
<p>Positional arguments are <code>name@version-range</code> identifiers, which will
|
||||
limit the results to only the paths to the packages named. Note that
|
||||
nested packages will <em>also</em> show the paths to the specified packages.
|
||||
For example, running <code>npm ls promzard</code> in npm’s source tree will show:</p>
|
||||
<pre lang="bash"><code> npm@7.1.1 /path/to/npm
|
||||
└─┬ init-package-json@0.0.4
|
||||
└── promzard@0.1.5
|
||||
installed, as well as their dependencies when <code>--all</code> is specified, in a
|
||||
tree structure.</p>
|
||||
<p>Note: to get a “bottoms up” view of why a given package is included in the
|
||||
tree at all, use <a href="../commands/npm-explain.html"><code>npm explain</code></a>.</p>
|
||||
<p>Positional arguments are <code>name@version-range</code> identifiers, which will limit
|
||||
the results to only the paths to the packages named. Note that nested
|
||||
packages will <em>also</em> show the paths to the specified packages. For
|
||||
example, running <code>npm ls promzard</code> in npm’s source tree will show:</p>
|
||||
<pre lang="bash"><code>npm@7.1.2 /path/to/npm
|
||||
└─┬ init-package-json@0.0.4
|
||||
└── promzard@0.1.5
|
||||
</code></pre>
|
||||
<p>It will print out extraneous, missing, and invalid packages.</p>
|
||||
<p>If a project specifies git urls for dependencies these are shown
|
||||
in parentheses after the name@version to make it easier for users to
|
||||
recognize potential forks of a project.</p>
|
||||
<p>The tree shown is the logical dependency tree, based on package
|
||||
dependencies, not the physical layout of your node_modules folder.</p>
|
||||
dependencies, not the physical layout of your <code>node_modules</code> folder.</p>
|
||||
<p>When run as <code>ll</code> or <code>la</code>, it shows extended information by default.</p>
|
||||
<h3 id="note-design-changes-pending">Note: Design Changes Pending</h3>
|
||||
<p>The <code>npm ls</code> command’s output and behavior made a <em>ton</em> of sense when npm
|
||||
created a <code>node_modules</code> folder that naively nested every dependency. In
|
||||
such a case, the logical dependency graph and physical tree of packages on
|
||||
disk would be roughly identical.</p>
|
||||
<p>With the advent of automatic install-time deduplication of dependencies in
|
||||
npm v3, the <code>ls</code> output was modified to display the logical dependency
|
||||
graph as a tree structure, since this was more useful to most users.
|
||||
However, without using <code>npm ls -l</code>, it became impossible show <em>where</em> a
|
||||
package was actually installed much of the time!</p>
|
||||
<p>With the advent of automatic installation of <code>peerDependencies</code> in npm v7,
|
||||
this gets even more curious, as <code>peerDependencies</code> are logically
|
||||
“underneath” their dependents in the dependency graph, but are always
|
||||
physically at or above their location on disk.</p>
|
||||
<p>Also, in the years since npm got an <code>ls</code> command (in version 0.0.2!),
|
||||
dependency graphs have gotten much larger as a general rule. Therefor, in
|
||||
order to avoid dumping an excessive amount of content to the terminal, <code>npm ls</code> now only shows the <em>top</em> level dependencies, unless <code>--all</code> is
|
||||
provided.</p>
|
||||
<p>A thorough re-examination of the use cases, intention, behavior, and output
|
||||
of this command, is currently underway. Expect significant changes to at
|
||||
least the default human-readable <code>npm ls</code> output in npm v8.</p>
|
||||
<h3 id="configuration">Configuration</h3>
|
||||
<h4 id="all">all</h4>
|
||||
<ul>
|
||||
<li>Default: <code>false</code></li>
|
||||
<li>Type: Boolean</li>
|
||||
</ul>
|
||||
<p>When running <code>npm outdated</code> and <code>npm ls</code>, setting <code>--all</code> will show all
|
||||
outdated or installed packages, rather than only those directly depended
|
||||
upon by the current project.</p>
|
||||
<h4 id="json">json</h4>
|
||||
<ul>
|
||||
<li>Default: false</li>
|
||||
@@ -231,6 +263,7 @@ project.</p>
|
||||
Set it to false in order to use all-ansi output.</p>
|
||||
<h3 id="see-also">See Also</h3>
|
||||
<ul>
|
||||
<li><a href="../commands/npm-explain.html">npm explain</a></li>
|
||||
<li><a href="../commands/npm-config.html">npm config</a></li>
|
||||
<li><a href="../configuring-npm/npmrc.html">npmrc</a></li>
|
||||
<li><a href="../configuring-npm/folders.html">npm folders</a></li>
|
||||
|
||||
+4
-3
@@ -169,11 +169,12 @@ npm org ls <orgname> [<username>]
|
||||
<pre lang="bash"><code>$ npm org ls my-org @mx-santos
|
||||
</code></pre>
|
||||
<h3 id="description">Description</h3>
|
||||
<p>You can use the <code>npm org</code> commands to manage and view users of an organization.
|
||||
It supports adding and removing users, changing their roles, listing them, and
|
||||
finding specific ones and their roles.</p>
|
||||
<p>You can use the <code>npm org</code> commands to manage and view users of an
|
||||
organization. It supports adding and removing users, changing their roles,
|
||||
listing them, and finding specific ones and their roles.</p>
|
||||
<h3 id="see-also">See Also</h3>
|
||||
<ul>
|
||||
<li><a href="../using-npm/orgs.html">using orgs</a></li>
|
||||
<li><a href="https://docs.npmjs.com/orgs/">Documentation on npm Orgs</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
+35
-26
@@ -150,25 +150,33 @@ npm command-line interface
|
||||
<h3 id="description">Description</h3>
|
||||
<p>This command will check the registry to see if any (or, specific) installed
|
||||
packages are currently outdated.</p>
|
||||
<p>By default, only the direct dependencies of the root project are shown.
|
||||
Use <code>--all</code> to find all outdated meta-dependencies as well.</p>
|
||||
<p>In the output:</p>
|
||||
<ul>
|
||||
<li><code>wanted</code> is the maximum version of the package that satisfies the semver
|
||||
range specified in <code>package.json</code>. If there’s no available semver range (i.e.
|
||||
you’re running <code>npm outdated --global</code>, or the package isn’t included in
|
||||
<code>package.json</code>), then <code>wanted</code> shows the currently-installed version.</li>
|
||||
range specified in <code>package.json</code>. If there’s no available semver range
|
||||
(i.e. you’re running <code>npm outdated --global</code>, or the package isn’t
|
||||
included in <code>package.json</code>), then <code>wanted</code> shows the currently-installed
|
||||
version.</li>
|
||||
<li><code>latest</code> is the version of the package tagged as latest in the registry.
|
||||
Running <code>npm publish</code> with no special configuration will publish the package
|
||||
with a dist-tag of <code>latest</code>. This may or may not be the maximum version of
|
||||
the package, or the most-recently published version of the package, depending
|
||||
on how the package’s developer manages the latest <a href="npm-dist-tag">dist-tag</a>.</li>
|
||||
Running <code>npm publish</code> with no special configuration will publish the
|
||||
package with a dist-tag of <code>latest</code>. This may or may not be the maximum
|
||||
version of the package, or the most-recently published version of the
|
||||
package, depending on how the package’s developer manages the latest
|
||||
<a href="../commands/npm-dist-tag.html">dist-tag</a>.</li>
|
||||
<li><code>location</code> is where in the physical tree the package is located.</li>
|
||||
<li><code>depended by</code> shows which package depends on the displayed dependency</li>
|
||||
<li><code>package type</code> (when using <code>--long</code> / <code>-l</code>) tells you whether this package is
|
||||
a <code>dependency</code> or a dev/peer/optional dependency. Packages not included in <code>package.json</code>
|
||||
are always marked <code>dependencies</code>.</li>
|
||||
<li><code>homepage</code> (when using <code>--long</code> / <code>-l</code>) is the <code>homepage</code> value contained in the package’s packument</li>
|
||||
<li>Red means there’s a newer version matching your semver requirements, so you should update now.</li>
|
||||
<li>Yellow indicates that there’s a newer version above your semver requirements (usually new major, or new 0.x minor) so proceed with caution.</li>
|
||||
<li><code>package type</code> (when using <code>--long</code> / <code>-l</code>) tells you whether this
|
||||
package is a <code>dependency</code> or a dev/peer/optional dependency. Packages not
|
||||
included in <code>package.json</code> are always marked <code>dependencies</code>.</li>
|
||||
<li><code>homepage</code> (when using <code>--long</code> / <code>-l</code>) is the <code>homepage</code> value contained
|
||||
in the package’s packument</li>
|
||||
<li>Red means there’s a newer version matching your semver requirements, so
|
||||
you should update now.</li>
|
||||
<li>Yellow indicates that there’s a newer version <em>above</em> your semver
|
||||
requirements (usually new major, or new 0.x minor) so proceed with
|
||||
caution.</li>
|
||||
</ul>
|
||||
<h3 id="an-example">An example</h3>
|
||||
<pre lang="bash"><code>$ npm outdated
|
||||
@@ -189,19 +197,20 @@ once 1.3.2 1.3.3 1.3.3 node_modules/once dependent-pack
|
||||
</code></pre>
|
||||
<p>A few things to note:</p>
|
||||
<ul>
|
||||
<li><code>glob</code> requires <code>^5</code>, which prevents npm from installing <code>glob@6</code>, which is
|
||||
outside the semver range.</li>
|
||||
<li>Git dependencies will always be reinstalled, because of how they’re specified.
|
||||
The installed committish might satisfy the dependency specifier (if it’s
|
||||
something immutable, like a commit SHA), or it might not, so <code>npm outdated</code> and
|
||||
<code>npm update</code> have to fetch Git repos to check. This is why currently doing a
|
||||
reinstall of a Git dependency always forces a new clone and install.</li>
|
||||
<li><code>npm@3.5.2</code> is marked as “wanted”, but “latest” is <code>npm@3.5.1</code> because npm
|
||||
uses dist-tags to manage its <code>latest</code> and <code>next</code> release channels. <code>npm update</code>
|
||||
will install the <em>newest</em> version, but <code>npm install npm</code> (with no semver range)
|
||||
will install whatever’s tagged as <code>latest</code>.</li>
|
||||
<li><code>once</code> is just plain out of date. Reinstalling <code>node_modules</code> from scratch or
|
||||
running <code>npm update</code> will bring it up to spec.</li>
|
||||
<li><code>glob</code> requires <code>^5</code>, which prevents npm from installing <code>glob@6</code>, which
|
||||
is outside the semver range.</li>
|
||||
<li>Git dependencies will always be reinstalled, because of how they’re
|
||||
specified. The installed committish might satisfy the dependency
|
||||
specifier (if it’s something immutable, like a commit SHA), or it might
|
||||
not, so <code>npm outdated</code> and <code>npm update</code> have to fetch Git repos to check.
|
||||
This is why currently doing a reinstall of a Git dependency always forces
|
||||
a new clone and install.</li>
|
||||
<li><code>npm@3.5.2</code> is marked as “wanted”, but “latest” is <code>npm@3.5.1</code> because
|
||||
npm uses dist-tags to manage its <code>latest</code> and <code>next</code> release channels.
|
||||
<code>npm update</code> will install the <em>newest</em> version, but <code>npm install npm</code>
|
||||
(with no semver range) will install whatever’s tagged as <code>latest</code>.</li>
|
||||
<li><code>once</code> is just plain out of date. Reinstalling <code>node_modules</code> from
|
||||
scratch or running <code>npm update</code> will bring it up to spec.</li>
|
||||
</ul>
|
||||
<h3 id="configuration">Configuration</h3>
|
||||
<h4 id="json">json</h4>
|
||||
|
||||
+10
-12
@@ -154,24 +154,22 @@ aliases: author
|
||||
<h3 id="description">Description</h3>
|
||||
<p>Manage ownership of published packages.</p>
|
||||
<ul>
|
||||
<li>ls:
|
||||
List all the users who have access to modify a package and push new versions.
|
||||
Handy when you need to know who to bug for help.</li>
|
||||
<li>add:
|
||||
Add a new user as a maintainer of a package. This user is enabled to modify
|
||||
metadata, publish new versions, and add other owners.</li>
|
||||
<li>rm:
|
||||
Remove a user from the package owner list. This immediately revokes their
|
||||
privileges.</li>
|
||||
<li>ls: List all the users who have access to modify a package and push new
|
||||
versions. Handy when you need to know who to bug for help.</li>
|
||||
<li>add: Add a new user as a maintainer of a package. This user is enabled
|
||||
to modify metadata, publish new versions, and add other owners.</li>
|
||||
<li>rm: Remove a user from the package owner list. This immediately revokes
|
||||
their privileges.</li>
|
||||
</ul>
|
||||
<p>Note that there is only one level of access. Either you can modify a package,
|
||||
or you can’t. Future versions may contain more fine-grained access levels, but
|
||||
that is not implemented at this time.</p>
|
||||
<p>If you have two-factor authentication enabled with <code>auth-and-writes</code> then
|
||||
you’ll need to include an otp on the command line when changing ownership
|
||||
with <code>--otp</code>.</p>
|
||||
<p>If you have two-factor authentication enabled with <code>auth-and-writes</code> (see
|
||||
<a href="../commands/npm-profile.html"><code>npm-profile</code></a>) then you’ll need to include an otp
|
||||
on the command line when changing ownership with <code>--otp</code>.</p>
|
||||
<h3 id="see-also">See Also</h3>
|
||||
<ul>
|
||||
<li><a href="../commands/npm-profile.html">npm profile</a></li>
|
||||
<li><a href="../commands/npm-publish.html">npm publish</a></li>
|
||||
<li><a href="../using-npm/registry.html">npm registry</a></li>
|
||||
<li><a href="../commands/npm-adduser.html">npm adduser</a></li>
|
||||
|
||||
+7
-5
@@ -149,17 +149,19 @@ npm command-line interface
|
||||
</code></pre>
|
||||
<h3 id="description">Description</h3>
|
||||
<p>For anything that’s installable (that is, a package folder, tarball,
|
||||
tarball url, name@tag, name@version, name, or scoped name), this
|
||||
command will fetch it to the cache, and then copy the tarball to the
|
||||
current working directory as <code><name>-<version>.tgz</code>, and then write
|
||||
the filenames out to stdout.</p>
|
||||
tarball url, git url, name@tag, name@version, name, or scoped name), this
|
||||
command will fetch it to the cache, copy the tarball to the current working
|
||||
directory as <code><name>-<version>.tgz</code>, and then write the filenames out to
|
||||
stdout.</p>
|
||||
<p>If the same package is specified multiple times, then the file will be
|
||||
overwritten the second time.</p>
|
||||
<p>If no arguments are supplied, then npm packs the current package folder.</p>
|
||||
<p>The <code>--dry-run</code> argument will do everything that pack usually does without
|
||||
actually packing anything. Reports on what would have gone into the tarball.</p>
|
||||
actually packing anything. That is, it reports on what would have gone
|
||||
into the tarball, but nothing else.</p>
|
||||
<h3 id="see-also">See Also</h3>
|
||||
<ul>
|
||||
<li><a href="http://npm.im/npm-packlist">npm-packlist package</a></li>
|
||||
<li><a href="../commands/npm-cache.html">npm cache</a></li>
|
||||
<li><a href="../commands/npm-publish.html">npm publish</a></li>
|
||||
<li><a href="../commands/npm-config.html">npm config</a></li>
|
||||
|
||||
+1
@@ -157,6 +157,7 @@ If it works it will output something like:</p>
|
||||
</code></pre>
|
||||
<h3 id="see-also">See Also</h3>
|
||||
<ul>
|
||||
<li><a href="../commands/npm-doctor.html">npm doctor</a></li>
|
||||
<li><a href="../commands/npm-config.html">npm config</a></li>
|
||||
<li><a href="../configuring-npm/npmrc.html">npmrc</a></li>
|
||||
</ul>
|
||||
|
||||
+20
-19
@@ -152,12 +152,12 @@ npm profile enable-2fa [auth-and-writes|auth-only]
|
||||
npm profile disable-2fa
|
||||
</code></pre>
|
||||
<h3 id="description">Description</h3>
|
||||
<p>Change your profile information on the registry. This not be available if
|
||||
you’re using a non-npmjs registry.</p>
|
||||
<p>Change your profile information on the registry. Note that this command
|
||||
depends on the registry implementation, so third-party registries may not
|
||||
support this interface.</p>
|
||||
<ul>
|
||||
<li><code>npm profile get [<property>]</code>:
|
||||
Display all of the properties of your profile, or one or more specific
|
||||
properties. It looks like:</li>
|
||||
<li><code>npm profile get [<property>]</code>: Display all of the properties of your
|
||||
profile, or one or more specific properties. It looks like:</li>
|
||||
</ul>
|
||||
<pre lang="bash"><code>+-----------------+---------------------------+
|
||||
| name | example |
|
||||
@@ -183,31 +183,30 @@ properties. It looks like:</li>
|
||||
</code></pre>
|
||||
<ul>
|
||||
<li>
|
||||
<p><code>npm profile set <property> <value></code>:
|
||||
Set the value of a profile property. You can set the following properties this way:
|
||||
email, fullname, homepage, freenode, twitter, github</p>
|
||||
<p><code>npm profile set <property> <value></code>: Set the value of a profile
|
||||
property. You can set the following properties this way: email, fullname,
|
||||
homepage, freenode, twitter, github</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><code>npm profile set password</code>:
|
||||
Change your password. This is interactive, you’ll be prompted for your
|
||||
current password and a new password. You’ll also be prompted for an OTP
|
||||
if you have two-factor authentication enabled.</p>
|
||||
<p><code>npm profile set password</code>: Change your password. This is interactive,
|
||||
you’ll be prompted for your current password and a new password. You’ll
|
||||
also be prompted for an OTP if you have two-factor authentication
|
||||
enabled.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><code>npm profile enable-2fa [auth-and-writes|auth-only]</code>:
|
||||
Enables two-factor authentication. Defaults to <code>auth-and-writes</code> mode. Modes are:</p>
|
||||
<p><code>npm profile enable-2fa [auth-and-writes|auth-only]</code>: Enables two-factor
|
||||
authentication. Defaults to <code>auth-and-writes</code> mode. Modes are:</p>
|
||||
<ul>
|
||||
<li><code>auth-only</code>: Require an OTP when logging in or making changes to your
|
||||
account’s authentication. The OTP will be required on both the website
|
||||
and the command line.</li>
|
||||
<li><code>auth-and-writes</code>: Requires an OTP at all the times <code>auth-only</code> does, and also requires one when
|
||||
publishing a module, setting the <code>latest</code> dist-tag, or changing access
|
||||
via <code>npm access</code> and <code>npm owner</code>.</li>
|
||||
<li><code>auth-and-writes</code>: Requires an OTP at all the times <code>auth-only</code> does,
|
||||
and also requires one when publishing a module, setting the <code>latest</code>
|
||||
dist-tag, or changing access via <code>npm access</code> and <code>npm owner</code>.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<p><code>npm profile disable-2fa</code>:
|
||||
Disables two-factor authentication.</p>
|
||||
<p><code>npm profile disable-2fa</code>: Disables two-factor authentication.</p>
|
||||
</li>
|
||||
</ul>
|
||||
<h3 id="details">Details</h3>
|
||||
@@ -216,6 +215,8 @@ will tailor their output based on those. Some of these commands may not be
|
||||
available on non npmjs.com registries.</p>
|
||||
<h3 id="see-also">See Also</h3>
|
||||
<ul>
|
||||
<li><a href="../commands/npm-adduser.html">npm adduser</a></li>
|
||||
<li><a href="../commands/npm-logout.html">npm logout</a></li>
|
||||
<li><a href="../commands/npm-config.html">npm config</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
+11
-13
@@ -148,23 +148,21 @@ npm command-line interface
|
||||
<pre lang="bash"><code>npm prune [[<@scope>/]<pkg>...] [--production] [--dry-run] [--json]
|
||||
</code></pre>
|
||||
<h3 id="description">Description</h3>
|
||||
<p>This command removes “extraneous” packages. If a package name is
|
||||
provided, then only packages matching one of the supplied names are
|
||||
removed.</p>
|
||||
<p>Extraneous packages are packages that are not listed on the parent
|
||||
package’s dependencies list.</p>
|
||||
<p>This command removes “extraneous” packages. If a package name is provided,
|
||||
then only packages matching one of the supplied names are removed.</p>
|
||||
<p>Extraneous packages are those present in the <code>node_modules</code> folder that are
|
||||
not listed as any package’s dependency list.</p>
|
||||
<p>If the <code>--production</code> flag is specified or the <code>NODE_ENV</code> environment
|
||||
variable is set to <code>production</code>, this command will remove the packages
|
||||
specified in your <code>devDependencies</code>. Setting <code>--no-production</code> will
|
||||
negate <code>NODE_ENV</code> being set to <code>production</code>.</p>
|
||||
specified in your <code>devDependencies</code>. Setting <code>--no-production</code> will negate
|
||||
<code>NODE_ENV</code> being set to <code>production</code>.</p>
|
||||
<p>If the <code>--dry-run</code> flag is used then no changes will actually be made.</p>
|
||||
<p>If the <code>--json</code> flag is used then the changes <code>npm prune</code> made (or would
|
||||
<p>If the <code>--json</code> flag is used, then the changes <code>npm prune</code> made (or would
|
||||
have made with <code>--dry-run</code>) are printed as a JSON object.</p>
|
||||
<p>In normal operation with package-locks enabled, extraneous modules are
|
||||
pruned automatically when modules are installed and you’ll only need
|
||||
this command with the <code>--production</code> flag.</p>
|
||||
<p>If you’ve disabled package-locks then extraneous modules will not be removed
|
||||
and it’s up to you to run <code>npm prune</code> from time-to-time to remove them.</p>
|
||||
<p>In normal operation, extraneous modules are pruned automatically, so you’ll
|
||||
only need this command with the <code>--production</code> flag. However, in the real
|
||||
world, operation is not always “normal”. When crashes or mistakes happen,
|
||||
this command can help clean up any resulting garbage.</p>
|
||||
<h3 id="see-also">See Also</h3>
|
||||
<ul>
|
||||
<li><a href="../commands/npm-uninstall.html">npm uninstall</a></li>
|
||||
|
||||
+69
-35
@@ -141,7 +141,7 @@ npm command-line interface
|
||||
|
||||
<section id="table_of_contents">
|
||||
<h2 id="table-of-contents">Table of contents</h2>
|
||||
<div id="_table_of_contents"><ul><li><a href="#synopsis">Synopsis</a></li><li><a href="#description">Description</a></li><li><a href="#see-also">See Also</a></li></ul></div>
|
||||
<div id="_table_of_contents"><ul><li><a href="#synopsis">Synopsis</a></li><li><a href="#description">Description</a></li><li><a href="#files-included-in-package">Files included in package</a></li><li><a href="#see-also">See Also</a></li></ul></div>
|
||||
</section>
|
||||
|
||||
<div id="_content"><h3 id="synopsis">Synopsis</h3>
|
||||
@@ -151,61 +151,95 @@ Publishes '.' if no argument supplied
|
||||
Sets tag 'latest' if no --tag specified
|
||||
</code></pre>
|
||||
<h3 id="description">Description</h3>
|
||||
<p>Publishes a package to the registry so that it can be installed by name. All
|
||||
files in the package directory are included if no local <code>.gitignore</code> or
|
||||
<code>.npmignore</code> file exists. If both files exist and a file is ignored by
|
||||
<code>.gitignore</code> but not by <code>.npmignore</code> then it will be included. See
|
||||
<a href="../using-npm/developers.html"><code>developers</code></a> for full details on what’s included in the published package, as well as details on how the package is built.</p>
|
||||
<p>By default npm will publish to the public registry. This can be overridden by
|
||||
specifying a different default registry or using a <a href="../using-npm/scope.html"><code>scope</code></a> in the name (see <a href="../configuring-npm/package-json.html"><code>package.json</code></a>).</p>
|
||||
<p>Publishes a package to the registry so that it can be installed by name.</p>
|
||||
<p>By default npm will publish to the public registry. This can be overridden
|
||||
by specifying a different default registry or using a
|
||||
<a href="../using-npm/scope.html"><code>scope</code></a> in the name (see
|
||||
<a href="../configuring-npm/package-json.html"><code>package.json</code></a>).</p>
|
||||
<ul>
|
||||
<li>
|
||||
<p><code><folder></code>:
|
||||
A folder containing a package.json file</p>
|
||||
<p><code><folder></code>: A folder containing a package.json file</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><code><tarball></code>:
|
||||
A url or file path to a gzipped tar archive containing a single folder
|
||||
with a package.json file inside.</p>
|
||||
<p><code><tarball></code>: A url or file path to a gzipped tar archive containing a
|
||||
single folder with a package.json file inside.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><code>[--tag <tag>]</code>
|
||||
Registers the published package with the given tag, such that
|
||||
<code>npm install <name>@<tag></code> will install this version. By default,
|
||||
<p><code>[--tag <tag>]</code>: Registers the published package with the given tag, such
|
||||
that <code>npm install <name>@<tag></code> will install this version. By default,
|
||||
<code>npm publish</code> updates and <code>npm install</code> installs the <code>latest</code> tag. See
|
||||
<a href="npm-dist-tag"><code>npm-dist-tag</code></a> for details about tags.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><code>[--access <public|restricted>]</code>
|
||||
Tells the registry whether this package should be published as public or
|
||||
restricted. Only applies to scoped packages, which default to <code>restricted</code>.
|
||||
If you don’t have a paid account, you must publish with <code>--access public</code>
|
||||
to publish scoped packages.</p>
|
||||
<p><code>[--access <public|restricted>]</code>: Tells the registry whether this package
|
||||
should be published as public or restricted. Only applies to scoped
|
||||
packages, which default to <code>restricted</code>. If you don’t have a paid
|
||||
account, you must publish with <code>--access public</code> to publish scoped
|
||||
packages.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><code>[--otp <otpcode>]</code>
|
||||
If you have two-factor authentication enabled in <code>auth-and-writes</code> mode
|
||||
then you can provide a code from your authenticator with this. If you
|
||||
don’t include this and you’re running from a TTY then you’ll be prompted.</p>
|
||||
<p><code>[--otp <otpcode>]</code>: If you have two-factor authentication enabled in
|
||||
<code>auth-and-writes</code> mode then you can provide a code from your
|
||||
authenticator with this. If you don’t include this and you’re running
|
||||
from a TTY then you’ll be prompted.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><code>[--dry-run]</code>
|
||||
As of <code>npm@6</code>, does everything publish would do except actually publishing
|
||||
to the registry. Reports the details of what would have been published.</p>
|
||||
<p><code>[--dry-run]</code>: As of <code>npm@6</code>, does everything publish would do except
|
||||
actually publishing to the registry. Reports the details of what would
|
||||
have been published.</p>
|
||||
</li>
|
||||
</ul>
|
||||
<p>Fails if the package name and version combination already exists in
|
||||
the specified registry.</p>
|
||||
<p>Once a package is published with a given name and version, that
|
||||
specific name and version combination can never be used again, even if
|
||||
it is removed with <a href="../commands/npm-unpublish.html"><code>npm unpublish</code></a>.</p>
|
||||
<p>The publish will fail if the package name and version combination already
|
||||
exists in the specified registry.</p>
|
||||
<p>Once a package is published with a given name and version, that specific
|
||||
name and version combination can never be used again, even if it is removed
|
||||
with <a href="../commands/npm-unpublish.html"><code>npm unpublish</code></a>.</p>
|
||||
<p>As of <code>npm@5</code>, both a sha1sum and an integrity field with a sha512sum of the
|
||||
tarball will be submitted to the registry during publication. Subsequent
|
||||
installs will use the strongest supported algorithm to verify downloads.</p>
|
||||
<p>Similar to <code>--dry-run</code> see <a href="../commands/npm-pack.html"><code>npm pack</code></a>, which figures out the files to be
|
||||
included and packs them into a tarball to be uploaded to the registry.</p>
|
||||
<p>Similar to <code>--dry-run</code> see <a href="../commands/npm-pack.html"><code>npm pack</code></a>, which figures
|
||||
out the files to be included and packs them into a tarball to be uploaded
|
||||
to the registry.</p>
|
||||
<h3 id="files-included-in-package">Files included in package</h3>
|
||||
<p>To see what will be included in your package, run <code>npx npm-packlist</code>. All
|
||||
files are included by default, with the following exceptions:</p>
|
||||
<ul>
|
||||
<li>
|
||||
<p>Certain files that are relevant to package installation and distribution
|
||||
are always included. For example, <code>package.json</code>, <code>README.md</code>,
|
||||
<code>LICENSE</code>, and so on.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>If there is a “files” list in
|
||||
<a href="../configuring-npm/package-json.html"><code>package.json</code></a>, then only the files
|
||||
specified will be included. (If directories are specified, then they
|
||||
will be walked recursively and their contents included, subject to the
|
||||
same ignore rules.)</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>If there is a <code>.gitignore</code> or <code>.npmignore</code> file, then ignored files in
|
||||
that and all child directories will be excluded from the package. If
|
||||
<em>both</em> files exist, then the <code>.gitignore</code> is ignored, and only the
|
||||
<code>.npmignore</code> is used.</p>
|
||||
<p><code>.npmignore</code> files follow the <a href="https://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository#_ignoring">same pattern
|
||||
rules</a>
|
||||
as <code>.gitignore</code> files</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>If the file matches certain patterns, then it will <em>never</em> be included,
|
||||
unless explicitly added to the <code>"files"</code> list in <code>package.json</code>, or
|
||||
un-ignored with a <code>!</code> rule in a <code>.npmignore</code> or <code>.gitignore</code> file.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Symbolic links are never included in npm packages.</p>
|
||||
</li>
|
||||
</ul>
|
||||
<p>See <a href="../using-npm/developers.html"><code>developers</code></a> for full details on what’s
|
||||
included in the published package, as well as details on how the package is
|
||||
built.</p>
|
||||
<h3 id="see-also">See Also</h3>
|
||||
<ul>
|
||||
<li><a href="http://npm.im/npm-packlist">npm-packlist package</a></li>
|
||||
<li><a href="../using-npm/registry.html">npm registry</a></li>
|
||||
<li><a href="../using-npm/scope.html">npm scope</a></li>
|
||||
<li><a href="../commands/npm-adduser.html">npm adduser</a></li>
|
||||
|
||||
+10
-4
@@ -145,15 +145,21 @@ npm command-line interface
|
||||
</section>
|
||||
|
||||
<div id="_content"><h3 id="synopsis">Synopsis</h3>
|
||||
<pre lang="bash"><code>npm rebuild [[<@scope>/<name>]...]
|
||||
<pre lang="bash"><code>npm rebuild [[<@scope>/]<name>[@<version>] ...]
|
||||
|
||||
alias: npm rb
|
||||
alias: rb
|
||||
</code></pre>
|
||||
<h3 id="description">Description</h3>
|
||||
<p>This command runs the <code>npm build</code> command on the matched folders. This is useful when you install a new version of node, and must recompile all your C++ addons with the new binary.</p>
|
||||
<p>This command runs the <code>npm build</code> command on the matched folders. This is
|
||||
useful when you install a new version of node, and must recompile all your
|
||||
C++ addons with the new binary. It is also useful when installing with
|
||||
<code>--ignore-scripts</code> and <code>--no-bin-links</code>, to explicitly choose which
|
||||
packages to build and/or link bins.</p>
|
||||
<p>If one or more package names (and optionally version ranges) are provided,
|
||||
then only packages with a name and version matching one of the specifiers
|
||||
will be rebuilt.</p>
|
||||
<h3 id="see-also">See Also</h3>
|
||||
<ul>
|
||||
<li><a href="../commands/npm-build.html">npm build</a></li>
|
||||
<li><a href="../commands/npm-install.html">npm install</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
+3
-3
@@ -149,9 +149,9 @@ npm command-line interface
|
||||
</code></pre>
|
||||
<h3 id="description">Description</h3>
|
||||
<p>This command tries to guess at the likely location of a package’s
|
||||
repository URL, and then tries to open it using the <code>--browser</code>
|
||||
config param. If no package name is provided, it will search for
|
||||
a <code>package.json</code> in the current folder and use the <code>name</code> property.</p>
|
||||
repository URL, and then tries to open it using the <code>--browser</code> config
|
||||
param. If no package name is provided, it will search for a <code>package.json</code>
|
||||
in the current folder and use the <code>repository</code> property.</p>
|
||||
<h3 id="configuration">Configuration</h3>
|
||||
<h4 id="browser">browser</h4>
|
||||
<ul>
|
||||
|
||||
+11
-10
@@ -141,32 +141,33 @@ npm command-line interface
|
||||
|
||||
<section id="table_of_contents">
|
||||
<h2 id="table-of-contents">Table of contents</h2>
|
||||
<div id="_table_of_contents"><ul><li><a href="#synopsis">Synopsis</a></li><li><a href="#description">Description</a></li><li><a href="#note">Note</a></li><li><a href="#see-also">See Also</a></li></ul></div>
|
||||
<div id="_table_of_contents"><ul><li><a href="#synopsis">Synopsis</a></li><li><a href="#description">Description</a></li><li><a href="#see-also">See Also</a></li></ul></div>
|
||||
</section>
|
||||
|
||||
<div id="_content"><h3 id="synopsis">Synopsis</h3>
|
||||
<pre lang="bash"><code>npm restart [-- <args>]
|
||||
</code></pre>
|
||||
<h3 id="description">Description</h3>
|
||||
<p>This restarts a package.</p>
|
||||
<p>This runs a package’s “stop”, “restart”, and “start” scripts, and associated
|
||||
pre- and post- scripts, in the order given below:</p>
|
||||
<p>This restarts a project. It is equivalent to running <code>npm run-script restart</code>.</p>
|
||||
<p>If the current project has a <code>"restart"</code> script specified in
|
||||
<code>package.json</code>, then the following scripts will be run:</p>
|
||||
<ol>
|
||||
<li>prerestart</li>
|
||||
<li>restart</li>
|
||||
<li>postrestart</li>
|
||||
</ol>
|
||||
<p>If it does <em>not</em> have a <code>"restart"</code> script specified, but it does have
|
||||
<code>stop</code> and/or <code>start</code> scripts, then the following scripts will be run:</p>
|
||||
<ol>
|
||||
<li>prerestart</li>
|
||||
<li>prestop</li>
|
||||
<li>stop</li>
|
||||
<li>poststop</li>
|
||||
<li>restart</li>
|
||||
<li>prestart</li>
|
||||
<li>start</li>
|
||||
<li>poststart</li>
|
||||
<li>postrestart</li>
|
||||
</ol>
|
||||
<h3 id="note">Note</h3>
|
||||
<p>Note that the “restart” script is run <strong>in addition to</strong> the “stop”
|
||||
and “start” scripts, not instead of them.</p>
|
||||
<p>This is the behavior as of <code>npm</code> major version 2. A change in this
|
||||
behavior will be accompanied by an increase in major version number</p>
|
||||
<h3 id="see-also">See Also</h3>
|
||||
<ul>
|
||||
<li><a href="../commands/npm-run-script.html">npm run-script</a></li>
|
||||
|
||||
+6
@@ -149,6 +149,12 @@ npm command-line interface
|
||||
</code></pre>
|
||||
<h3 id="description">Description</h3>
|
||||
<p>Print the effective <code>node_modules</code> folder to standard out.</p>
|
||||
<p>Useful for using npm in shell scripts that do things with the
|
||||
<code>node_modules</code> folder. For example:</p>
|
||||
<pre lang="bash"><code>#!/bin/bash
|
||||
global_node_modules="$(npm root --global)"
|
||||
echo "Global packages installed in: ${global_node_modules}"
|
||||
</code></pre>
|
||||
<h3 id="see-also">See Also</h3>
|
||||
<ul>
|
||||
<li><a href="../commands/npm-prefix.html">npm prefix</a></li>
|
||||
|
||||
+19
-21
@@ -145,20 +145,20 @@ npm command-line interface
|
||||
</section>
|
||||
|
||||
<div id="_content"><h3 id="synopsis">Synopsis</h3>
|
||||
<pre lang="bash"><code>npm run-script <command> [--silent] [-- <args>...]
|
||||
<pre lang="bash"><code>npm run-script <command> [--if-present] [--silent] [-- <args>]
|
||||
|
||||
alias: npm run
|
||||
aliases: run, rum, urn
|
||||
</code></pre>
|
||||
<h3 id="description">Description</h3>
|
||||
<p>This runs an arbitrary command from a package’s <code>"scripts"</code> object. If no
|
||||
<code>"command"</code> is provided, it will list the available scripts. <code>run[-script]</code> is
|
||||
used by the test, start, restart, and stop commands, but can be called
|
||||
directly, as well. When the scripts in the package are printed out, they’re
|
||||
separated into lifecycle (test, start, restart) and directly-run scripts.</p>
|
||||
<p>As of <a href="https://blog.npmjs.org/post/98131109725/npm-2-0-0"><code>npm@2.0.0</code></a>, you can
|
||||
use custom arguments when executing scripts. The special option <code>--</code> is used by
|
||||
<a href="https://goo.gl/KxMmtG">getopt</a> to delimit the end of the options. npm will pass
|
||||
all the arguments after the <code>--</code> directly to your script:</p>
|
||||
<code>"command"</code> is provided, it will list the available scripts.</p>
|
||||
<p><code>run[-script]</code> is used by the test, start, restart, and stop commands, but
|
||||
can be called directly, as well. When the scripts in the package are
|
||||
printed out, they’re separated into lifecycle (test, start, restart) and
|
||||
directly-run scripts.</p>
|
||||
<p>Any positional arguments are passed to the specified script. Use <code>--</code> to
|
||||
pass <code>-</code>-prefixed flags and options which would otherwise be parsed by npm.</p>
|
||||
<p>For example:</p>
|
||||
<pre lang="bash"><code>npm run test -- --grep="pattern"
|
||||
</code></pre>
|
||||
<p>The arguments will only be passed to the script specified after <code>npm run</code>
|
||||
@@ -168,23 +168,21 @@ environment variables that will be available to the script at runtime. If an
|
||||
“env” command is defined in your package, it will take precedence over the
|
||||
built-in.</p>
|
||||
<p>In addition to the shell’s pre-existing <code>PATH</code>, <code>npm run</code> adds
|
||||
<code>node_modules/.bin</code> to the <code>PATH</code> provided to scripts. Any binaries provided by
|
||||
locally-installed dependencies can be used without the <code>node_modules/.bin</code>
|
||||
prefix. For example, if there is a <code>devDependency</code> on <code>tap</code> in your package,
|
||||
you should write:</p>
|
||||
<pre lang="bash"><code>"scripts": {"test": "tap test/\*.js"}
|
||||
<code>node_modules/.bin</code> to the <code>PATH</code> provided to scripts. Any binaries
|
||||
provided by locally-installed dependencies can be used without the
|
||||
<code>node_modules/.bin</code> prefix. For example, if there is a <code>devDependency</code> on
|
||||
<code>tap</code> in your package, you should write:</p>
|
||||
<pre lang="bash"><code>"scripts": {"test": "tap test/*.js"}
|
||||
</code></pre>
|
||||
<p>instead of</p>
|
||||
<pre lang="bash"><code>"scripts": {"test": "node_modules/.bin/tap test/\*.js"}
|
||||
<pre lang="bash"><code>"scripts": {"test": "node_modules/.bin/tap test/*.js"}
|
||||
</code></pre>
|
||||
<p>to run your tests.</p>
|
||||
<p>The actual shell your script is run within is platform dependent. By default,
|
||||
on Unix-like systems it is the <code>/bin/sh</code> command, on Windows it is the <code>cmd.exe</code>.
|
||||
The actual shell referred to by <code>/bin/sh</code> also depends on the system.
|
||||
As of <a href="https://github.com/npm/npm/releases/tag/v5.1.0"><code>npm@5.1.0</code></a> you can
|
||||
customize the shell with the <code>script-shell</code> configuration.</p>
|
||||
<p>Scripts are run from the root of the module, regardless of what your current
|
||||
working directory is when you call <code>npm run</code>. If you want your script to
|
||||
You can customize the shell with the <code>script-shell</code> configuration.</p>
|
||||
<p>Scripts are run from the root of the module, regardless of what the current
|
||||
working directory is when <code>npm run</code> is called. If you want your script to
|
||||
use different behavior based on what subdirectory you’re in, you can use the
|
||||
<code>INIT_CWD</code> environment variable, which holds the full path you were in when
|
||||
you ran <code>npm run</code>.</p>
|
||||
|
||||
+1
-1
@@ -148,7 +148,7 @@ npm command-line interface
|
||||
<pre lang="bash"><code>npm <command> [args]
|
||||
</code></pre>
|
||||
<h3 id="version">Version</h3>
|
||||
<p>7.1.1</p>
|
||||
<p>7.1.2</p>
|
||||
<h3 id="description">Description</h3>
|
||||
<p>npm is the package manager for the Node JavaScript platform. It puts
|
||||
modules in place so that node can find them, and manages dependency
|
||||
|
||||
+34
-40
@@ -176,69 +176,63 @@ git+http://user@hostname/project/blah.git#commit-ish
|
||||
git+https://user@hostname/project/blah.git#commit-ish
|
||||
</code></pre>
|
||||
<p>The <code>commit-ish</code> can be any tag, sha, or branch which can be supplied as
|
||||
an argument to <code>git checkout</code>. The default is <code>master</code>.</p>
|
||||
an argument to <code>git checkout</code>. The default is whatever the repository uses
|
||||
as its default branch.</p>
|
||||
<h3 id="the-packagejson-file">The package.json File</h3>
|
||||
<p>You need to have a <code>package.json</code> file in the root of your project to do
|
||||
much of anything with npm. That is basically the whole interface.</p>
|
||||
<p>See <a href="../configuring-npm/package-json.html"><code>package.json</code></a> for details about what goes in that file. At the very
|
||||
least, you need:</p>
|
||||
<p>See <a href="../configuring-npm/package-json.html"><code>package.json</code></a> for details about what
|
||||
goes in that file. At the very least, you need:</p>
|
||||
<ul>
|
||||
<li>
|
||||
<p>name:
|
||||
This should be a string that identifies your project. Please do not
|
||||
use the name to specify that it runs on node, or is in JavaScript.
|
||||
You can use the “engines” field to explicitly state the versions of
|
||||
node (or whatever else) that your program requires, and it’s pretty
|
||||
well assumed that it’s JavaScript.</p>
|
||||
<p>name: This should be a string that identifies your project. Please do
|
||||
not use the name to specify that it runs on node, or is in JavaScript.
|
||||
You can use the “engines” field to explicitly state the versions of node
|
||||
(or whatever else) that your program requires, and it’s pretty well
|
||||
assumed that it’s JavaScript.</p>
|
||||
<p>It does not necessarily need to match your github repository name.</p>
|
||||
<p>So, <code>node-foo</code> and <code>bar-js</code> are bad names. <code>foo</code> or <code>bar</code> are better.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>version:
|
||||
A semver-compatible version.</p>
|
||||
<p>version: A semver-compatible version.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>engines:
|
||||
Specify the versions of node (or whatever else) that your program
|
||||
runs on. The node API changes a lot, and there may be bugs or new
|
||||
functionality that you depend on. Be explicit.</p>
|
||||
<p>engines: Specify the versions of node (or whatever else) that your
|
||||
program runs on. The node API changes a lot, and there may be bugs or
|
||||
new functionality that you depend on. Be explicit.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>author:
|
||||
Take some credit.</p>
|
||||
<p>author: Take some credit.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>scripts:
|
||||
If you have a special compilation or installation script, then you
|
||||
should put it in the <code>scripts</code> object. You should definitely have at
|
||||
least a basic smoke-test command as the “scripts.test” field.
|
||||
See <a href="../using-npm/scripts.html">scripts</a>.</p>
|
||||
<p>scripts: If you have a special compilation or installation script, then
|
||||
you should put it in the <code>scripts</code> object. You should definitely have at
|
||||
least a basic smoke-test command as the “scripts.test” field. See
|
||||
<a href="../using-npm/scripts.html">scripts</a>.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>main:
|
||||
If you have a single module that serves as the entry point to your
|
||||
program (like what the “foo” package gives you at require(“foo”)),
|
||||
then you need to specify that in the “main” field.</p>
|
||||
<p>main: If you have a single module that serves as the entry point to your
|
||||
program (like what the “foo” package gives you at require(“foo”)), then
|
||||
you need to specify that in the “main” field.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>directories:
|
||||
This is an object mapping names to folders. The best ones to include are
|
||||
“lib” and “doc”, but if you use “man” to specify a folder full of man pages,
|
||||
they’ll get installed just like these ones.</p>
|
||||
<p>directories: This is an object mapping names to folders. The best ones
|
||||
to include are “lib” and “doc”, but if you use “man” to specify a folder
|
||||
full of man pages, they’ll get installed just like these ones.</p>
|
||||
</li>
|
||||
</ul>
|
||||
<p>You can use <code>npm init</code> in the root of your package in order to get you
|
||||
started with a pretty basic package.json file. See
|
||||
<a href="../commands/npm-init.html"><code>npm init</code></a> for more info.</p>
|
||||
started with a pretty basic package.json file. See <a href="../commands/npm-init.html"><code>npm init</code></a> for more info.</p>
|
||||
<h3 id="keeping-files-out-of-your-package">Keeping files <em>out</em> of your package</h3>
|
||||
<p>Use a <code>.npmignore</code> file to keep stuff out of your package. If there’s
|
||||
no <code>.npmignore</code> file, but there <em>is</em> a <code>.gitignore</code> file, then npm will
|
||||
ignore the stuff matched by the <code>.gitignore</code> file. If you <em>want</em> to
|
||||
include something that is excluded by your <code>.gitignore</code> file, you can
|
||||
create an empty <code>.npmignore</code> file to override it. Like <code>git</code>, <code>npm</code> looks
|
||||
for <code>.npmignore</code> and <code>.gitignore</code> files in all subdirectories of your
|
||||
package, not only the root directory.</p>
|
||||
<p><code>.npmignore</code> files follow the <a href="https://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository#_ignoring">same pattern rules</a>
|
||||
<p>Use a <code>.npmignore</code> file to keep stuff out of your package. If there’s no
|
||||
<code>.npmignore</code> file, but there <em>is</em> a <code>.gitignore</code> file, then npm will ignore
|
||||
the stuff matched by the <code>.gitignore</code> file. If you <em>want</em> to include
|
||||
something that is excluded by your <code>.gitignore</code> file, you can create an
|
||||
empty <code>.npmignore</code> file to override it. Like <code>git</code>, <code>npm</code> looks for
|
||||
<code>.npmignore</code> and <code>.gitignore</code> files in all subdirectories of your package,
|
||||
not only the root directory.</p>
|
||||
<p><code>.npmignore</code> files follow the <a href="https://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository#_ignoring">same pattern
|
||||
rules</a>
|
||||
as <code>.gitignore</code> files:</p>
|
||||
<ul>
|
||||
<li>Blank lines or lines starting with <code>#</code> are ignored.</li>
|
||||
|
||||
Vendored
-2
@@ -1,5 +1,3 @@
|
||||
'use strict'
|
||||
|
||||
const path = require('path')
|
||||
|
||||
const libaccess = require('libnpmaccess')
|
||||
|
||||
Vendored
-2
@@ -1,5 +1,3 @@
|
||||
'use strict'
|
||||
|
||||
const log = require('npmlog')
|
||||
const npm = require('./npm.js')
|
||||
const output = require('./utils/output.js')
|
||||
|
||||
Vendored
-2
@@ -1,5 +1,3 @@
|
||||
'use strict'
|
||||
|
||||
const log = require('npmlog')
|
||||
const profile = require('npm-profile')
|
||||
|
||||
|
||||
Vendored
-2
@@ -1,5 +1,3 @@
|
||||
'use strict'
|
||||
|
||||
// XXX: To date, npm Enterprise Legacy is the only system that ever
|
||||
// implemented support for this type of login. A better way to do
|
||||
// SSO is to use the WebLogin type of login supported by the npm-login
|
||||
|
||||
Vendored
+23
@@ -2,6 +2,7 @@ const util = require('util')
|
||||
const Arborist = require('@npmcli/arborist')
|
||||
const rimraf = util.promisify(require('rimraf'))
|
||||
const reifyFinish = require('./utils/reify-finish.js')
|
||||
const runScript = require('@npmcli/run-script')
|
||||
|
||||
const log = require('npmlog')
|
||||
const npm = require('./npm.js')
|
||||
@@ -20,6 +21,7 @@ const ci = async () => {
|
||||
}
|
||||
|
||||
const where = npm.prefix
|
||||
const { scriptShell } = npm.flatOptions
|
||||
const arb = new Arborist({ ...npm.flatOptions, path: where })
|
||||
|
||||
await Promise.all([
|
||||
@@ -35,6 +37,27 @@ const ci = async () => {
|
||||
])
|
||||
// npm ci should never modify the lockfile or package.json
|
||||
await arb.reify({ ...npm.flatOptions, save: false })
|
||||
|
||||
// run the same set of scripts that `npm install` runs.
|
||||
const scripts = [
|
||||
'preinstall',
|
||||
'install',
|
||||
'postinstall',
|
||||
'prepublish', // XXX should we remove this finally??
|
||||
'preprepare',
|
||||
'prepare',
|
||||
'postprepare',
|
||||
]
|
||||
for (const event of scripts) {
|
||||
await runScript({
|
||||
path: where,
|
||||
args: [],
|
||||
scriptShell,
|
||||
stdio: 'inherit',
|
||||
stdioString: true,
|
||||
event,
|
||||
})
|
||||
}
|
||||
await reifyFinish(arb)
|
||||
}
|
||||
|
||||
|
||||
Vendored
+7
-25
@@ -53,7 +53,7 @@ const cmd = (args, cb) => compl(args).then(() => cb()).catch(cb)
|
||||
|
||||
// completion for the completion command
|
||||
const completion = async (opts, cb) => {
|
||||
if (opts.w > 3)
|
||||
if (opts.w > 2)
|
||||
return cb()
|
||||
|
||||
const { resolve } = require('path')
|
||||
@@ -63,12 +63,12 @@ const completion = async (opts, cb) => {
|
||||
])
|
||||
const out = []
|
||||
if (zshExists)
|
||||
out.push('~/.zshrc')
|
||||
out.push(['>>', '~/.zshrc'])
|
||||
|
||||
if (bashExists)
|
||||
out.push('~/.bashrc')
|
||||
out.push(['>>', '~/.bashrc'])
|
||||
|
||||
cb(null, opts.w === 2 ? out.map(m => ['>>', m]) : out)
|
||||
cb(null, out)
|
||||
}
|
||||
|
||||
const compl = async args => {
|
||||
@@ -88,14 +88,11 @@ const compl = async args => {
|
||||
return dumpScript()
|
||||
|
||||
// ok we're actually looking at the envs and outputting the suggestions
|
||||
console.error({ COMP_CWORD, COMP_LINE, COMP_POINT })
|
||||
|
||||
// get the partial line and partial word,
|
||||
// if the point isn't at the end.
|
||||
// ie, tabbing at: npm foo b|ar
|
||||
const w = +COMP_CWORD
|
||||
const words = args.map(unescape)
|
||||
console.error({ words, args, w })
|
||||
const word = words[w]
|
||||
const line = COMP_LINE
|
||||
const point = +COMP_POINT
|
||||
@@ -104,8 +101,6 @@ const compl = async args => {
|
||||
|
||||
// figure out where in that last word the point is.
|
||||
const partialWordRaw = args[w]
|
||||
console.error('partial word (args[%i])', w, partialWordRaw, args)
|
||||
|
||||
let i = partialWordRaw.length
|
||||
while (partialWordRaw.substr(0, i) !== partialLine.substr(-1 * i) && i > 0)
|
||||
i--
|
||||
@@ -126,7 +121,6 @@ const compl = async args => {
|
||||
raw: args,
|
||||
}
|
||||
|
||||
console.error(opts)
|
||||
const wrap = getWrap(opts)
|
||||
|
||||
if (partialWords.slice(0, -1).indexOf('--') === -1) {
|
||||
@@ -138,7 +132,6 @@ const compl = async args => {
|
||||
!isFlag(words[w - 1])) {
|
||||
// awaiting a value for a non-bool config.
|
||||
// don't even try to do this for now
|
||||
console.error('configValueCompl')
|
||||
return wrap(configValueCompl(opts))
|
||||
}
|
||||
}
|
||||
@@ -151,9 +144,7 @@ const compl = async args => {
|
||||
const parsed = opts.conf =
|
||||
nopt(types, shorthands, partialWords.slice(0, -1), 0)
|
||||
// check if there's a command already.
|
||||
console.error('PARSED', parsed)
|
||||
const cmd = parsed.argv.remain[1]
|
||||
console.error('CMD', cmd)
|
||||
if (!cmd)
|
||||
return wrap(cmdCompl(opts))
|
||||
|
||||
@@ -225,20 +216,15 @@ const escape = w => !/\s+/.test(w) ? w
|
||||
// Ie, returning ['a', 'b c', ['d', 'e']] would allow it to expand
|
||||
// to: 'a', 'b c', or 'd' 'e'
|
||||
const getWrap = opts => compls => {
|
||||
console.error('WRAP', opts, compls)
|
||||
|
||||
if (!Array.isArray(compls))
|
||||
compls = compls ? [compls] : []
|
||||
|
||||
compls = compls.map(c =>
|
||||
Array.isArray(c) ? c.map(escape).join(' ') : escape(c))
|
||||
|
||||
if (opts.partialWord) {
|
||||
console.error('HAS PARTIAL WORD', opts.partialWord, compls)
|
||||
if (opts.partialWord)
|
||||
compls = compls.filter(c => c.startsWith(opts.partialWord))
|
||||
}
|
||||
|
||||
console.error(compls, opts.partialWord)
|
||||
if (compls.length > 0)
|
||||
output(compls.join('\n'))
|
||||
}
|
||||
@@ -251,7 +237,6 @@ const configCompl = opts => {
|
||||
const dashes = split[1]
|
||||
const no = split[2]
|
||||
const flags = configNames.filter(isFlag)
|
||||
console.error(flags)
|
||||
return allConfs.map(c => dashes + c)
|
||||
.concat(flags.map(f => dashes + (no || 'no-') + f))
|
||||
}
|
||||
@@ -276,17 +261,14 @@ const isFlag = word => {
|
||||
// complete against the npm commands
|
||||
// if they all resolve to the same thing, just return the thing it already is
|
||||
const cmdCompl = opts => {
|
||||
console.error('CMD COMPL', opts.partialWord)
|
||||
const matches = fullList.filter(c => c.startsWith(opts.partialWord))
|
||||
console.error('MATCHES', matches)
|
||||
if (!matches.length)
|
||||
return matches
|
||||
|
||||
const derefs = new Set([...matches.map(c => deref(c))])
|
||||
if (derefs.size === 1) {
|
||||
console.error('ONLY ONE MATCH', derefs)
|
||||
if (derefs.size === 1)
|
||||
return [...derefs]
|
||||
}
|
||||
|
||||
return fullList
|
||||
}
|
||||
|
||||
|
||||
Vendored
-2
@@ -1,5 +1,3 @@
|
||||
'use strict'
|
||||
|
||||
const npm = require('./npm.js')
|
||||
const fetch = require('npm-registry-fetch')
|
||||
const otplease = require('./utils/otplease.js')
|
||||
|
||||
Vendored
-2
@@ -1,5 +1,3 @@
|
||||
'use strict'
|
||||
|
||||
const log = require('npmlog')
|
||||
const npa = require('npm-package-arg')
|
||||
const regFetch = require('npm-registry-fetch')
|
||||
|
||||
Vendored
+2
-2
@@ -20,7 +20,7 @@ const checkPing = async () => {
|
||||
if (/^E\d{3}$/.test(er.code || ''))
|
||||
throw er.code.substr(1) + ' ' + er.message
|
||||
else
|
||||
throw er
|
||||
throw er.message
|
||||
} finally {
|
||||
tracker.finish()
|
||||
}
|
||||
@@ -92,7 +92,7 @@ const lstat = promisify(fs.lstat)
|
||||
const readdir = promisify(fs.readdir)
|
||||
const access = promisify(fs.access)
|
||||
const isWindows = require('./utils/is-windows.js')
|
||||
const checkFilesPermission = async (root, shouldOwn = true, mask = null) => {
|
||||
const checkFilesPermission = async (root, shouldOwn, mask = null) => {
|
||||
if (mask === null)
|
||||
mask = shouldOwn ? R_OK | W_OK : R_OK
|
||||
|
||||
|
||||
Vendored
-2
@@ -1,5 +1,3 @@
|
||||
'use strict'
|
||||
|
||||
const initJson = require('init-package-json')
|
||||
const npa = require('npm-package-arg')
|
||||
|
||||
|
||||
Vendored
-1
@@ -1,4 +1,3 @@
|
||||
'use strict'
|
||||
/* eslint-disable camelcase */
|
||||
/* eslint-disable standard/no-callback-literal */
|
||||
const fs = require('fs')
|
||||
|
||||
Vendored
-2
@@ -1,5 +1,3 @@
|
||||
'use strict'
|
||||
|
||||
const { readdir } = require('fs')
|
||||
const { resolve } = require('path')
|
||||
|
||||
|
||||
Vendored
-2
@@ -1,5 +1,3 @@
|
||||
'use strict'
|
||||
|
||||
const eu = encodeURIComponent
|
||||
const log = require('npmlog')
|
||||
const getAuth = require('npm-registry-fetch/auth.js')
|
||||
|
||||
Vendored
-2
@@ -1,5 +1,3 @@
|
||||
'use strict'
|
||||
|
||||
const { resolve } = require('path')
|
||||
const { EOL } = require('os')
|
||||
|
||||
|
||||
Vendored
-2
@@ -1,5 +1,3 @@
|
||||
'use strict'
|
||||
|
||||
const liborg = require('libnpmorg')
|
||||
const npm = require('./npm.js')
|
||||
const output = require('./utils/output.js')
|
||||
|
||||
Vendored
-2
@@ -1,5 +1,3 @@
|
||||
'use strict'
|
||||
|
||||
const os = require('os')
|
||||
const path = require('path')
|
||||
const pacote = require('pacote')
|
||||
|
||||
Vendored
-2
@@ -1,5 +1,3 @@
|
||||
'use strict'
|
||||
|
||||
const log = require('npmlog')
|
||||
const npa = require('npm-package-arg')
|
||||
const npmFetch = require('npm-registry-fetch')
|
||||
|
||||
Vendored
-2
@@ -1,5 +1,3 @@
|
||||
'use strict'
|
||||
|
||||
const ansistyles = require('ansistyles')
|
||||
const inspect = require('util').inspect
|
||||
const log = require('npmlog')
|
||||
|
||||
Vendored
-2
@@ -1,5 +1,3 @@
|
||||
'use strict'
|
||||
|
||||
const util = require('util')
|
||||
const log = require('npmlog')
|
||||
const semver = require('semver')
|
||||
|
||||
Vendored
-2
@@ -1,5 +1,3 @@
|
||||
'use strict'
|
||||
|
||||
const { resolve } = require('path')
|
||||
const Arborist = require('@npmcli/arborist')
|
||||
const npa = require('npm-package-arg')
|
||||
|
||||
Vendored
+40
-37
@@ -1,27 +1,23 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = exports = search
|
||||
|
||||
const Minipass = require('minipass')
|
||||
const Pipeline = require('minipass-pipeline')
|
||||
|
||||
const npm = require('./npm.js')
|
||||
const formatPackageStream = require('./search/format-package-stream.js')
|
||||
|
||||
const libSearch = require('libnpmsearch')
|
||||
const log = require('npmlog')
|
||||
const output = require('./utils/output.js')
|
||||
const usage = require('./utils/usage')
|
||||
|
||||
search.usage = usage(
|
||||
const formatPackageStream = require('./search/format-package-stream.js')
|
||||
const packageFilter = require('./search/package-filter.js')
|
||||
const npm = require('./npm.js')
|
||||
const output = require('./utils/output.js')
|
||||
const usageUtil = require('./utils/usage.js')
|
||||
const completion = require('./utils/completion/none.js')
|
||||
|
||||
const usage = usageUtil(
|
||||
'search',
|
||||
'npm search [--long] [search terms ...]'
|
||||
)
|
||||
|
||||
search.completion = function (opts, cb) {
|
||||
cb(null, [])
|
||||
}
|
||||
const cmd = (args, cb) => search(args).then(() => cb()).catch(cb)
|
||||
|
||||
function search (args, cb) {
|
||||
const search = async (args) => {
|
||||
const opts = {
|
||||
...npm.flatOptions,
|
||||
...npm.flatOptions.search,
|
||||
@@ -30,22 +26,33 @@ function search (args, cb) {
|
||||
}
|
||||
|
||||
if (opts.include.length === 0)
|
||||
return cb(new Error('search must be called with arguments'))
|
||||
throw new Error('search must be called with arguments')
|
||||
|
||||
// Used later to figure out whether we had any packages go out
|
||||
let anyOutput = false
|
||||
|
||||
class FilterStream extends Minipass {
|
||||
write (pkg) {
|
||||
if (packageFilter(pkg, opts.include, opts.exclude))
|
||||
super.write(pkg)
|
||||
}
|
||||
}
|
||||
|
||||
const filterStream = new FilterStream()
|
||||
|
||||
// Grab a configured output stream that will spit out packages in the
|
||||
// desired format.
|
||||
//
|
||||
// This is a text minipass stream
|
||||
var outputStream = formatPackageStream({
|
||||
const outputStream = formatPackageStream({
|
||||
args, // --searchinclude options are not highlighted
|
||||
...opts,
|
||||
})
|
||||
|
||||
log.silly('search', 'searching packages')
|
||||
const p = new Pipeline(libSearch.stream(opts.include, opts), outputStream)
|
||||
const p = new Pipeline(
|
||||
libSearch.stream(opts.include, opts),
|
||||
filterStream,
|
||||
outputStream
|
||||
)
|
||||
|
||||
p.on('data', chunk => {
|
||||
if (!anyOutput)
|
||||
@@ -53,24 +60,18 @@ function search (args, cb) {
|
||||
output(chunk.toString('utf8'))
|
||||
})
|
||||
|
||||
p.promise().then(() => {
|
||||
if (!anyOutput && !opts.json && !opts.parseable)
|
||||
output('No matches found for ' + (args.map(JSON.stringify).join(' ')))
|
||||
await p.promise()
|
||||
if (!anyOutput && !opts.json && !opts.parseable)
|
||||
output('No matches found for ' + (args.map(JSON.stringify).join(' ')))
|
||||
|
||||
log.silly('search', 'search completed')
|
||||
log.clearProgress()
|
||||
cb(null, {})
|
||||
}, err => cb(err))
|
||||
log.silly('search', 'search completed')
|
||||
log.clearProgress()
|
||||
}
|
||||
|
||||
function prepareIncludes (args, searchopts) {
|
||||
if (typeof searchopts !== 'string')
|
||||
searchopts = ''
|
||||
return searchopts.split(/\s+/).concat(args).map(function (s) {
|
||||
return s.toLowerCase()
|
||||
}).filter(function (s) {
|
||||
return s
|
||||
})
|
||||
return args
|
||||
.map(s => s.toLowerCase())
|
||||
.filter(s => s)
|
||||
}
|
||||
|
||||
function prepareExcludes (searchexclude) {
|
||||
@@ -80,7 +81,9 @@ function prepareExcludes (searchexclude) {
|
||||
else
|
||||
exclude = []
|
||||
|
||||
return exclude.map(function (s) {
|
||||
return s.toLowerCase()
|
||||
})
|
||||
return exclude
|
||||
.map(s => s.toLowerCase())
|
||||
.filter(s => s)
|
||||
}
|
||||
|
||||
module.exports = Object.assign(cmd, { completion, usage })
|
||||
@@ -1,5 +1,3 @@
|
||||
'use strict'
|
||||
|
||||
// XXX these output classes should not live in here forever. it'd be good to
|
||||
// split them out, perhaps to libnpmsearch
|
||||
|
||||
|
||||
-2
@@ -1,5 +1,3 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = filter
|
||||
function filter (data, include, exclude, opts) {
|
||||
return typeof data === 'object' &&
|
||||
|
||||
Vendored
-2
@@ -1,5 +1,3 @@
|
||||
'use strict'
|
||||
|
||||
const log = require('npmlog')
|
||||
const usageUtil = require('./utils/usage.js')
|
||||
const { localPrefix } = require('./npm.js')
|
||||
|
||||
Vendored
-2
@@ -1,5 +1,3 @@
|
||||
'use strict'
|
||||
|
||||
const { resolve, basename } = require('path')
|
||||
const { promises: { unlink } } = require('fs')
|
||||
const Arborist = require('@npmcli/arborist')
|
||||
|
||||
Vendored
-2
@@ -1,5 +1,3 @@
|
||||
'use strict'
|
||||
|
||||
const fetch = require('npm-registry-fetch')
|
||||
const log = require('npmlog')
|
||||
const npa = require('npm-package-arg')
|
||||
|
||||
Vendored
-2
@@ -1,5 +1,3 @@
|
||||
'use strict'
|
||||
|
||||
const log = require('npmlog')
|
||||
const fetch = require('npm-registry-fetch')
|
||||
|
||||
|
||||
Vendored
+9
-8
@@ -1,11 +1,12 @@
|
||||
const columns = require('cli-columns')
|
||||
const libteam = require('libnpmteam')
|
||||
|
||||
const npm = require('./npm.js')
|
||||
const output = require('./utils/output.js')
|
||||
const otplease = require('./utils/otplease.js')
|
||||
const usageUtil = require('./utils/usage')
|
||||
|
||||
const subcommands = ['create', 'destroy', 'add', 'rm', 'ls', 'edit']
|
||||
const subcommands = ['create', 'destroy', 'add', 'rm', 'ls']
|
||||
|
||||
const usage = usageUtil(
|
||||
'team',
|
||||
@@ -13,8 +14,7 @@ const usage = usageUtil(
|
||||
'npm team destroy <scope:team> [--otp <otpcode>]\n' +
|
||||
'npm team add <scope:team> <user> [--otp <otpcode>]\n' +
|
||||
'npm team rm <scope:team> <user> [--otp <otpcode>]\n' +
|
||||
'npm team ls <scope>|<scope:team>\n' +
|
||||
'npm team edit <scope:team>'
|
||||
'npm team ls <scope>|<scope:team>\n'
|
||||
)
|
||||
|
||||
const completion = (opts, cb) => {
|
||||
@@ -28,7 +28,6 @@ const completion = (opts, cb) => {
|
||||
case 'destroy':
|
||||
case 'add':
|
||||
case 'rm':
|
||||
case 'edit':
|
||||
return cb(null, [])
|
||||
default:
|
||||
return cb(new Error(argv[2] + ' not recognized'))
|
||||
@@ -56,8 +55,6 @@ const team = async ([cmd, entity = '', user = '']) => {
|
||||
else
|
||||
return teamListTeams(entity, opts)
|
||||
}
|
||||
case 'edit':
|
||||
throw new Error('`npm team edit` is not implemented yet.')
|
||||
default:
|
||||
throw usage
|
||||
}
|
||||
@@ -125,7 +122,9 @@ const teamListUsers = async (entity, opts) => {
|
||||
else if (opts.parseable)
|
||||
output(users.join('\n'))
|
||||
else if (!opts.silent && opts.loglevel !== 'silent') {
|
||||
output(`\n@${entity} has ${users.length} user${users.length === 1 ? '' : 's'}:\n`)
|
||||
const plural = users.length === 1 ? '' : 's'
|
||||
const more = users.length === 0 ? '' : ':\n'
|
||||
output(`\n@${entity} has ${users.length} user${plural}${more}`)
|
||||
output(columns(users, { padding: 1 }))
|
||||
}
|
||||
}
|
||||
@@ -137,7 +136,9 @@ const teamListTeams = async (entity, opts) => {
|
||||
else if (opts.parseable)
|
||||
output(teams.join('\n'))
|
||||
else if (!opts.silent && opts.loglevel !== 'silent') {
|
||||
output(`\n@${entity} has ${teams.length} team${teams.length === 1 ? '' : 's'}:\n`)
|
||||
const plural = teams.length === 1 ? '' : 's'
|
||||
const more = teams.length === 0 ? '' : ':\n'
|
||||
output(`\n@${entity} has ${teams.length} team${plural}${more}`)
|
||||
output(columns(teams.map(t => `@${t}`), { padding: 1 }))
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
-2
@@ -1,5 +1,3 @@
|
||||
'use strict'
|
||||
|
||||
const profile = require('npm-profile')
|
||||
const npm = require('./npm.js')
|
||||
const output = require('./utils/output.js')
|
||||
|
||||
Vendored
-2
@@ -1,5 +1,3 @@
|
||||
'use strict'
|
||||
|
||||
const { resolve } = require('path')
|
||||
const Arborist = require('@npmcli/arborist')
|
||||
const rpj = require('read-package-json-fast')
|
||||
|
||||
Vendored
-2
@@ -1,5 +1,3 @@
|
||||
'use strict'
|
||||
|
||||
const path = require('path')
|
||||
const util = require('util')
|
||||
const log = require('npmlog')
|
||||
|
||||
Vendored
-2
@@ -1,5 +1,3 @@
|
||||
'use strict'
|
||||
|
||||
const path = require('path')
|
||||
|
||||
const Arborist = require('@npmcli/arborist')
|
||||
|
||||
Vendored
-1
@@ -1,4 +1,3 @@
|
||||
'use strict'
|
||||
var path = require('path')
|
||||
var validate = require('aproba')
|
||||
var moduleName = require('../utils/module-name.js')
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
'use strict'
|
||||
|
||||
const { resolve } = require('path')
|
||||
const Arborist = require('@npmcli/arborist')
|
||||
const npm = require('../../npm.js')
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
'use strict'
|
||||
var sortedObject = require('sorted-object')
|
||||
|
||||
module.exports = function deepSortObject (obj) {
|
||||
|
||||
Vendored
-2
@@ -1,5 +1,3 @@
|
||||
'use strict'
|
||||
|
||||
let cbCalled = false
|
||||
const log = require('npmlog')
|
||||
const npm = require('../npm.js')
|
||||
|
||||
Vendored
-2
@@ -1,5 +1,3 @@
|
||||
'use strict'
|
||||
|
||||
const npm = require('../npm.js')
|
||||
const { format } = require('util')
|
||||
const { resolve } = require('path')
|
||||
|
||||
Vendored
+7
@@ -27,6 +27,13 @@ const buildOmitList = obj => {
|
||||
omit.add('optional')
|
||||
|
||||
obj.omit = [...omit]
|
||||
|
||||
// it would perhaps make more sense to put this in @npmcli/config, but
|
||||
// since we can set dev to be omitted in multiple various legacy ways,
|
||||
// it's better to set it here once it's all resolved.
|
||||
if (obj.omit.includes('dev'))
|
||||
process.env.NODE_ENV = 'production'
|
||||
|
||||
return [...omit]
|
||||
}
|
||||
|
||||
|
||||
Vendored
-2
@@ -1,5 +1,3 @@
|
||||
'use strict'
|
||||
|
||||
const exec = require('child_process').execFile
|
||||
const spawn = require('./spawn')
|
||||
const npm = require('../npm.js')
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
'use strict'
|
||||
const isWindows = require('./is-windows.js')
|
||||
module.exports = isWindows &&
|
||||
(/^MINGW(32|64)$/.test(process.env.MSYSTEM) || process.env.TERM === 'cygwin')
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
'use strict'
|
||||
const isWindows = require('./is-windows.js')
|
||||
const isWindowsBash = require('./is-windows-bash.js')
|
||||
module.exports = isWindows && !isWindowsBash
|
||||
Vendored
-1
@@ -1,2 +1 @@
|
||||
'use strict'
|
||||
module.exports = process.platform === 'win32'
|
||||
Vendored
-1
@@ -1,4 +1,3 @@
|
||||
'use strict'
|
||||
/* eslint-disable camelcase */
|
||||
module.exports = launchSendMetrics
|
||||
var fs = require('graceful-fs')
|
||||
|
||||
Vendored
-1
@@ -1,4 +1,3 @@
|
||||
'use strict'
|
||||
exports.start = startMetrics
|
||||
exports.stop = stopMetrics
|
||||
exports.save = saveMetrics
|
||||
|
||||
Vendored
-1
@@ -1,4 +1,3 @@
|
||||
'use strict'
|
||||
var path = require('path')
|
||||
|
||||
module.exports = moduleName
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
'use strict'
|
||||
var log = require('npmlog')
|
||||
var progressEnabled
|
||||
var running = 0
|
||||
|
||||
Vendored
-1
@@ -1,4 +1,3 @@
|
||||
'use strict'
|
||||
const npm = require('../npm.js')
|
||||
const output = require('./output.js')
|
||||
const opener = require('opener')
|
||||
|
||||
Vendored
-2
@@ -1,5 +1,3 @@
|
||||
'use strict'
|
||||
|
||||
const prompt = 'This operation requires a one-time password.\nEnter OTP:'
|
||||
const readUserInfo = require('./read-user-info.js')
|
||||
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
'use strict'
|
||||
const validate = require('aproba')
|
||||
const log = require('npmlog')
|
||||
|
||||
|
||||
-2
@@ -1,5 +1,3 @@
|
||||
'use strict'
|
||||
|
||||
const { resolve } = require('path')
|
||||
const readJson = require('read-package-json-fast')
|
||||
const npm = require('../npm.js')
|
||||
|
||||
Vendored
-1
@@ -1,4 +1,3 @@
|
||||
'use strict'
|
||||
const { promisify } = require('util')
|
||||
const readAsync = promisify(require('read'))
|
||||
const userValidate = require('npm-user-validate')
|
||||
|
||||
Vendored
-2
@@ -1,5 +1,3 @@
|
||||
'use strict'
|
||||
|
||||
const URL = require('url').URL
|
||||
|
||||
// replaces auth info in an array of arguments or in a strings
|
||||
|
||||
Vendored
-1
@@ -1,4 +1,3 @@
|
||||
'use strict'
|
||||
var aliases = require('../utils/cmd-list').aliases
|
||||
|
||||
module.exports = function usage (cmd, txt, opt) {
|
||||
|
||||
Vendored
-2
@@ -1,5 +1,3 @@
|
||||
'use strict'
|
||||
|
||||
const libversion = require('libnpmversion')
|
||||
const npm = require('./npm.js')
|
||||
const output = require('./utils/output.js')
|
||||
|
||||
Vendored
+2
@@ -6,6 +6,8 @@
|
||||
.RS 2
|
||||
.nf
|
||||
npm explain <folder | specifier>
|
||||
|
||||
alias: why
|
||||
.fi
|
||||
.RE
|
||||
.SS Description
|
||||
|
||||
Vendored
+44
-24
@@ -13,43 +13,46 @@ alias: npm ln
|
||||
.RE
|
||||
.SS Description
|
||||
.P
|
||||
This is handy for installing your own stuff, so that you can work on it and
|
||||
test iteratively without having to continually rebuild\.
|
||||
.P
|
||||
Package linking is a two\-step process\.
|
||||
.P
|
||||
First, \fBnpm link\fP in a package folder will create a symlink in the global folder
|
||||
\fB{prefix}/lib/node_modules/<package>\fP that links to the package where the \fBnpm
|
||||
link\fP command was executed\. It will also link any bins in the package to \fB{prefix}/bin/{name}\fP\|\.
|
||||
Note that \fBnpm link\fP uses the global prefix (see \fBnpm prefix \-g\fP for its value)\.
|
||||
First, \fBnpm link\fP in a package folder will create a symlink in the global
|
||||
folder \fB{prefix}/lib/node_modules/<package>\fP that links to the package
|
||||
where the \fBnpm link\fP command was executed\. It will also link any bins in
|
||||
the package to \fB{prefix}/bin/{name}\fP\|\. Note that \fBnpm link\fP uses the global
|
||||
prefix (see \fBnpm prefix \-g\fP for its value)\.
|
||||
.P
|
||||
Next, in some other location, \fBnpm link package\-name\fP will create a
|
||||
symbolic link from globally\-installed \fBpackage\-name\fP to \fBnode_modules/\fP
|
||||
of the current folder\.
|
||||
symbolic link from globally\-installed \fBpackage\-name\fP to \fBnode_modules/\fP of
|
||||
the current folder\.
|
||||
.P
|
||||
Note that \fBpackage\-name\fP is taken from \fBpackage\.json\fP,
|
||||
not from directory name\.
|
||||
Note that \fBpackage\-name\fP is taken from \fBpackage\.json\fP, \fInot\fR from the
|
||||
directory name\.
|
||||
.P
|
||||
The package name can be optionally prefixed with a scope\. See npm help \fBscope\fP\|\.
|
||||
The scope must be preceded by an @\-symbol and followed by a slash\.
|
||||
The package name can be optionally prefixed with a scope\. See
|
||||
npm help \fBscope\fP\|\. The scope must be preceded by an @\-symbol and
|
||||
followed by a slash\.
|
||||
.P
|
||||
When creating tarballs for \fBnpm publish\fP, the linked packages are
|
||||
"snapshotted" to their current state by resolving the symbolic links\.
|
||||
.P
|
||||
This is handy for installing your own stuff, so that you can work on it and
|
||||
test it iteratively without having to continually rebuild\.
|
||||
"snapshotted" to their current state by resolving the symbolic links, if
|
||||
they are included in \fBbundleDependencies\fP\|\.
|
||||
.P
|
||||
For example:
|
||||
.P
|
||||
.RS 2
|
||||
.nf
|
||||
cd ~/projects/node\-redis # go into the package directory
|
||||
npm link # creates global link
|
||||
cd ~/projects/node\-bloggy # go into some other package directory\.
|
||||
npm link redis # link\-install the package
|
||||
cd ~/projects/node\-redis # go into the package directory
|
||||
npm link # creates global link
|
||||
cd ~/projects/node\-bloggy # go into some other package directory\.
|
||||
npm link redis # link\-install the package
|
||||
.fi
|
||||
.RE
|
||||
.P
|
||||
Now, any changes to ~/projects/node\-redis will be reflected in
|
||||
~/projects/node\-bloggy/node_modules/node\-redis/\. Note that the link should
|
||||
be to the package name, not the directory name for that package\.
|
||||
Now, any changes to \fB~/projects/node\-redis\fP will be reflected in
|
||||
\fB~/projects/node\-bloggy/node_modules/node\-redis/\fP\|\. Note that the link
|
||||
should be to the package name, not the directory name for that package\.
|
||||
.P
|
||||
You may also shortcut the two steps in one\. For example, to do the
|
||||
above use\-case in a shorter way:
|
||||
@@ -73,16 +76,33 @@ npm link redis
|
||||
That is, it first creates a global link, and then links the global
|
||||
installation target into your project's \fBnode_modules\fP folder\.
|
||||
.P
|
||||
Note that in this case, you are referring to the directory name, \fBnode\-redis\fP,
|
||||
rather than the package name \fBredis\fP\|\.
|
||||
Note that in this case, you are referring to the directory name,
|
||||
\fBnode\-redis\fP, rather than the package name \fBredis\fP\|\.
|
||||
.P
|
||||
If your linked package is scoped (see npm help \fBscope\fP) your link command must include that scope, e\.g\.
|
||||
If your linked package is scoped (see npm help \fBscope\fP) your
|
||||
link command must include that scope, e\.g\.
|
||||
.P
|
||||
.RS 2
|
||||
.nf
|
||||
npm link @myorg/privatepackage
|
||||
.fi
|
||||
.RE
|
||||
.SS Caveat
|
||||
.P
|
||||
Note that package dependencies linked in this way are \fInot\fR saved to
|
||||
\fBpackage\.json\fP by default, on the assumption that the intention is to have
|
||||
a link stand in for a regular non\-link dependency\. Otherwise, for example,
|
||||
if you depend on \fBredis@^3\.0\.1\fP, and ran \fBnpm link redis\fP, it would replace
|
||||
the \fB^3\.0\.1\fP dependency with \fBfile:\.\./path/to/node\-redis\fP, which you
|
||||
probably don't want! Additionally, other users or developers on your
|
||||
project would run into issues if they do not have their folders set up
|
||||
exactly the same as yours\.
|
||||
.P
|
||||
If you are adding a \fInew\fR dependency as a link, you should add it to the
|
||||
relevant metadata by running \fBnpm install <dep> \-\-package\-lock\-only\fP\|\.
|
||||
.P
|
||||
If you \fIwant\fR to save the \fBfile:\fP reference in your \fBpackage\.json\fP and
|
||||
\fBpackage\-lock\.json\fP files, you can use \fBnpm link <dep> \-\-save\fP to do so\.
|
||||
.SS See Also
|
||||
.RS 0
|
||||
.IP \(bu 2
|
||||
|
||||
Vendored
+6
-6
@@ -10,13 +10,13 @@ npm logout [\-\-registry=<url>] [\-\-scope=<@scope>]
|
||||
.RE
|
||||
.SS Description
|
||||
.P
|
||||
When logged into a registry that supports token\-based authentication, tell the
|
||||
server to end this token's session\. This will invalidate the token everywhere
|
||||
you're using it, not just for the current environment\.
|
||||
When logged into a registry that supports token\-based authentication, tell
|
||||
the server to end this token's session\. This will invalidate the token
|
||||
everywhere you're using it, not just for the current environment\.
|
||||
.P
|
||||
When logged into a legacy registry that uses username and password authentication, this will
|
||||
clear the credentials in your user configuration\. In this case, it will \fIonly\fR affect
|
||||
the current environment\.
|
||||
When logged into a legacy registry that uses username and password
|
||||
authentication, this will clear the credentials in your user configuration\.
|
||||
In this case, it will \fIonly\fR affect the current environment\.
|
||||
.P
|
||||
If \fB\-\-scope\fP is provided, this will find the credentials for the registry
|
||||
connected to that scope, if set\.
|
||||
|
||||
Vendored
+54
-9
@@ -13,18 +13,22 @@ aliases: list, la, ll
|
||||
.SS Description
|
||||
.P
|
||||
This command will print to stdout all the versions of packages that are
|
||||
installed, as well as their dependencies, in a tree\-structure\.
|
||||
installed, as well as their dependencies when \fB\-\-all\fP is specified, in a
|
||||
tree structure\.
|
||||
.P
|
||||
Positional arguments are \fBname@version\-range\fP identifiers, which will
|
||||
limit the results to only the paths to the packages named\. Note that
|
||||
nested packages will \fIalso\fR show the paths to the specified packages\.
|
||||
For example, running \fBnpm ls promzard\fP in npm's source tree will show:
|
||||
Note: to get a "bottoms up" view of why a given package is included in the
|
||||
tree at all, use npm help \fBexplain\fP\|\.
|
||||
.P
|
||||
Positional arguments are \fBname@version\-range\fP identifiers, which will limit
|
||||
the results to only the paths to the packages named\. Note that nested
|
||||
packages will \fIalso\fR show the paths to the specified packages\. For
|
||||
example, running \fBnpm ls promzard\fP in npm's source tree will show:
|
||||
.P
|
||||
.RS 2
|
||||
.nf
|
||||
npm@7\.1\.1 /path/to/npm
|
||||
└─┬ init\-package\-json@0\.0\.4
|
||||
└── promzard@0\.1\.5
|
||||
npm@7\.1\.2 /path/to/npm
|
||||
└─┬ init\-package\-json@0\.0\.4
|
||||
└── promzard@0\.1\.5
|
||||
.fi
|
||||
.RE
|
||||
.P
|
||||
@@ -35,10 +39,49 @@ in parentheses after the name@version to make it easier for users to
|
||||
recognize potential forks of a project\.
|
||||
.P
|
||||
The tree shown is the logical dependency tree, based on package
|
||||
dependencies, not the physical layout of your node_modules folder\.
|
||||
dependencies, not the physical layout of your \fBnode_modules\fP folder\.
|
||||
.P
|
||||
When run as \fBll\fP or \fBla\fP, it shows extended information by default\.
|
||||
.SS Note: Design Changes Pending
|
||||
.P
|
||||
The \fBnpm ls\fP command's output and behavior made a \fIton\fR of sense when npm
|
||||
created a \fBnode_modules\fP folder that naively nested every dependency\. In
|
||||
such a case, the logical dependency graph and physical tree of packages on
|
||||
disk would be roughly identical\.
|
||||
.P
|
||||
With the advent of automatic install\-time deduplication of dependencies in
|
||||
npm v3, the \fBls\fP output was modified to display the logical dependency
|
||||
graph as a tree structure, since this was more useful to most users\.
|
||||
However, without using \fBnpm ls \-l\fP, it became impossible show \fIwhere\fR a
|
||||
package was actually installed much of the time!
|
||||
.P
|
||||
With the advent of automatic installation of \fBpeerDependencies\fP in npm v7,
|
||||
this gets even more curious, as \fBpeerDependencies\fP are logically
|
||||
"underneath" their dependents in the dependency graph, but are always
|
||||
physically at or above their location on disk\.
|
||||
.P
|
||||
Also, in the years since npm got an \fBls\fP command (in version 0\.0\.2!),
|
||||
dependency graphs have gotten much larger as a general rule\. Therefor, in
|
||||
order to avoid dumping an excessive amount of content to the terminal, \fBnpm
|
||||
ls\fP now only shows the \fItop\fR level dependencies, unless \fB\-\-all\fP is
|
||||
provided\.
|
||||
.P
|
||||
A thorough re\-examination of the use cases, intention, behavior, and output
|
||||
of this command, is currently underway\. Expect significant changes to at
|
||||
least the default human\-readable \fBnpm ls\fP output in npm v8\.
|
||||
.SS Configuration
|
||||
.SS all
|
||||
.RS 0
|
||||
.IP \(bu 2
|
||||
Default: \fBfalse\fP
|
||||
.IP \(bu 2
|
||||
Type: Boolean
|
||||
|
||||
.RE
|
||||
.P
|
||||
When running \fBnpm outdated\fP and \fBnpm ls\fP, setting \fB\-\-all\fP will show all
|
||||
outdated or installed packages, rather than only those directly depended
|
||||
upon by the current project\.
|
||||
.SS json
|
||||
.RS 0
|
||||
.IP \(bu 2
|
||||
@@ -142,6 +185,8 @@ Set it to false in order to use all\-ansi output\.
|
||||
.SS See Also
|
||||
.RS 0
|
||||
.IP \(bu 2
|
||||
npm help explain
|
||||
.IP \(bu 2
|
||||
npm help config
|
||||
.IP \(bu 2
|
||||
npm help npmrc
|
||||
|
||||
Vendored
+5
-3
@@ -61,12 +61,14 @@ $ npm org ls my\-org @mx\-santos
|
||||
.RE
|
||||
.SS Description
|
||||
.P
|
||||
You can use the \fBnpm org\fP commands to manage and view users of an organization\.
|
||||
It supports adding and removing users, changing their roles, listing them, and
|
||||
finding specific ones and their roles\.
|
||||
You can use the \fBnpm org\fP commands to manage and view users of an
|
||||
organization\. It supports adding and removing users, changing their roles,
|
||||
listing them, and finding specific ones and their roles\.
|
||||
.SS See Also
|
||||
.RS 0
|
||||
.IP \(bu 2
|
||||
npm help using orgs
|
||||
.IP \(bu 2
|
||||
Documentation on npm Orgs \fIhttps://docs\.npmjs\.com/orgs/\fR
|
||||
|
||||
.RE
|
||||
Vendored
+36
-26
@@ -13,33 +13,42 @@ npm outdated [[<@scope>/]<pkg> \.\.\.]
|
||||
This command will check the registry to see if any (or, specific) installed
|
||||
packages are currently outdated\.
|
||||
.P
|
||||
By default, only the direct dependencies of the root project are shown\.
|
||||
Use \fB\-\-all\fP to find all outdated meta\-dependencies as well\.
|
||||
.P
|
||||
In the output:
|
||||
.RS 0
|
||||
.IP \(bu 2
|
||||
\fBwanted\fP is the maximum version of the package that satisfies the semver
|
||||
range specified in \fBpackage\.json\fP\|\. If there's no available semver range (i\.e\.
|
||||
you're running \fBnpm outdated \-\-global\fP, or the package isn't included in
|
||||
\fBpackage\.json\fP), then \fBwanted\fP shows the currently\-installed version\.
|
||||
range specified in \fBpackage\.json\fP\|\. If there's no available semver range
|
||||
(i\.e\. you're running \fBnpm outdated \-\-global\fP, or the package isn't
|
||||
included in \fBpackage\.json\fP), then \fBwanted\fP shows the currently\-installed
|
||||
version\.
|
||||
.IP \(bu 2
|
||||
\fBlatest\fP is the version of the package tagged as latest in the registry\.
|
||||
Running \fBnpm publish\fP with no special configuration will publish the package
|
||||
with a dist\-tag of \fBlatest\fP\|\. This may or may not be the maximum version of
|
||||
the package, or the most\-recently published version of the package, depending
|
||||
on how the package's developer manages the latest dist\-tag \fInpm\-dist\-tag\fR\|\.
|
||||
Running \fBnpm publish\fP with no special configuration will publish the
|
||||
package with a dist\-tag of \fBlatest\fP\|\. This may or may not be the maximum
|
||||
version of the package, or the most\-recently published version of the
|
||||
package, depending on how the package's developer manages the latest
|
||||
npm help dist\-tag\.
|
||||
.IP \(bu 2
|
||||
\fBlocation\fP is where in the physical tree the package is located\.
|
||||
.IP \(bu 2
|
||||
\fBdepended by\fP shows which package depends on the displayed dependency
|
||||
.IP \(bu 2
|
||||
\fBpackage type\fP (when using \fB\-\-long\fP / \fB\-l\fP) tells you whether this package is
|
||||
a \fBdependency\fP or a dev/peer/optional dependency\. Packages not included in \fBpackage\.json\fP
|
||||
are always marked \fBdependencies\fP\|\.
|
||||
\fBpackage type\fP (when using \fB\-\-long\fP / \fB\-l\fP) tells you whether this
|
||||
package is a \fBdependency\fP or a dev/peer/optional dependency\. Packages not
|
||||
included in \fBpackage\.json\fP are always marked \fBdependencies\fP\|\.
|
||||
.IP \(bu 2
|
||||
\fBhomepage\fP (when using \fB\-\-long\fP / \fB\-l\fP) is the \fBhomepage\fP value contained in the package's packument
|
||||
\fBhomepage\fP (when using \fB\-\-long\fP / \fB\-l\fP) is the \fBhomepage\fP value contained
|
||||
in the package's packument
|
||||
.IP \(bu 2
|
||||
Red means there's a newer version matching your semver requirements, so you should update now\.
|
||||
Red means there's a newer version matching your semver requirements, so
|
||||
you should update now\.
|
||||
.IP \(bu 2
|
||||
Yellow indicates that there's a newer version above your semver requirements (usually new major, or new 0\.x minor) so proceed with caution\.
|
||||
Yellow indicates that there's a newer version \fIabove\fR your semver
|
||||
requirements (usually new major, or new 0\.x minor) so proceed with
|
||||
caution\.
|
||||
|
||||
.RE
|
||||
.SS An example
|
||||
@@ -72,22 +81,23 @@ With these \fBdependencies\fP:
|
||||
A few things to note:
|
||||
.RS 0
|
||||
.IP \(bu 2
|
||||
\fBglob\fP requires \fB^5\fP, which prevents npm from installing \fBglob@6\fP, which is
|
||||
outside the semver range\.
|
||||
\fBglob\fP requires \fB^5\fP, which prevents npm from installing \fBglob@6\fP, which
|
||||
is outside the semver range\.
|
||||
.IP \(bu 2
|
||||
Git dependencies will always be reinstalled, because of how they're specified\.
|
||||
The installed committish might satisfy the dependency specifier (if it's
|
||||
something immutable, like a commit SHA), or it might not, so \fBnpm outdated\fP and
|
||||
\fBnpm update\fP have to fetch Git repos to check\. This is why currently doing a
|
||||
reinstall of a Git dependency always forces a new clone and install\.
|
||||
Git dependencies will always be reinstalled, because of how they're
|
||||
specified\. The installed committish might satisfy the dependency
|
||||
specifier (if it's something immutable, like a commit SHA), or it might
|
||||
not, so \fBnpm outdated\fP and \fBnpm update\fP have to fetch Git repos to check\.
|
||||
This is why currently doing a reinstall of a Git dependency always forces
|
||||
a new clone and install\.
|
||||
.IP \(bu 2
|
||||
\fBnpm@3\.5\.2\fP is marked as "wanted", but "latest" is \fBnpm@3\.5\.1\fP because npm
|
||||
uses dist\-tags to manage its \fBlatest\fP and \fBnext\fP release channels\. \fBnpm update\fP
|
||||
will install the \fInewest\fR version, but \fBnpm install npm\fP (with no semver range)
|
||||
will install whatever's tagged as \fBlatest\fP\|\.
|
||||
\fBnpm@3\.5\.2\fP is marked as "wanted", but "latest" is \fBnpm@3\.5\.1\fP because
|
||||
npm uses dist\-tags to manage its \fBlatest\fP and \fBnext\fP release channels\.
|
||||
\fBnpm update\fP will install the \fInewest\fR version, but \fBnpm install npm\fP
|
||||
(with no semver range) will install whatever's tagged as \fBlatest\fP\|\.
|
||||
.IP \(bu 2
|
||||
\fBonce\fP is just plain out of date\. Reinstalling \fBnode_modules\fP from scratch or
|
||||
running \fBnpm update\fP will bring it up to spec\.
|
||||
\fBonce\fP is just plain out of date\. Reinstalling \fBnode_modules\fP from
|
||||
scratch or running \fBnpm update\fP will bring it up to spec\.
|
||||
|
||||
.RE
|
||||
.SS Configuration
|
||||
|
||||
Vendored
+11
-12
@@ -17,17 +17,14 @@ aliases: author
|
||||
Manage ownership of published packages\.
|
||||
.RS 0
|
||||
.IP \(bu 2
|
||||
ls:
|
||||
List all the users who have access to modify a package and push new versions\.
|
||||
Handy when you need to know who to bug for help\.
|
||||
ls: List all the users who have access to modify a package and push new
|
||||
versions\. Handy when you need to know who to bug for help\.
|
||||
.IP \(bu 2
|
||||
add:
|
||||
Add a new user as a maintainer of a package\. This user is enabled to modify
|
||||
metadata, publish new versions, and add other owners\.
|
||||
add: Add a new user as a maintainer of a package\. This user is enabled
|
||||
to modify metadata, publish new versions, and add other owners\.
|
||||
.IP \(bu 2
|
||||
rm:
|
||||
Remove a user from the package owner list\. This immediately revokes their
|
||||
privileges\.
|
||||
rm: Remove a user from the package owner list\. This immediately revokes
|
||||
their privileges\.
|
||||
|
||||
.RE
|
||||
.P
|
||||
@@ -35,12 +32,14 @@ Note that there is only one level of access\. Either you can modify a package,
|
||||
or you can't\. Future versions may contain more fine\-grained access levels, but
|
||||
that is not implemented at this time\.
|
||||
.P
|
||||
If you have two\-factor authentication enabled with \fBauth\-and\-writes\fP then
|
||||
you'll need to include an otp on the command line when changing ownership
|
||||
with \fB\-\-otp\fP\|\.
|
||||
If you have two\-factor authentication enabled with \fBauth\-and\-writes\fP (see
|
||||
npm help \fBnpm\-profile\fP) then you'll need to include an otp
|
||||
on the command line when changing ownership with \fB\-\-otp\fP\|\.
|
||||
.SS See Also
|
||||
.RS 0
|
||||
.IP \(bu 2
|
||||
npm help profile
|
||||
.IP \(bu 2
|
||||
npm help publish
|
||||
.IP \(bu 2
|
||||
npm help registry
|
||||
|
||||
Loaded 100 of 135 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user