mirror of
https://github.com/S2-/minifyfromhtml.git
synced 2025-08-04 04:40:05 +02:00
update packages to latest version
This commit is contained in:
181
node_modules/npm/doc/misc/npm-coding-style.md
generated
vendored
Normal file
181
node_modules/npm/doc/misc/npm-coding-style.md
generated
vendored
Normal file
@@ -0,0 +1,181 @@
|
||||
npm-coding-style(7) -- npm's "funny" coding style
|
||||
=================================================
|
||||
|
||||
## DESCRIPTION
|
||||
|
||||
npm's coding style is a bit unconventional. It is not different for
|
||||
difference's sake, but rather a carefully crafted style that is
|
||||
designed to reduce visual clutter and make bugs more apparent.
|
||||
|
||||
If you want to contribute to npm (which is very encouraged), you should
|
||||
make your code conform to npm's style.
|
||||
|
||||
Note: this concerns npm's code not the specific packages that you can download from the npm registry.
|
||||
|
||||
## Line Length
|
||||
|
||||
Keep lines shorter than 80 characters. It's better for lines to be
|
||||
too short than to be too long. Break up long lists, objects, and other
|
||||
statements onto multiple lines.
|
||||
|
||||
## Indentation
|
||||
|
||||
Two-spaces. Tabs are better, but they look like hell in web browsers
|
||||
(and on GitHub), and node uses 2 spaces, so that's that.
|
||||
|
||||
Configure your editor appropriately.
|
||||
|
||||
## Curly braces
|
||||
|
||||
Curly braces belong on the same line as the thing that necessitates them.
|
||||
|
||||
Bad:
|
||||
|
||||
function ()
|
||||
{
|
||||
|
||||
Good:
|
||||
|
||||
function () {
|
||||
|
||||
If a block needs to wrap to the next line, use a curly brace. Don't
|
||||
use it if it doesn't.
|
||||
|
||||
Bad:
|
||||
|
||||
if (foo) { bar() }
|
||||
while (foo)
|
||||
bar()
|
||||
|
||||
Good:
|
||||
|
||||
if (foo) bar()
|
||||
while (foo) {
|
||||
bar()
|
||||
}
|
||||
|
||||
## Semicolons
|
||||
|
||||
Don't use them except in four situations:
|
||||
|
||||
* `for (;;)` loops. They're actually required.
|
||||
* null loops like: `while (something) ;` (But you'd better have a good
|
||||
reason for doing that.)
|
||||
* `case "foo": doSomething(); break`
|
||||
* In front of a leading `(` or `[` at the start of the line.
|
||||
This prevents the expression from being interpreted
|
||||
as a function call or property access, respectively.
|
||||
|
||||
Some examples of good semicolon usage:
|
||||
|
||||
;(x || y).doSomething()
|
||||
;[a, b, c].forEach(doSomething)
|
||||
for (var i = 0; i < 10; i ++) {
|
||||
switch (state) {
|
||||
case "begin": start(); continue
|
||||
case "end": finish(); break
|
||||
default: throw new Error("unknown state")
|
||||
}
|
||||
end()
|
||||
}
|
||||
|
||||
Note that starting lines with `-` and `+` also should be prefixed
|
||||
with a semicolon, but this is much less common.
|
||||
|
||||
## Comma First
|
||||
|
||||
If there is a list of things separated by commas, and it wraps
|
||||
across multiple lines, put the comma at the start of the next
|
||||
line, directly below the token that starts the list. Put the
|
||||
final token in the list on a line by itself. For example:
|
||||
|
||||
var magicWords = [ "abracadabra"
|
||||
, "gesundheit"
|
||||
, "ventrilo"
|
||||
]
|
||||
, spells = { "fireball" : function () { setOnFire() }
|
||||
, "water" : function () { putOut() }
|
||||
}
|
||||
, a = 1
|
||||
, b = "abc"
|
||||
, etc
|
||||
, somethingElse
|
||||
|
||||
## Whitespace
|
||||
|
||||
Put a single space in front of ( for anything other than a function call.
|
||||
Also use a single space wherever it makes things more readable.
|
||||
|
||||
Don't leave trailing whitespace at the end of lines. Don't indent empty
|
||||
lines. Don't use more spaces than are helpful.
|
||||
|
||||
## Functions
|
||||
|
||||
Use named functions. They make stack traces a lot easier to read.
|
||||
|
||||
## Callbacks, Sync/async Style
|
||||
|
||||
Use the asynchronous/non-blocking versions of things as much as possible.
|
||||
It might make more sense for npm to use the synchronous fs APIs, but this
|
||||
way, the fs and http and child process stuff all uses the same callback-passing
|
||||
methodology.
|
||||
|
||||
The callback should always be the last argument in the list. Its first
|
||||
argument is the Error or null.
|
||||
|
||||
Be very careful never to ever ever throw anything. It's worse than useless.
|
||||
Just send the error message back as the first argument to the callback.
|
||||
|
||||
## Errors
|
||||
|
||||
Always create a new Error object with your message. Don't just return a
|
||||
string message to the callback. Stack traces are handy.
|
||||
|
||||
## Logging
|
||||
|
||||
Logging is done using the [npmlog](https://github.com/npm/npmlog)
|
||||
utility.
|
||||
|
||||
Please clean up logs when they are no longer helpful. In particular,
|
||||
logging the same object over and over again is not helpful. Logs should
|
||||
report what's happening so that it's easier to track down where a fault
|
||||
occurs.
|
||||
|
||||
Use appropriate log levels. See `npm-config(7)` and search for
|
||||
"loglevel".
|
||||
|
||||
## Case, naming, etc.
|
||||
|
||||
Use `lowerCamelCase` for multiword identifiers when they refer to objects,
|
||||
functions, methods, properties, or anything not specified in this section.
|
||||
|
||||
Use `UpperCamelCase` for class names (things that you'd pass to "new").
|
||||
|
||||
Use `all-lower-hyphen-css-case` for multiword filenames and config keys.
|
||||
|
||||
Use named functions. They make stack traces easier to follow.
|
||||
|
||||
Use `CAPS_SNAKE_CASE` for constants, things that should never change
|
||||
and are rarely used.
|
||||
|
||||
Use a single uppercase letter for function names where the function
|
||||
would normally be anonymous, but needs to call itself recursively. It
|
||||
makes it clear that it's a "throwaway" function.
|
||||
|
||||
## null, undefined, false, 0
|
||||
|
||||
Boolean variables and functions should always be either `true` or
|
||||
`false`. Don't set it to 0 unless it's supposed to be a number.
|
||||
|
||||
When something is intentionally missing or removed, set it to `null`.
|
||||
|
||||
Don't set things to `undefined`. Reserve that value to mean "not yet
|
||||
set to anything."
|
||||
|
||||
Boolean objects are verboten.
|
||||
|
||||
## SEE ALSO
|
||||
|
||||
* npm-developers(7)
|
||||
* npm-faq(7)
|
||||
* npm(1)
|
940
node_modules/npm/doc/misc/npm-config.md
generated
vendored
Normal file
940
node_modules/npm/doc/misc/npm-config.md
generated
vendored
Normal file
@@ -0,0 +1,940 @@
|
||||
npm-config(7) -- More than you probably want to know about npm configuration
|
||||
============================================================================
|
||||
|
||||
## DESCRIPTION
|
||||
|
||||
npm gets its configuration values from the following sources, sorted by priority:
|
||||
|
||||
### Command Line Flags
|
||||
|
||||
Putting `--foo bar` on the command line sets the `foo` configuration
|
||||
parameter to `"bar"`. A `--` argument tells the cli parser to stop
|
||||
reading flags. A `--flag` parameter that is at the *end* of the
|
||||
command will be given the value of `true`.
|
||||
|
||||
### Environment Variables
|
||||
|
||||
Any environment variables that start with `npm_config_` will be
|
||||
interpreted as a configuration parameter. For example, putting
|
||||
`npm_config_foo=bar` in your environment will set the `foo`
|
||||
configuration parameter to `bar`. Any environment configurations that
|
||||
are not given a value will be given the value of `true`. Config
|
||||
values are case-insensitive, so `NPM_CONFIG_FOO=bar` will work the
|
||||
same.
|
||||
|
||||
### npmrc Files
|
||||
|
||||
The four relevant files are:
|
||||
|
||||
* per-project configuration file (`/path/to/my/project/.npmrc`)
|
||||
* per-user configuration file (defaults to `$HOME/.npmrc`; configurable via CLI
|
||||
option `--userconfig` or environment variable `$NPM_CONF_USERCONFIG`)
|
||||
* global configuration file (defaults to `$PREFIX/etc/npmrc`; configurable via
|
||||
CLI option `--globalconfig` or environment variable `$NPM_CONF_GLOBALCONFIG`)
|
||||
* npm's built-in configuration file (`/path/to/npm/npmrc`)
|
||||
|
||||
See npmrc(5) for more details.
|
||||
|
||||
### Default Configs
|
||||
|
||||
A set of configuration parameters that are internal to npm, and are
|
||||
defaults if nothing else is specified.
|
||||
|
||||
## Shorthands and Other CLI Niceties
|
||||
|
||||
The following shorthands are parsed on the command-line:
|
||||
|
||||
* `-v`: `--version`
|
||||
* `-h`, `-?`, `--help`, `-H`: `--usage`
|
||||
* `-s`, `--silent`: `--loglevel silent`
|
||||
* `-q`, `--quiet`: `--loglevel warn`
|
||||
* `-d`: `--loglevel info`
|
||||
* `-dd`, `--verbose`: `--loglevel verbose`
|
||||
* `-ddd`: `--loglevel silly`
|
||||
* `-g`: `--global`
|
||||
* `-C`: `--prefix`
|
||||
* `-l`: `--long`
|
||||
* `-m`: `--message`
|
||||
* `-p`, `--porcelain`: `--parseable`
|
||||
* `-reg`: `--registry`
|
||||
* `-f`: `--force`
|
||||
* `-desc`: `--description`
|
||||
* `-S`: `--save`
|
||||
* `-D`: `--save-dev`
|
||||
* `-O`: `--save-optional`
|
||||
* `-B`: `--save-bundle`
|
||||
* `-E`: `--save-exact`
|
||||
* `-y`: `--yes`
|
||||
* `-n`: `--yes false`
|
||||
* `ll` and `la` commands: `ls --long`
|
||||
|
||||
If the specified configuration param resolves unambiguously to a known
|
||||
configuration parameter, then it is expanded to that configuration
|
||||
parameter. For example:
|
||||
|
||||
npm ls --par
|
||||
# same as:
|
||||
npm ls --parseable
|
||||
|
||||
If multiple single-character shorthands are strung together, and the
|
||||
resulting combination is unambiguously not some other configuration
|
||||
param, then it is expanded to its various component pieces. For
|
||||
example:
|
||||
|
||||
npm ls -gpld
|
||||
# same as:
|
||||
npm ls --global --parseable --long --loglevel info
|
||||
|
||||
## Per-Package Config Settings
|
||||
|
||||
When running scripts (see `npm-scripts(7)`) the package.json "config"
|
||||
keys are overwritten in the environment if there is a config param of
|
||||
`<name>[@<version>]:<key>`. For example, if the package.json has
|
||||
this:
|
||||
|
||||
{ "name" : "foo"
|
||||
, "config" : { "port" : "8080" }
|
||||
, "scripts" : { "start" : "node server.js" } }
|
||||
|
||||
and the server.js is this:
|
||||
|
||||
http.createServer(...).listen(process.env.npm_package_config_port)
|
||||
|
||||
then the user could change the behavior by doing:
|
||||
|
||||
npm config set foo:port 80
|
||||
|
||||
See package.json(5) for more information.
|
||||
|
||||
## Config Settings
|
||||
|
||||
### access
|
||||
|
||||
* Default: `restricted`
|
||||
* Type: Access
|
||||
|
||||
When publishing scoped packages, the access level defaults to `restricted`. If
|
||||
you want your scoped package to be publicly viewable (and installable) set
|
||||
`--access=public`. The only valid values for `access` are `public` and
|
||||
`restricted`. Unscoped packages _always_ have an access level of `public`.
|
||||
|
||||
### always-auth
|
||||
|
||||
* Default: false
|
||||
* Type: Boolean
|
||||
|
||||
Force npm to always require authentication when accessing the registry,
|
||||
even for `GET` requests.
|
||||
|
||||
### bin-links
|
||||
|
||||
* Default: `true`
|
||||
* Type: Boolean
|
||||
|
||||
Tells npm to create symlinks (or `.cmd` shims on Windows) for package
|
||||
executables.
|
||||
|
||||
Set to false to have it not do this. This can be used to work around
|
||||
the fact that some file systems don't support symlinks, even on
|
||||
ostensibly Unix systems.
|
||||
|
||||
### browser
|
||||
|
||||
* Default: OS X: `"open"`, Windows: `"start"`, Others: `"xdg-open"`
|
||||
* Type: String
|
||||
|
||||
The browser that is called by the `npm docs` command to open websites.
|
||||
|
||||
### ca
|
||||
|
||||
* Default: The npm CA certificate
|
||||
* Type: String, Array or null
|
||||
|
||||
The Certificate Authority signing certificate that is trusted for SSL
|
||||
connections to the registry. Values should be in PEM format with newlines
|
||||
replaced by the string "\n". For example:
|
||||
|
||||
ca="-----BEGIN CERTIFICATE-----\nXXXX\nXXXX\n-----END CERTIFICATE-----"
|
||||
|
||||
Set to `null` to only allow "known" registrars, or to a specific CA cert
|
||||
to trust only that specific signing authority.
|
||||
|
||||
Multiple CAs can be trusted by specifying an array of certificates:
|
||||
|
||||
ca[]="..."
|
||||
ca[]="..."
|
||||
|
||||
See also the `strict-ssl` config.
|
||||
|
||||
### cafile
|
||||
|
||||
* Default: `null`
|
||||
* Type: path
|
||||
|
||||
A path to a file containing one or multiple Certificate Authority signing
|
||||
certificates. Similar to the `ca` setting, but allows for multiple CA's, as
|
||||
well as for the CA information to be stored in a file on disk.
|
||||
|
||||
### cache
|
||||
|
||||
* Default: Windows: `%AppData%\npm-cache`, Posix: `~/.npm`
|
||||
* Type: path
|
||||
|
||||
The location of npm's cache directory. See `npm-cache(1)`
|
||||
|
||||
### cache-lock-stale
|
||||
|
||||
* Default: 60000 (1 minute)
|
||||
* Type: Number
|
||||
|
||||
The number of ms before cache folder lockfiles are considered stale.
|
||||
|
||||
### cache-lock-retries
|
||||
|
||||
* Default: 10
|
||||
* Type: Number
|
||||
|
||||
Number of times to retry to acquire a lock on cache folder lockfiles.
|
||||
|
||||
### cache-lock-wait
|
||||
|
||||
* Default: 10000 (10 seconds)
|
||||
* Type: Number
|
||||
|
||||
Number of ms to wait for cache lock files to expire.
|
||||
|
||||
### cache-max
|
||||
|
||||
* Default: Infinity
|
||||
* Type: Number
|
||||
|
||||
The maximum time (in seconds) to keep items in the registry cache before
|
||||
re-checking against the registry.
|
||||
|
||||
Note that no purging is done unless the `npm cache clean` command is
|
||||
explicitly used, and that only GET requests use the cache.
|
||||
|
||||
### cache-min
|
||||
|
||||
* Default: 10
|
||||
* Type: Number
|
||||
|
||||
The minimum time (in seconds) to keep items in the registry cache before
|
||||
re-checking against the registry.
|
||||
|
||||
Note that no purging is done unless the `npm cache clean` command is
|
||||
explicitly used, and that only GET requests use the cache.
|
||||
|
||||
### cert
|
||||
|
||||
* Default: `null`
|
||||
* Type: String
|
||||
|
||||
A client certificate to pass when accessing the registry. Values should be in
|
||||
PEM format with newlines replaced by the string "\n". For example:
|
||||
|
||||
cert="-----BEGIN CERTIFICATE-----\nXXXX\nXXXX\n-----END CERTIFICATE-----"
|
||||
|
||||
It is _not_ the path to a certificate file (and there is no "certfile" option).
|
||||
|
||||
### color
|
||||
|
||||
* Default: true
|
||||
* Type: Boolean or `"always"`
|
||||
|
||||
If false, never shows colors. If `"always"` then always shows colors.
|
||||
If true, then only prints color codes for tty file descriptors.
|
||||
|
||||
### depth
|
||||
|
||||
* Default: Infinity
|
||||
* Type: Number
|
||||
|
||||
The depth to go when recursing directories for `npm ls`,
|
||||
`npm cache ls`, and `npm outdated`.
|
||||
|
||||
For `npm outdated`, a setting of `Infinity` will be treated as `0`
|
||||
since that gives more useful information. To show the outdated status
|
||||
of all packages and dependents, use a large integer value,
|
||||
e.g., `npm outdated --depth 9999`
|
||||
|
||||
### description
|
||||
|
||||
* Default: true
|
||||
* Type: Boolean
|
||||
|
||||
Show the description in `npm search`
|
||||
|
||||
### dev
|
||||
|
||||
* Default: false
|
||||
* Type: Boolean
|
||||
|
||||
Install `dev-dependencies` along with packages.
|
||||
|
||||
Note that `dev-dependencies` are also installed if the `npat` flag is
|
||||
set.
|
||||
|
||||
### editor
|
||||
|
||||
* Default: `EDITOR` environment variable if set, or `"vi"` on Posix,
|
||||
or `"notepad"` on Windows.
|
||||
* Type: path
|
||||
|
||||
The command to run for `npm edit` or `npm config edit`.
|
||||
|
||||
### engine-strict
|
||||
|
||||
* Default: false
|
||||
* Type: Boolean
|
||||
|
||||
If set to true, then npm will stubbornly refuse to install (or even
|
||||
consider installing) any package that claims to not be compatible with
|
||||
the current Node.js version.
|
||||
|
||||
### force
|
||||
|
||||
* Default: false
|
||||
* Type: Boolean
|
||||
|
||||
Makes various commands more forceful.
|
||||
|
||||
* lifecycle script failure does not block progress.
|
||||
* publishing clobbers previously published versions.
|
||||
* skips cache when requesting from the registry.
|
||||
* prevents checks against clobbering non-npm files.
|
||||
|
||||
### fetch-retries
|
||||
|
||||
* Default: 2
|
||||
* Type: Number
|
||||
|
||||
The "retries" config for the `retry` module to use when fetching
|
||||
packages from the registry.
|
||||
|
||||
### fetch-retry-factor
|
||||
|
||||
* Default: 10
|
||||
* Type: Number
|
||||
|
||||
The "factor" config for the `retry` module to use when fetching
|
||||
packages.
|
||||
|
||||
### fetch-retry-mintimeout
|
||||
|
||||
* Default: 10000 (10 seconds)
|
||||
* Type: Number
|
||||
|
||||
The "minTimeout" config for the `retry` module to use when fetching
|
||||
packages.
|
||||
|
||||
### fetch-retry-maxtimeout
|
||||
|
||||
* Default: 60000 (1 minute)
|
||||
* Type: Number
|
||||
|
||||
The "maxTimeout" config for the `retry` module to use when fetching
|
||||
packages.
|
||||
|
||||
### git
|
||||
|
||||
* Default: `"git"`
|
||||
* Type: String
|
||||
|
||||
The command to use for git commands. If git is installed on the
|
||||
computer, but is not in the `PATH`, then set this to the full path to
|
||||
the git binary.
|
||||
|
||||
### git-tag-version
|
||||
|
||||
* Default: `true`
|
||||
* Type: Boolean
|
||||
|
||||
Tag the commit when using the `npm version` command.
|
||||
|
||||
### global
|
||||
|
||||
* Default: false
|
||||
* Type: Boolean
|
||||
|
||||
Operates in "global" mode, so that packages are installed into the
|
||||
`prefix` folder instead of the current working directory. See
|
||||
`npm-folders(5)` for more on the differences in behavior.
|
||||
|
||||
* packages are installed into the `{prefix}/lib/node_modules` folder, instead of the
|
||||
current working directory.
|
||||
* bin files are linked to `{prefix}/bin`
|
||||
* man pages are linked to `{prefix}/share/man`
|
||||
|
||||
### globalconfig
|
||||
|
||||
* Default: {prefix}/etc/npmrc
|
||||
* Type: path
|
||||
|
||||
The config file to read for global config options.
|
||||
|
||||
### group
|
||||
|
||||
* Default: GID of the current process
|
||||
* Type: String or Number
|
||||
|
||||
The group to use when running package scripts in global mode as the root
|
||||
user.
|
||||
|
||||
### heading
|
||||
|
||||
* Default: `"npm"`
|
||||
* Type: String
|
||||
|
||||
The string that starts all the debugging log output.
|
||||
|
||||
### https-proxy
|
||||
|
||||
* Default: null
|
||||
* Type: url
|
||||
|
||||
A proxy to use for outgoing https requests. If the `HTTPS_PROXY` or
|
||||
`https_proxy` or `HTTP_PROXY` or `http_proxy` environment variables are set,
|
||||
proxy settings will be honored by the underlying `request` library.
|
||||
|
||||
### if-present
|
||||
|
||||
* Default: false
|
||||
* Type: Boolean
|
||||
|
||||
If true, npm will not exit with an error code when `run-script` is invoked for
|
||||
a script that isn't defined in the `scripts` section of `package.json`. This
|
||||
option can be used when it's desirable to optionally run a script when it's
|
||||
present and fail if the script fails. This is useful, for example, when running
|
||||
scripts that may only apply for some builds in an otherwise generic CI setup.
|
||||
|
||||
### ignore-scripts
|
||||
|
||||
* Default: false
|
||||
* Type: Boolean
|
||||
|
||||
If true, npm does not run scripts specified in package.json files.
|
||||
|
||||
### init-module
|
||||
|
||||
* Default: ~/.npm-init.js
|
||||
* Type: path
|
||||
|
||||
A module that will be loaded by the `npm init` command. See the
|
||||
documentation for the
|
||||
[init-package-json](https://github.com/isaacs/init-package-json) module
|
||||
for more information, or npm-init(1).
|
||||
|
||||
### init-author-name
|
||||
|
||||
* Default: ""
|
||||
* Type: String
|
||||
|
||||
The value `npm init` should use by default for the package author's name.
|
||||
|
||||
### init-author-email
|
||||
|
||||
* Default: ""
|
||||
* Type: String
|
||||
|
||||
The value `npm init` should use by default for the package author's email.
|
||||
|
||||
### init-author-url
|
||||
|
||||
* Default: ""
|
||||
* Type: String
|
||||
|
||||
The value `npm init` should use by default for the package author's homepage.
|
||||
|
||||
### init-license
|
||||
|
||||
* Default: "ISC"
|
||||
* Type: String
|
||||
|
||||
The value `npm init` should use by default for the package license.
|
||||
|
||||
### init-version
|
||||
|
||||
* Default: "1.0.0"
|
||||
* Type: semver
|
||||
|
||||
The value that `npm init` should use by default for the package
|
||||
version number, if not already set in package.json.
|
||||
|
||||
### json
|
||||
|
||||
* Default: false
|
||||
* Type: Boolean
|
||||
|
||||
Whether or not to output JSON data, rather than the normal output.
|
||||
|
||||
This feature is currently experimental, and the output data structures
|
||||
for many commands is either not implemented in JSON yet, or subject to
|
||||
change. Only the output from `npm ls --json` is currently valid.
|
||||
|
||||
### key
|
||||
|
||||
* Default: `null`
|
||||
* Type: String
|
||||
|
||||
A client key to pass when accessing the registry. Values should be in PEM
|
||||
format with newlines replaced by the string "\n". For example:
|
||||
|
||||
key="-----BEGIN PRIVATE KEY-----\nXXXX\nXXXX\n-----END PRIVATE KEY-----"
|
||||
|
||||
It is _not_ the path to a key file (and there is no "keyfile" option).
|
||||
|
||||
### link
|
||||
|
||||
* Default: false
|
||||
* Type: Boolean
|
||||
|
||||
If true, then local installs will link if there is a suitable globally
|
||||
installed package.
|
||||
|
||||
Note that this means that local installs can cause things to be
|
||||
installed into the global space at the same time. The link is only done
|
||||
if one of the two conditions are met:
|
||||
|
||||
* The package is not already installed globally, or
|
||||
* the globally installed version is identical to the version that is
|
||||
being installed locally.
|
||||
|
||||
### local-address
|
||||
|
||||
* Default: undefined
|
||||
* Type: IP Address
|
||||
|
||||
The IP address of the local interface to use when making connections
|
||||
to the npm registry. Must be IPv4 in versions of Node prior to 0.12.
|
||||
|
||||
### loglevel
|
||||
|
||||
* Default: "warn"
|
||||
* Type: String
|
||||
* Values: "silent", "error", "warn", "http", "info", "verbose", "silly"
|
||||
|
||||
What level of logs to report. On failure, *all* logs are written to
|
||||
`npm-debug.log` in the current working directory.
|
||||
|
||||
Any logs of a higher level than the setting are shown.
|
||||
The default is "warn", which shows warn and error output.
|
||||
|
||||
### logstream
|
||||
|
||||
* Default: process.stderr
|
||||
* Type: Stream
|
||||
|
||||
This is the stream that is passed to the
|
||||
[npmlog](https://github.com/npm/npmlog) module at run time.
|
||||
|
||||
It cannot be set from the command line, but if you are using npm
|
||||
programmatically, you may wish to send logs to somewhere other than
|
||||
stderr.
|
||||
|
||||
If the `color` config is set to true, then this stream will receive
|
||||
colored output if it is a TTY.
|
||||
|
||||
### long
|
||||
|
||||
* Default: false
|
||||
* Type: Boolean
|
||||
|
||||
Show extended information in `npm ls` and `npm search`.
|
||||
|
||||
### maxsockets
|
||||
|
||||
* Default: 50
|
||||
* Type: Number
|
||||
|
||||
The maximum number of connections to use per origin (protocol/host/port
|
||||
combination). Passed to the `http` `Agent` used to make the request.
|
||||
|
||||
### message
|
||||
|
||||
* Default: "%s"
|
||||
* Type: String
|
||||
|
||||
Commit message which is used by `npm version` when creating version commit.
|
||||
|
||||
Any "%s" in the message will be replaced with the version number.
|
||||
|
||||
### node-version
|
||||
|
||||
* Default: process.version
|
||||
* Type: semver or false
|
||||
|
||||
The node version to use when checking a package's `engines` map.
|
||||
|
||||
### npat
|
||||
|
||||
* Default: false
|
||||
* Type: Boolean
|
||||
|
||||
Run tests on installation.
|
||||
|
||||
### onload-script
|
||||
|
||||
* Default: false
|
||||
* Type: path
|
||||
|
||||
A node module to `require()` when npm loads. Useful for programmatic
|
||||
usage.
|
||||
|
||||
### optional
|
||||
|
||||
* Default: true
|
||||
* Type: Boolean
|
||||
|
||||
Attempt to install packages in the `optionalDependencies` object. Note
|
||||
that if these packages fail to install, the overall installation
|
||||
process is not aborted.
|
||||
|
||||
### parseable
|
||||
|
||||
* Default: false
|
||||
* Type: Boolean
|
||||
|
||||
Output parseable results from commands that write to
|
||||
standard output.
|
||||
|
||||
### prefix
|
||||
|
||||
* Default: see npm-folders(5)
|
||||
* Type: path
|
||||
|
||||
The location to install global items. If set on the command line, then
|
||||
it forces non-global commands to run in the specified folder.
|
||||
|
||||
### production
|
||||
|
||||
* Default: false
|
||||
* Type: Boolean
|
||||
|
||||
Set to true to run in "production" mode.
|
||||
|
||||
1. devDependencies are not installed at the topmost level when running
|
||||
local `npm install` without any arguments.
|
||||
2. Set the NODE_ENV="production" for lifecycle scripts.
|
||||
|
||||
### proprietary-attribs
|
||||
|
||||
* Default: true
|
||||
* Type: Boolean
|
||||
|
||||
Whether or not to include proprietary extended attributes in the
|
||||
tarballs created by npm.
|
||||
|
||||
Unless you are expecting to unpack package tarballs with something other
|
||||
than npm -- particularly a very outdated tar implementation -- leave
|
||||
this as true.
|
||||
|
||||
### proxy
|
||||
|
||||
* Default: null
|
||||
* Type: url
|
||||
|
||||
A proxy to use for outgoing http requests. If the `HTTP_PROXY` or
|
||||
`http_proxy` environment variables are set, proxy settings will be
|
||||
honored by the underlying `request` library.
|
||||
|
||||
### rebuild-bundle
|
||||
|
||||
* Default: true
|
||||
* Type: Boolean
|
||||
|
||||
Rebuild bundled dependencies after installation.
|
||||
|
||||
### registry
|
||||
|
||||
* Default: https://registry.npmjs.org/
|
||||
* Type: url
|
||||
|
||||
The base URL of the npm package registry.
|
||||
|
||||
### rollback
|
||||
|
||||
* Default: true
|
||||
* Type: Boolean
|
||||
|
||||
Remove failed installs.
|
||||
|
||||
### save
|
||||
|
||||
* Default: false
|
||||
* Type: Boolean
|
||||
|
||||
Save installed packages to a package.json file as dependencies.
|
||||
|
||||
When used with the `npm rm` command, it removes it from the `dependencies`
|
||||
object.
|
||||
|
||||
Only works if there is already a package.json file present.
|
||||
|
||||
### save-bundle
|
||||
|
||||
* Default: false
|
||||
* Type: Boolean
|
||||
|
||||
If a package would be saved at install time by the use of `--save`,
|
||||
`--save-dev`, or `--save-optional`, then also put it in the
|
||||
`bundleDependencies` list.
|
||||
|
||||
When used with the `npm rm` command, it removes it from the
|
||||
bundledDependencies list.
|
||||
|
||||
### save-dev
|
||||
|
||||
* Default: false
|
||||
* Type: Boolean
|
||||
|
||||
Save installed packages to a package.json file as `devDependencies`.
|
||||
|
||||
When used with the `npm rm` command, it removes it from the
|
||||
`devDependencies` object.
|
||||
|
||||
Only works if there is already a package.json file present.
|
||||
|
||||
### save-exact
|
||||
|
||||
* Default: false
|
||||
* Type: Boolean
|
||||
|
||||
Dependencies saved to package.json using `--save`, `--save-dev` or
|
||||
`--save-optional` will be configured with an exact version rather than
|
||||
using npm's default semver range operator.
|
||||
|
||||
### save-optional
|
||||
|
||||
* Default: false
|
||||
* Type: Boolean
|
||||
|
||||
Save installed packages to a package.json file as
|
||||
optionalDependencies.
|
||||
|
||||
When used with the `npm rm` command, it removes it from the
|
||||
`devDependencies` object.
|
||||
|
||||
Only works if there is already a package.json file present.
|
||||
|
||||
### save-prefix
|
||||
|
||||
* Default: '^'
|
||||
* Type: String
|
||||
|
||||
Configure how versions of packages installed to a package.json file via
|
||||
`--save` or `--save-dev` get prefixed.
|
||||
|
||||
For example if a package has version `1.2.3`, by default its version is
|
||||
set to `^1.2.3` which allows minor upgrades for that package, but after
|
||||
`npm config set save-prefix='~'` it would be set to `~1.2.3` which only allows
|
||||
patch upgrades.
|
||||
|
||||
### scope
|
||||
|
||||
* Default: ""
|
||||
* Type: String
|
||||
|
||||
Associate an operation with a scope for a scoped registry. Useful when logging
|
||||
in to a private registry for the first time:
|
||||
`npm login --scope=@organization --registry=registry.organization.com`, which
|
||||
will cause `@organization` to be mapped to the registry for future installation
|
||||
of packages specified according to the pattern `@organization/package`.
|
||||
|
||||
### searchopts
|
||||
|
||||
* Default: ""
|
||||
* Type: String
|
||||
|
||||
Space-separated options that are always passed to search.
|
||||
|
||||
### searchexclude
|
||||
|
||||
* Default: ""
|
||||
* Type: String
|
||||
|
||||
Space-separated options that limit the results from search.
|
||||
|
||||
### searchsort
|
||||
|
||||
* Default: "name"
|
||||
* Type: String
|
||||
* Values: "name", "-name", "date", "-date", "description",
|
||||
"-description", "keywords", "-keywords"
|
||||
|
||||
Indication of which field to sort search results by. Prefix with a `-`
|
||||
character to indicate reverse sort.
|
||||
|
||||
### shell
|
||||
|
||||
* Default: SHELL environment variable, or "bash" on Posix, or "cmd" on
|
||||
Windows
|
||||
* Type: path
|
||||
|
||||
The shell to run for the `npm explore` command.
|
||||
|
||||
### shrinkwrap
|
||||
|
||||
* Default: true
|
||||
* Type: Boolean
|
||||
|
||||
If set to false, then ignore `npm-shrinkwrap.json` files when
|
||||
installing.
|
||||
|
||||
### sign-git-tag
|
||||
|
||||
* Default: false
|
||||
* Type: Boolean
|
||||
|
||||
If set to true, then the `npm version` command will tag the version
|
||||
using `-s` to add a signature.
|
||||
|
||||
Note that git requires you to have set up GPG keys in your git configs
|
||||
for this to work properly.
|
||||
|
||||
### spin
|
||||
|
||||
* Default: true
|
||||
* Type: Boolean or `"always"`
|
||||
|
||||
When set to `true`, npm will display an ascii spinner while it is doing
|
||||
things, if `process.stderr` is a TTY.
|
||||
|
||||
Set to `false` to suppress the spinner, or set to `always` to output
|
||||
the spinner even for non-TTY outputs.
|
||||
|
||||
### strict-ssl
|
||||
|
||||
* Default: true
|
||||
* Type: Boolean
|
||||
|
||||
Whether or not to do SSL key validation when making requests to the
|
||||
registry via https.
|
||||
|
||||
See also the `ca` config.
|
||||
|
||||
### tag
|
||||
|
||||
* Default: latest
|
||||
* Type: String
|
||||
|
||||
If you ask npm to install a package and don't tell it a specific version, then
|
||||
it will install the specified tag.
|
||||
|
||||
Also the tag that is added to the package@version specified by the `npm
|
||||
tag` command, if no explicit tag is given.
|
||||
|
||||
### tag-version-prefix
|
||||
|
||||
* Default: `"v"`
|
||||
* Type: String
|
||||
|
||||
If set, alters the prefix used when tagging a new version when performing a
|
||||
version increment using `npm-version`. To remove the prefix altogether, set it
|
||||
to the empty string: `""`.
|
||||
|
||||
Because other tools may rely on the convention that npm version tags look like
|
||||
`v1.0.0`, _only use this property if it is absolutely necessary_. In
|
||||
particular, use care when overriding this setting for public packages.
|
||||
|
||||
### tmp
|
||||
|
||||
* Default: TMPDIR environment variable, or "/tmp"
|
||||
* Type: path
|
||||
|
||||
Where to store temporary files and folders. All temp files are deleted
|
||||
on success, but left behind on failure for forensic purposes.
|
||||
|
||||
### unicode
|
||||
|
||||
* Default: true
|
||||
* Type: Boolean
|
||||
|
||||
When set to true, npm uses unicode characters in the tree output. When
|
||||
false, it uses ascii characters to draw trees.
|
||||
|
||||
### unsafe-perm
|
||||
|
||||
* Default: false if running as root, true otherwise
|
||||
* Type: Boolean
|
||||
|
||||
Set to true to suppress the UID/GID switching when running package
|
||||
scripts. If set explicitly to false, then installing as a non-root user
|
||||
will fail.
|
||||
|
||||
### usage
|
||||
|
||||
* Default: false
|
||||
* Type: Boolean
|
||||
|
||||
Set to show short usage output (like the -H output)
|
||||
instead of complete help when doing `npm-help(1)`.
|
||||
|
||||
### user
|
||||
|
||||
* Default: "nobody"
|
||||
* Type: String or Number
|
||||
|
||||
The UID to set to when running package scripts as root.
|
||||
|
||||
### userconfig
|
||||
|
||||
* Default: ~/.npmrc
|
||||
* Type: path
|
||||
|
||||
The location of user-level configuration settings.
|
||||
|
||||
### umask
|
||||
|
||||
* Default: 022
|
||||
* Type: Octal numeric string in range 0000..0777 (0..511)
|
||||
|
||||
The "umask" value to use when setting the file creation mode on files
|
||||
and folders.
|
||||
|
||||
Folders and executables are given a mode which is `0777` masked against
|
||||
this value. Other files are given a mode which is `0666` masked against
|
||||
this value. Thus, the defaults are `0755` and `0644` respectively.
|
||||
|
||||
### user-agent
|
||||
|
||||
* Default: node/{process.version} {process.platform} {process.arch}
|
||||
* Type: String
|
||||
|
||||
Sets a User-Agent to the request header
|
||||
|
||||
### version
|
||||
|
||||
* Default: false
|
||||
* Type: boolean
|
||||
|
||||
If true, output the npm version and exit successfully.
|
||||
|
||||
Only relevant when specified explicitly on the command line.
|
||||
|
||||
### versions
|
||||
|
||||
* Default: false
|
||||
* Type: boolean
|
||||
|
||||
If true, output the npm version as well as node's `process.versions` map, and
|
||||
exit successfully.
|
||||
|
||||
Only relevant when specified explicitly on the command line.
|
||||
|
||||
### viewer
|
||||
|
||||
* Default: "man" on Posix, "browser" on Windows
|
||||
* Type: path
|
||||
|
||||
The program to use to view help content.
|
||||
|
||||
Set to `"browser"` to view html help content in the default web browser.
|
||||
|
||||
## SEE ALSO
|
||||
|
||||
* npm-config(1)
|
||||
* npmrc(5)
|
||||
* npm-scripts(7)
|
||||
* npm-folders(5)
|
||||
* npm(1)
|
221
node_modules/npm/doc/misc/npm-developers.md
generated
vendored
Normal file
221
node_modules/npm/doc/misc/npm-developers.md
generated
vendored
Normal file
@@ -0,0 +1,221 @@
|
||||
npm-developers(7) -- Developer Guide
|
||||
====================================
|
||||
|
||||
## DESCRIPTION
|
||||
|
||||
So, you've decided to use npm to develop (and maybe publish/deploy)
|
||||
your project.
|
||||
|
||||
Fantastic!
|
||||
|
||||
There are a few things that you need to do above the simple steps
|
||||
that your users will do to install your program.
|
||||
|
||||
## About These Documents
|
||||
|
||||
These are man pages. If you install npm, you should be able to
|
||||
then do `man npm-thing` to get the documentation on a particular
|
||||
topic, or `npm help thing` to see the same information.
|
||||
|
||||
## What is a `package`
|
||||
|
||||
A package is:
|
||||
|
||||
* a) a folder containing a program described by a package.json file
|
||||
* b) a gzipped tarball containing (a)
|
||||
* c) a url that resolves to (b)
|
||||
* d) a `<name>@<version>` that is published on the registry with (c)
|
||||
* e) a `<name>@<tag>` that points to (d)
|
||||
* f) a `<name>` that has a "latest" tag satisfying (e)
|
||||
* g) a `git` url that, when cloned, results in (a).
|
||||
|
||||
Even if you never publish your package, you can still get a lot of
|
||||
benefits of using npm if you just want to write a node program (a), and
|
||||
perhaps if you also want to be able to easily install it elsewhere
|
||||
after packing it up into a tarball (b).
|
||||
|
||||
Git urls can be of the form:
|
||||
|
||||
git://github.com/user/project.git#commit-ish
|
||||
git+ssh://user@hostname:project.git#commit-ish
|
||||
git+http://user@hostname/project/blah.git#commit-ish
|
||||
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`.
|
||||
|
||||
## 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(5)` 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.
|
||||
|
||||
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.
|
||||
|
||||
* 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.
|
||||
|
||||
* 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 npm-scripts(7).
|
||||
|
||||
* 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.
|
||||
|
||||
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(1)` 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.
|
||||
|
||||
`.npmignore` files follow the [same pattern rules](https://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository#Ignoring-Files)
|
||||
as `.gitignore` files:
|
||||
|
||||
* Blank lines or lines starting with `#` are ignored.
|
||||
* Standard glob patterns work.
|
||||
* You can end patterns with a forward slash `/` to specify a directory.
|
||||
* You can negate a pattern by starting it with an exclamation point `!`.
|
||||
|
||||
By default, the following paths and files are ignored, so there's no
|
||||
need to add them to `.npmignore` explicitly:
|
||||
|
||||
* `.*.swp`
|
||||
* `._*`
|
||||
* `.DS_Store`
|
||||
* `.git`
|
||||
* `.hg`
|
||||
* `.npmrc`
|
||||
* `.lock-wscript`
|
||||
* `.svn`
|
||||
* `.wafpickle-*`
|
||||
* `config.gypi`
|
||||
* `CVS`
|
||||
* `npm-debug.log`
|
||||
|
||||
Additionally, everything in `node_modules` is ignored, except for
|
||||
bundled dependencies. npm automatically handles this for you, so don't
|
||||
bother adding `node_modules` to `.npmignore`.
|
||||
|
||||
The following paths and files are never ignored, so adding them to
|
||||
`.npmignore` is pointless:
|
||||
|
||||
* `package.json`
|
||||
* `README` (and its variants)
|
||||
* `CHANGELOG` (and its variants)
|
||||
* `LICENSE` / `LICENCE`
|
||||
|
||||
## Link Packages
|
||||
|
||||
`npm link` is designed to install a development package and see the
|
||||
changes in real time without having to keep re-installing it. (You do
|
||||
need to either re-link or `npm rebuild -g` to update compiled packages,
|
||||
of course.)
|
||||
|
||||
More info at `npm-link(1)`.
|
||||
|
||||
## Before Publishing: Make Sure Your Package Installs and Works
|
||||
|
||||
**This is important.**
|
||||
|
||||
If you can not install it locally, you'll have
|
||||
problems trying to publish it. Or, worse yet, you'll be able to
|
||||
publish it, but you'll be publishing a broken or pointless package.
|
||||
So don't do that.
|
||||
|
||||
In the root of your package, do this:
|
||||
|
||||
npm install . -g
|
||||
|
||||
That'll show you that it's working. If you'd rather just create a symlink
|
||||
package that points to your working directory, then do this:
|
||||
|
||||
npm link
|
||||
|
||||
Use `npm ls -g` to see if it's there.
|
||||
|
||||
To test a local install, go into some other folder, and then do:
|
||||
|
||||
cd ../some-other-folder
|
||||
npm install ../my-package
|
||||
|
||||
to install it locally into the node_modules folder in that other place.
|
||||
|
||||
Then go into the node-repl, and try using require("my-thing") to
|
||||
bring in your module's main module.
|
||||
|
||||
## Create a User Account
|
||||
|
||||
Create a user with the adduser command. It works like this:
|
||||
|
||||
npm adduser
|
||||
|
||||
and then follow the prompts.
|
||||
|
||||
This is documented better in npm-adduser(1).
|
||||
|
||||
## Publish your package
|
||||
|
||||
This part's easy. In the root of your folder, do this:
|
||||
|
||||
npm publish
|
||||
|
||||
You can give publish a url to a tarball, or a filename of a tarball,
|
||||
or a path to a folder.
|
||||
|
||||
Note that pretty much **everything in that folder will be exposed**
|
||||
by default. So, if you have secret stuff in there, use a
|
||||
`.npmignore` file to list out the globs to ignore, or publish
|
||||
from a fresh checkout.
|
||||
|
||||
## Brag about it
|
||||
|
||||
Send emails, write blogs, blab in IRC.
|
||||
|
||||
Tell the world how easy it is to install your program!
|
||||
|
||||
## SEE ALSO
|
||||
|
||||
* npm-faq(7)
|
||||
* npm(1)
|
||||
* npm-init(1)
|
||||
* package.json(5)
|
||||
* npm-scripts(7)
|
||||
* npm-publish(1)
|
||||
* npm-adduser(1)
|
||||
* npm-registry(7)
|
99
node_modules/npm/doc/misc/npm-disputes.md
generated
vendored
Normal file
99
node_modules/npm/doc/misc/npm-disputes.md
generated
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
npm-disputes(7) -- Handling Module Name Disputes
|
||||
================================================
|
||||
|
||||
## SYNOPSIS
|
||||
|
||||
1. Get the author email with `npm owner ls <pkgname>`
|
||||
2. Email the author, CC <support@npmjs.com>
|
||||
3. After a few weeks, if there's no resolution, we'll sort it out.
|
||||
|
||||
Don't squat on package names. Publish code or move out of the way.
|
||||
|
||||
## DESCRIPTION
|
||||
|
||||
There sometimes arise cases where a user publishes a module, and then
|
||||
later, some other user wants to use that name. Here are some common
|
||||
ways that happens (each of these is based on actual events.)
|
||||
|
||||
1. Joe writes a JavaScript module `foo`, which is not node-specific.
|
||||
Joe doesn't use node at all. Bob wants to use `foo` in node, so he
|
||||
wraps it in an npm module. Some time later, Joe starts using node,
|
||||
and wants to take over management of his program.
|
||||
2. Bob writes an npm module `foo`, and publishes it. Perhaps much
|
||||
later, Joe finds a bug in `foo`, and fixes it. He sends a pull
|
||||
request to Bob, but Bob doesn't have the time to deal with it,
|
||||
because he has a new job and a new baby and is focused on his new
|
||||
erlang project, and kind of not involved with node any more. Joe
|
||||
would like to publish a new `foo`, but can't, because the name is
|
||||
taken.
|
||||
3. Bob writes a 10-line flow-control library, and calls it `foo`, and
|
||||
publishes it to the npm registry. Being a simple little thing, it
|
||||
never really has to be updated. Joe works for Foo Inc, the makers
|
||||
of the critically acclaimed and widely-marketed `foo` JavaScript
|
||||
toolkit framework. They publish it to npm as `foojs`, but people are
|
||||
routinely confused when `npm install foo` is some different thing.
|
||||
4. Bob writes a parser for the widely-known `foo` file format, because
|
||||
he needs it for work. Then, he gets a new job, and never updates the
|
||||
prototype. Later on, Joe writes a much more complete `foo` parser,
|
||||
but can't publish, because Bob's `foo` is in the way.
|
||||
|
||||
The validity of Joe's claim in each situation can be debated. However,
|
||||
Joe's appropriate course of action in each case is the same.
|
||||
|
||||
1. `npm owner ls foo`. This will tell Joe the email address of the
|
||||
owner (Bob).
|
||||
2. Joe emails Bob, explaining the situation **as respectfully as
|
||||
possible**, and what he would like to do with the module name. He
|
||||
adds the npm support staff <support@npmjs.com> to the CC list of
|
||||
the email. Mention in the email that Bob can run `npm owner add
|
||||
joe foo` to add Joe as an owner of the `foo` package.
|
||||
3. After a reasonable amount of time, if Bob has not responded, or if
|
||||
Bob and Joe can't come to any sort of resolution, email support
|
||||
<support@npmjs.com> and we'll sort it out. ("Reasonable" is
|
||||
usually at least 4 weeks, but extra time is allowed around common
|
||||
holidays.)
|
||||
|
||||
## REASONING
|
||||
|
||||
In almost every case so far, the parties involved have been able to reach
|
||||
an amicable resolution without any major intervention. Most people
|
||||
really do want to be reasonable, and are probably not even aware that
|
||||
they're in your way.
|
||||
|
||||
Module ecosystems are most vibrant and powerful when they are as
|
||||
self-directed as possible. If an admin one day deletes something you
|
||||
had worked on, then that is going to make most people quite upset,
|
||||
regardless of the justification. When humans solve their problems by
|
||||
talking to other humans with respect, everyone has the chance to end up
|
||||
feeling good about the interaction.
|
||||
|
||||
## EXCEPTIONS
|
||||
|
||||
Some things are not allowed, and will be removed without discussion if
|
||||
they are brought to the attention of the npm registry admins, including
|
||||
but not limited to:
|
||||
|
||||
1. Malware (that is, a package designed to exploit or harm the machine on
|
||||
which it is installed).
|
||||
2. Violations of copyright or licenses (for example, cloning an
|
||||
MIT-licensed program, and then removing or changing the copyright and
|
||||
license statement).
|
||||
3. Illegal content.
|
||||
4. "Squatting" on a package name that you *plan* to use, but aren't
|
||||
actually using. Sorry, I don't care how great the name is, or how
|
||||
perfect a fit it is for the thing that someday might happen. If
|
||||
someone wants to use it today, and you're just taking up space with
|
||||
an empty tarball, you're going to be evicted.
|
||||
5. Putting empty packages in the registry. Packages must have SOME
|
||||
functionality. It can be silly, but it can't be *nothing*. (See
|
||||
also: squatting.)
|
||||
6. Doing weird things with the registry, like using it as your own
|
||||
personal application database or otherwise putting non-packagey
|
||||
things into it.
|
||||
|
||||
If you see bad behavior like this, please report it right away.
|
||||
|
||||
## SEE ALSO
|
||||
|
||||
* npm-registry(7)
|
||||
* npm-owner(1)
|
443
node_modules/npm/doc/misc/npm-index.md
generated
vendored
Normal file
443
node_modules/npm/doc/misc/npm-index.md
generated
vendored
Normal file
@@ -0,0 +1,443 @@
|
||||
npm-index(7) -- Index of all npm documentation
|
||||
==============================================
|
||||
|
||||
### README(1)
|
||||
|
||||
a JavaScript package manager
|
||||
|
||||
## Command Line Documentation
|
||||
|
||||
Using npm on the command line
|
||||
|
||||
### npm(1)
|
||||
|
||||
javascript package manager
|
||||
|
||||
### npm-access(1)
|
||||
|
||||
Set access level on published packages
|
||||
|
||||
### npm-adduser(1)
|
||||
|
||||
Add a registry user account
|
||||
|
||||
### npm-bin(1)
|
||||
|
||||
Display npm bin folder
|
||||
|
||||
### npm-bugs(1)
|
||||
|
||||
Bugs for a package in a web browser maybe
|
||||
|
||||
### npm-build(1)
|
||||
|
||||
Build a package
|
||||
|
||||
### npm-bundle(1)
|
||||
|
||||
REMOVED
|
||||
|
||||
### npm-cache(1)
|
||||
|
||||
Manipulates packages cache
|
||||
|
||||
### npm-completion(1)
|
||||
|
||||
Tab Completion for npm
|
||||
|
||||
### npm-config(1)
|
||||
|
||||
Manage the npm configuration files
|
||||
|
||||
### npm-dedupe(1)
|
||||
|
||||
Reduce duplication
|
||||
|
||||
### npm-deprecate(1)
|
||||
|
||||
Deprecate a version of a package
|
||||
|
||||
### npm-dist-tag(1)
|
||||
|
||||
Modify package distribution tags
|
||||
|
||||
### npm-docs(1)
|
||||
|
||||
Docs for a package in a web browser maybe
|
||||
|
||||
### npm-edit(1)
|
||||
|
||||
Edit an installed package
|
||||
|
||||
### npm-explore(1)
|
||||
|
||||
Browse an installed package
|
||||
|
||||
### npm-help-search(1)
|
||||
|
||||
Search npm help documentation
|
||||
|
||||
### npm-help(1)
|
||||
|
||||
Get help on npm
|
||||
|
||||
### npm-init(1)
|
||||
|
||||
Interactively create a package.json file
|
||||
|
||||
### npm-install(1)
|
||||
|
||||
Install a package
|
||||
|
||||
### npm-link(1)
|
||||
|
||||
Symlink a package folder
|
||||
|
||||
### npm-logout(1)
|
||||
|
||||
Log out of the registry
|
||||
|
||||
### npm-ls(1)
|
||||
|
||||
List installed packages
|
||||
|
||||
### npm-outdated(1)
|
||||
|
||||
Check for outdated packages
|
||||
|
||||
### npm-owner(1)
|
||||
|
||||
Manage package owners
|
||||
|
||||
### npm-pack(1)
|
||||
|
||||
Create a tarball from a package
|
||||
|
||||
### npm-ping(1)
|
||||
|
||||
Ping npm registry
|
||||
|
||||
### npm-prefix(1)
|
||||
|
||||
Display prefix
|
||||
|
||||
### npm-prune(1)
|
||||
|
||||
Remove extraneous packages
|
||||
|
||||
### npm-publish(1)
|
||||
|
||||
Publish a package
|
||||
|
||||
### npm-rebuild(1)
|
||||
|
||||
Rebuild a package
|
||||
|
||||
### npm-repo(1)
|
||||
|
||||
Open package repository page in the browser
|
||||
|
||||
### npm-restart(1)
|
||||
|
||||
Restart a package
|
||||
|
||||
### npm-rm(1)
|
||||
|
||||
Remove a package
|
||||
|
||||
### npm-root(1)
|
||||
|
||||
Display npm root
|
||||
|
||||
### npm-run-script(1)
|
||||
|
||||
Run arbitrary package scripts
|
||||
|
||||
### npm-search(1)
|
||||
|
||||
Search for packages
|
||||
|
||||
### npm-shrinkwrap(1)
|
||||
|
||||
Lock down dependency versions
|
||||
|
||||
### npm-star(1)
|
||||
|
||||
Mark your favorite packages
|
||||
|
||||
### npm-stars(1)
|
||||
|
||||
View packages marked as favorites
|
||||
|
||||
### npm-start(1)
|
||||
|
||||
Start a package
|
||||
|
||||
### npm-stop(1)
|
||||
|
||||
Stop a package
|
||||
|
||||
### npm-tag(1)
|
||||
|
||||
Tag a published version
|
||||
|
||||
### npm-team(1)
|
||||
|
||||
Manage organization teams and team memberships
|
||||
|
||||
### npm-test(1)
|
||||
|
||||
Test a package
|
||||
|
||||
### npm-uninstall(1)
|
||||
|
||||
Remove a package
|
||||
|
||||
### npm-unpublish(1)
|
||||
|
||||
Remove a package from the registry
|
||||
|
||||
### npm-update(1)
|
||||
|
||||
Update a package
|
||||
|
||||
### npm-version(1)
|
||||
|
||||
Bump a package version
|
||||
|
||||
### npm-view(1)
|
||||
|
||||
View registry info
|
||||
|
||||
### npm-whoami(1)
|
||||
|
||||
Display npm username
|
||||
|
||||
## API Documentation
|
||||
|
||||
Using npm in your Node programs
|
||||
|
||||
### npm(3)
|
||||
|
||||
javascript package manager
|
||||
|
||||
### npm-bin(3)
|
||||
|
||||
Display npm bin folder
|
||||
|
||||
### npm-bugs(3)
|
||||
|
||||
Bugs for a package in a web browser maybe
|
||||
|
||||
### npm-cache(3)
|
||||
|
||||
manage the npm cache programmatically
|
||||
|
||||
### npm-commands(3)
|
||||
|
||||
npm commands
|
||||
|
||||
### npm-config(3)
|
||||
|
||||
Manage the npm configuration files
|
||||
|
||||
### npm-deprecate(3)
|
||||
|
||||
Deprecate a version of a package
|
||||
|
||||
### npm-docs(3)
|
||||
|
||||
Docs for a package in a web browser maybe
|
||||
|
||||
### npm-edit(3)
|
||||
|
||||
Edit an installed package
|
||||
|
||||
### npm-explore(3)
|
||||
|
||||
Browse an installed package
|
||||
|
||||
### npm-help-search(3)
|
||||
|
||||
Search the help pages
|
||||
|
||||
### npm-init(3)
|
||||
|
||||
Interactively create a package.json file
|
||||
|
||||
### npm-install(3)
|
||||
|
||||
install a package programmatically
|
||||
|
||||
### npm-link(3)
|
||||
|
||||
Symlink a package folder
|
||||
|
||||
### npm-load(3)
|
||||
|
||||
Load config settings
|
||||
|
||||
### npm-ls(3)
|
||||
|
||||
List installed packages
|
||||
|
||||
### npm-outdated(3)
|
||||
|
||||
Check for outdated packages
|
||||
|
||||
### npm-owner(3)
|
||||
|
||||
Manage package owners
|
||||
|
||||
### npm-pack(3)
|
||||
|
||||
Create a tarball from a package
|
||||
|
||||
### npm-ping(3)
|
||||
|
||||
Ping npm registry
|
||||
|
||||
### npm-prefix(3)
|
||||
|
||||
Display prefix
|
||||
|
||||
### npm-prune(3)
|
||||
|
||||
Remove extraneous packages
|
||||
|
||||
### npm-publish(3)
|
||||
|
||||
Publish a package
|
||||
|
||||
### npm-rebuild(3)
|
||||
|
||||
Rebuild a package
|
||||
|
||||
### npm-repo(3)
|
||||
|
||||
Open package repository page in the browser
|
||||
|
||||
### npm-restart(3)
|
||||
|
||||
Restart a package
|
||||
|
||||
### npm-root(3)
|
||||
|
||||
Display npm root
|
||||
|
||||
### npm-run-script(3)
|
||||
|
||||
Run arbitrary package scripts
|
||||
|
||||
### npm-search(3)
|
||||
|
||||
Search for packages
|
||||
|
||||
### npm-shrinkwrap(3)
|
||||
|
||||
programmatically generate package shrinkwrap file
|
||||
|
||||
### npm-start(3)
|
||||
|
||||
Start a package
|
||||
|
||||
### npm-stop(3)
|
||||
|
||||
Stop a package
|
||||
|
||||
### npm-tag(3)
|
||||
|
||||
Tag a published version
|
||||
|
||||
### npm-test(3)
|
||||
|
||||
Test a package
|
||||
|
||||
### npm-uninstall(3)
|
||||
|
||||
uninstall a package programmatically
|
||||
|
||||
### npm-unpublish(3)
|
||||
|
||||
Remove a package from the registry
|
||||
|
||||
### npm-update(3)
|
||||
|
||||
Update a package
|
||||
|
||||
### npm-version(3)
|
||||
|
||||
Bump a package version
|
||||
|
||||
### npm-view(3)
|
||||
|
||||
View registry info
|
||||
|
||||
### npm-whoami(3)
|
||||
|
||||
Display npm username
|
||||
|
||||
## Files
|
||||
|
||||
File system structures npm uses
|
||||
|
||||
### npm-folders(5)
|
||||
|
||||
Folder Structures Used by npm
|
||||
|
||||
### npmrc(5)
|
||||
|
||||
The npm config files
|
||||
|
||||
### package.json(5)
|
||||
|
||||
Specifics of npm's package.json handling
|
||||
|
||||
## Misc
|
||||
|
||||
Various other bits and bobs
|
||||
|
||||
### npm-coding-style(7)
|
||||
|
||||
npm's "funny" coding style
|
||||
|
||||
### npm-config(7)
|
||||
|
||||
More than you probably want to know about npm configuration
|
||||
|
||||
### npm-developers(7)
|
||||
|
||||
Developer Guide
|
||||
|
||||
### npm-disputes(7)
|
||||
|
||||
Handling Module Name Disputes
|
||||
|
||||
### npm-index(7)
|
||||
|
||||
Index of all npm documentation
|
||||
|
||||
### npm-orgs(7)
|
||||
|
||||
Working with Teams & Orgs
|
||||
|
||||
### npm-registry(7)
|
||||
|
||||
The JavaScript Package Registry
|
||||
|
||||
### npm-scope(7)
|
||||
|
||||
Scoped packages
|
||||
|
||||
### npm-scripts(7)
|
||||
|
||||
How npm handles the "scripts" field
|
||||
|
||||
### removing-npm(7)
|
||||
|
||||
Cleaning the Slate
|
||||
|
||||
### semver(7)
|
||||
|
||||
The semantic versioner for npm
|
||||
|
90
node_modules/npm/doc/misc/npm-orgs.md
generated
vendored
Normal file
90
node_modules/npm/doc/misc/npm-orgs.md
generated
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
npm-orgs(7) -- Working with Teams & Orgs
|
||||
========================================
|
||||
|
||||
## DESCRIPTION
|
||||
|
||||
There are three levels of org users:
|
||||
|
||||
1. Super admin, controls billing & adding people to the org.
|
||||
2. Team admin, manages team membership & package access.
|
||||
3. Developer, works on packages they are given access to.
|
||||
|
||||
The super admin is the only person who can add users to the org because it impacts the monthly bill. The super admin will use the website to manage membership. Every org has a `developers` team that all users are automatically added to.
|
||||
|
||||
The team admin is the person who manages team creation, team membership, and package access for teams. The team admin grants package access to teams, not individuals.
|
||||
|
||||
The developer will be able to access packages based on the teams they are on. Access is either read-write or read-only.
|
||||
|
||||
There are two main commands:
|
||||
|
||||
1. `npm team` see npm-team(1) for more details
|
||||
2. `npm access` see npm-access(1) for more details
|
||||
|
||||
## Team Admins create teams
|
||||
|
||||
* Check who you’ve added to your org:
|
||||
|
||||
```
|
||||
npm team ls <org>:developers
|
||||
```
|
||||
|
||||
* Each org is automatically given a `developers` team, so you can see the whole list of team members in your org. This team automatically gets read-write access to all packages, but you can change that with the `access` command.
|
||||
|
||||
* Create a new team:
|
||||
|
||||
```
|
||||
npm team create <org:team>
|
||||
```
|
||||
|
||||
* Add members to that team:
|
||||
|
||||
```
|
||||
npm team add <org:team> <user>
|
||||
```
|
||||
|
||||
## Publish a package and adjust package access
|
||||
|
||||
* In package directory, run
|
||||
|
||||
```
|
||||
npm init --scope=<org>
|
||||
```
|
||||
to scope it for your org & publish as usual
|
||||
|
||||
* Grant access:
|
||||
|
||||
```
|
||||
npm access grant <read-only|read-write> <org:team> [<package>]
|
||||
```
|
||||
|
||||
* Revoke access:
|
||||
|
||||
```
|
||||
npm access revoke <org:team> [<package>]
|
||||
```
|
||||
|
||||
## Monitor your package access
|
||||
|
||||
* See what org packages a team member can access:
|
||||
|
||||
```
|
||||
npm access ls-packages <org> <user>
|
||||
```
|
||||
|
||||
* See packages available to a specific team:
|
||||
|
||||
```
|
||||
npm access ls-packages <org:team>
|
||||
```
|
||||
|
||||
* Check which teams are collaborating on a package:
|
||||
|
||||
```
|
||||
npm access ls-collaborators <pkg>
|
||||
```
|
||||
|
||||
## SEE ALSO
|
||||
|
||||
* npm-team(1)
|
||||
* npm-access(1)
|
||||
* npm-scope(7)
|
69
node_modules/npm/doc/misc/npm-registry.md
generated
vendored
Normal file
69
node_modules/npm/doc/misc/npm-registry.md
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
npm-registry(7) -- The JavaScript Package Registry
|
||||
==================================================
|
||||
|
||||
## DESCRIPTION
|
||||
|
||||
To resolve packages by name and version, npm talks to a registry website
|
||||
that implements the CommonJS Package Registry specification for reading
|
||||
package info.
|
||||
|
||||
Additionally, npm's package registry implementation supports several
|
||||
write APIs as well, to allow for publishing packages and managing user
|
||||
account information.
|
||||
|
||||
The official public npm registry is at <https://registry.npmjs.org/>. It
|
||||
is powered by a CouchDB database, of which there is a public mirror at
|
||||
<https://skimdb.npmjs.com/registry>. The code for the couchapp is
|
||||
available at <https://github.com/npm/npm-registry-couchapp>.
|
||||
|
||||
The registry URL used is determined by the scope of the package (see
|
||||
`npm-scope(7)`). If no scope is specified, the default registry is used, which is
|
||||
supplied by the `registry` config parameter. See `npm-config(1)`,
|
||||
`npmrc(5)`, and `npm-config(7)` for more on managing npm's configuration.
|
||||
|
||||
## Can I run my own private registry?
|
||||
|
||||
Yes!
|
||||
|
||||
The easiest way is to replicate the couch database, and use the same (or
|
||||
similar) design doc to implement the APIs.
|
||||
|
||||
If you set up continuous replication from the official CouchDB, and then
|
||||
set your internal CouchDB as the registry config, then you'll be able
|
||||
to read any published packages, in addition to your private ones, and by
|
||||
default will only publish internally.
|
||||
|
||||
If you then want to publish a package for the whole world to see, you can
|
||||
simply override the `--registry` option for that `publish` command.
|
||||
|
||||
## I don't want my package published in the official registry. It's private.
|
||||
|
||||
Set `"private": true` in your package.json to prevent it from being
|
||||
published at all, or
|
||||
`"publishConfig":{"registry":"http://my-internal-registry.local"}`
|
||||
to force it to be published only to your internal registry.
|
||||
|
||||
See `package.json(5)` for more info on what goes in the package.json file.
|
||||
|
||||
## Will you replicate from my registry into the public one?
|
||||
|
||||
No. If you want things to be public, then publish them into the public
|
||||
registry using npm. What little security there is would be for nought
|
||||
otherwise.
|
||||
|
||||
## Do I have to use couchdb to build a registry that npm can talk to?
|
||||
|
||||
No, but it's way easier. Basically, yes, you do, or you have to
|
||||
effectively implement the entire CouchDB API anyway.
|
||||
|
||||
## Is there a website or something to see package docs and such?
|
||||
|
||||
Yes, head over to <https://npmjs.com/>
|
||||
|
||||
## SEE ALSO
|
||||
|
||||
* npm-config(1)
|
||||
* npm-config(7)
|
||||
* npmrc(5)
|
||||
* npm-developers(7)
|
||||
* npm-disputes(7)
|
107
node_modules/npm/doc/misc/npm-scope.md
generated
vendored
Normal file
107
node_modules/npm/doc/misc/npm-scope.md
generated
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
npm-scope(7) -- Scoped packages
|
||||
===============================
|
||||
|
||||
## DESCRIPTION
|
||||
|
||||
All npm packages have a name. Some package names also have a scope. A scope
|
||||
follows the usual rules for package names (url-safe characters, no leading dots
|
||||
or underscores). When used in package names, preceded by an @-symbol and
|
||||
followed by a slash, e.g.
|
||||
|
||||
@somescope/somepackagename
|
||||
|
||||
Scopes are a way of grouping related packages together, and also affect a few
|
||||
things about the way npm treats the package.
|
||||
|
||||
Scoped packages can be published and installed as of `npm@2` and are supported
|
||||
by the primary npm registry. The npm client is backwards-compatible with
|
||||
un-scoped registries, so it can be used to work with scoped and un-scoped
|
||||
registries at the same time.
|
||||
|
||||
## Installing scoped packages
|
||||
|
||||
Scoped packages are installed to a sub-folder of the regular installation
|
||||
folder, e.g. if your other packages are installed in `node_modules/packagename`,
|
||||
scoped modules will be in `node_modules/@myorg/packagename`. The scope folder
|
||||
(`@myorg`) is simply the name of the scope preceded by an @-symbol, and can
|
||||
contain any number of scoped packages.
|
||||
|
||||
A scoped package is installed by referencing it by name, preceded by an
|
||||
@-symbol, in `npm install`:
|
||||
|
||||
npm install @myorg/mypackage
|
||||
|
||||
Or in `package.json`:
|
||||
|
||||
"dependencies": {
|
||||
"@myorg/mypackage": "^1.3.0"
|
||||
}
|
||||
|
||||
Note that if the @-symbol is omitted in either case npm will instead attempt to
|
||||
install from GitHub; see `npm-install(1)`.
|
||||
|
||||
## Requiring scoped packages
|
||||
|
||||
Because scoped packages are installed into a scope folder, you have to
|
||||
include the name of the scope when requiring them in your code, e.g.
|
||||
|
||||
require('@myorg/mypackage')
|
||||
|
||||
There is nothing special about the way Node treats scope folders, this is
|
||||
just specifying to require the module `mypackage` in the folder called `@myorg`.
|
||||
|
||||
## Publishing scoped packages
|
||||
|
||||
Scoped packages can be published from the CLI as of `npm@2` and can be
|
||||
published to any registry that supports them, including the primary npm
|
||||
registry.
|
||||
|
||||
(As of 2015-04-19, and with npm 2.0 or newer, the primary npm registry **does**
|
||||
support scoped packages)
|
||||
|
||||
If you wish, you may associate a scope with a registry; see below.
|
||||
|
||||
### Publishing public scoped packages to the primary npm registry
|
||||
|
||||
To publish a public scoped package, you must specify `--access public` with
|
||||
the initial publication. This will publish the package and set access
|
||||
to `public` as if you had run `npm access public` after publishing.
|
||||
|
||||
### Publishing private scoped packages to the npm registry
|
||||
|
||||
To publish a private scoped package to the npm registry, you must have
|
||||
an [npm Private Modules](https://www.npmjs.com/private-modules)
|
||||
account.
|
||||
|
||||
You can then publish the module with `npm publish` or `npm publish
|
||||
--access restricted`, and it will be present in the npm registry, with
|
||||
restricted access. You can then change the access permissions, if
|
||||
desired, with `npm access` or on the npmjs.com website.
|
||||
|
||||
## Associating a scope with a registry
|
||||
|
||||
Scopes can be associated with a separate registry. This allows you to
|
||||
seamlessly use a mix of packages from the primary npm registry and one or more
|
||||
private registries, such as npm Enterprise.
|
||||
|
||||
You can associate a scope with a registry at login, e.g.
|
||||
|
||||
npm login --registry=http://reg.example.com --scope=@myco
|
||||
|
||||
Scopes have a many-to-one relationship with registries: one registry can
|
||||
host multiple scopes, but a scope only ever points to one registry.
|
||||
|
||||
You can also associate a scope with a registry using `npm config`:
|
||||
|
||||
npm config set @myco:registry http://reg.example.com
|
||||
|
||||
Once a scope is associated with a registry, any `npm install` for a package
|
||||
with that scope will request packages from that registry instead. Any
|
||||
`npm publish` for a package name that contains the scope will be published to
|
||||
that registry instead.
|
||||
|
||||
## SEE ALSO
|
||||
|
||||
* npm-install(1)
|
||||
* npm-publish(1)
|
||||
* npm-access(1)
|
232
node_modules/npm/doc/misc/npm-scripts.md
generated
vendored
Normal file
232
node_modules/npm/doc/misc/npm-scripts.md
generated
vendored
Normal file
@@ -0,0 +1,232 @@
|
||||
npm-scripts(7) -- How npm handles the "scripts" field
|
||||
=====================================================
|
||||
|
||||
## DESCRIPTION
|
||||
|
||||
npm supports the "scripts" property of the package.json script, for the
|
||||
following scripts:
|
||||
|
||||
* prepublish:
|
||||
Run BEFORE the package is published. (Also run on local `npm
|
||||
install` without any arguments.)
|
||||
* publish, postpublish:
|
||||
Run AFTER the package is published.
|
||||
* preinstall:
|
||||
Run BEFORE the package is installed
|
||||
* install, postinstall:
|
||||
Run AFTER the package is installed.
|
||||
* preuninstall, uninstall:
|
||||
Run BEFORE the package is uninstalled.
|
||||
* postuninstall:
|
||||
Run AFTER the package is uninstalled.
|
||||
* preversion, version:
|
||||
Run BEFORE bumping the package version.
|
||||
* postversion:
|
||||
Run AFTER bumping the package version.
|
||||
* pretest, test, posttest:
|
||||
Run by the `npm test` command.
|
||||
* prestop, stop, poststop:
|
||||
Run by the `npm stop` command.
|
||||
* prestart, start, poststart:
|
||||
Run by the `npm start` command.
|
||||
* prerestart, restart, postrestart:
|
||||
Run by the `npm restart` command. Note: `npm restart` will run the
|
||||
stop and start scripts if no `restart` script is provided.
|
||||
|
||||
Additionally, arbitrary scripts can be executed by running `npm
|
||||
run-script <stage>`. *Pre* and *post* commands with matching
|
||||
names will be run for those as well (e.g. `premyscript`, `myscript`,
|
||||
`postmyscript`). Scripts from dependencies can be run with `npm explore
|
||||
<pkg> -- npm run <stage>`.
|
||||
|
||||
## COMMON USES
|
||||
|
||||
If you need to perform operations on your package before it is used, in a way
|
||||
that is not dependent on the operating system or architecture of the
|
||||
target system, use a `prepublish` script. This includes
|
||||
tasks such as:
|
||||
|
||||
* Compiling CoffeeScript source code into JavaScript.
|
||||
* Creating minified versions of JavaScript source code.
|
||||
* Fetching remote resources that your package will use.
|
||||
|
||||
The advantage of doing these things at `prepublish` time is that they can be done once, in a
|
||||
single place, thus reducing complexity and variability.
|
||||
Additionally, this means that:
|
||||
|
||||
* You can depend on `coffee-script` as a `devDependency`, and thus
|
||||
your users don't need to have it installed.
|
||||
* You don't need to include minifiers in your package, reducing
|
||||
the size for your users.
|
||||
* You don't need to rely on your users having `curl` or `wget` or
|
||||
other system tools on the target machines.
|
||||
|
||||
## DEFAULT VALUES
|
||||
|
||||
npm will default some script values based on package contents.
|
||||
|
||||
* `"start": "node server.js"`:
|
||||
|
||||
If there is a `server.js` file in the root of your package, then npm
|
||||
will default the `start` command to `node server.js`.
|
||||
|
||||
* `"install": "node-gyp rebuild"`:
|
||||
|
||||
If there is a `binding.gyp` file in the root of your package and you
|
||||
haven't defined your own `install` or `preinstall` scripts, npm will
|
||||
default the `install` command to compile using node-gyp.
|
||||
|
||||
## USER
|
||||
|
||||
If npm was invoked with root privileges, then it will change the uid
|
||||
to the user account or uid specified by the `user` config, which
|
||||
defaults to `nobody`. Set the `unsafe-perm` flag to run scripts with
|
||||
root privileges.
|
||||
|
||||
## ENVIRONMENT
|
||||
|
||||
Package scripts run in an environment where many pieces of information
|
||||
are made available regarding the setup of npm and the current state of
|
||||
the process.
|
||||
|
||||
|
||||
### path
|
||||
|
||||
If you depend on modules that define executable scripts, like test
|
||||
suites, then those executables will be added to the `PATH` for
|
||||
executing the scripts. So, if your package.json has this:
|
||||
|
||||
{ "name" : "foo"
|
||||
, "dependencies" : { "bar" : "0.1.x" }
|
||||
, "scripts": { "start" : "bar ./test" } }
|
||||
|
||||
then you could run `npm start` to execute the `bar` script, which is
|
||||
exported into the `node_modules/.bin` directory on `npm install`.
|
||||
|
||||
### package.json vars
|
||||
|
||||
The package.json fields are tacked onto the `npm_package_` prefix. So,
|
||||
for instance, if you had `{"name":"foo", "version":"1.2.5"}` in your
|
||||
package.json file, then your package scripts would have the
|
||||
`npm_package_name` environment variable set to "foo", and the
|
||||
`npm_package_version` set to "1.2.5"
|
||||
|
||||
### configuration
|
||||
|
||||
Configuration parameters are put in the environment with the
|
||||
`npm_config_` prefix. For instance, you can view the effective `root`
|
||||
config by checking the `npm_config_root` environment variable.
|
||||
|
||||
### Special: package.json "config" object
|
||||
|
||||
The package.json "config" keys are overwritten in the environment if
|
||||
there is a config param of `<name>[@<version>]:<key>`. For example,
|
||||
if the package.json has this:
|
||||
|
||||
{ "name" : "foo"
|
||||
, "config" : { "port" : "8080" }
|
||||
, "scripts" : { "start" : "node server.js" } }
|
||||
|
||||
and the server.js is this:
|
||||
|
||||
http.createServer(...).listen(process.env.npm_package_config_port)
|
||||
|
||||
then the user could change the behavior by doing:
|
||||
|
||||
npm config set foo:port 80
|
||||
|
||||
### current lifecycle event
|
||||
|
||||
Lastly, the `npm_lifecycle_event` environment variable is set to
|
||||
whichever stage of the cycle is being executed. So, you could have a
|
||||
single script used for different parts of the process which switches
|
||||
based on what's currently happening.
|
||||
|
||||
Objects are flattened following this format, so if you had
|
||||
`{"scripts":{"install":"foo.js"}}` in your package.json, then you'd
|
||||
see this in the script:
|
||||
|
||||
process.env.npm_package_scripts_install === "foo.js"
|
||||
|
||||
## EXAMPLES
|
||||
|
||||
For example, if your package.json contains this:
|
||||
|
||||
{ "scripts" :
|
||||
{ "install" : "scripts/install.js"
|
||||
, "postinstall" : "scripts/install.js"
|
||||
, "uninstall" : "scripts/uninstall.js"
|
||||
}
|
||||
}
|
||||
|
||||
then `scripts/install.js` will be called for the install
|
||||
and post-install stages of the lifecycle, and `scripts/uninstall.js`
|
||||
will be called when the package is uninstalled. Since
|
||||
`scripts/install.js` is running for two different phases, it would
|
||||
be wise in this case to look at the `npm_lifecycle_event` environment
|
||||
variable.
|
||||
|
||||
If you want to run a make command, you can do so. This works just
|
||||
fine:
|
||||
|
||||
{ "scripts" :
|
||||
{ "preinstall" : "./configure"
|
||||
, "install" : "make && make install"
|
||||
, "test" : "make test"
|
||||
}
|
||||
}
|
||||
|
||||
## EXITING
|
||||
|
||||
Scripts are run by passing the line as a script argument to `sh`.
|
||||
|
||||
If the script exits with a code other than 0, then this will abort the
|
||||
process.
|
||||
|
||||
Note that these script files don't have to be nodejs or even
|
||||
javascript programs. They just have to be some kind of executable
|
||||
file.
|
||||
|
||||
## HOOK SCRIPTS
|
||||
|
||||
If you want to run a specific script at a specific lifecycle event for
|
||||
ALL packages, then you can use a hook script.
|
||||
|
||||
Place an executable file at `node_modules/.hooks/{eventname}`, and
|
||||
it'll get run for all packages when they are going through that point
|
||||
in the package lifecycle for any packages installed in that root.
|
||||
|
||||
Hook scripts are run exactly the same way as package.json scripts.
|
||||
That is, they are in a separate child process, with the env described
|
||||
above.
|
||||
|
||||
## BEST PRACTICES
|
||||
|
||||
* Don't exit with a non-zero error code unless you *really* mean it.
|
||||
Except for uninstall scripts, this will cause the npm action to
|
||||
fail, and potentially be rolled back. If the failure is minor or
|
||||
only will prevent some optional features, then it's better to just
|
||||
print a warning and exit successfully.
|
||||
* Try not to use scripts to do what npm can do for you. Read through
|
||||
`package.json(5)` to see all the things that you can specify and enable
|
||||
by simply describing your package appropriately. In general, this
|
||||
will lead to a more robust and consistent state.
|
||||
* Inspect the env to determine where to put things. For instance, if
|
||||
the `npm_config_binroot` environment variable is set to `/home/user/bin`, then
|
||||
don't try to install executables into `/usr/local/bin`. The user
|
||||
probably set it up that way for a reason.
|
||||
* Don't prefix your script commands with "sudo". If root permissions
|
||||
are required for some reason, then it'll fail with that error, and
|
||||
the user will sudo the npm command in question.
|
||||
* Don't use `install`. Use a `.gyp` file for compilation, and `prepublish`
|
||||
for anything else. You should almost never have to explicitly set a
|
||||
preinstall or install script. If you are doing this, please consider if
|
||||
there is another option. The only valid use of `install` or `preinstall`
|
||||
scripts is for compilation which must be done on the target architecture.
|
||||
|
||||
## SEE ALSO
|
||||
|
||||
* npm-run-script(1)
|
||||
* package.json(5)
|
||||
* npm-developers(7)
|
||||
* npm-install(1)
|
54
node_modules/npm/doc/misc/removing-npm.md
generated
vendored
Normal file
54
node_modules/npm/doc/misc/removing-npm.md
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
npm-removal(1) -- Cleaning the Slate
|
||||
====================================
|
||||
|
||||
## SYNOPSIS
|
||||
|
||||
So sad to see you go.
|
||||
|
||||
sudo npm uninstall npm -g
|
||||
|
||||
Or, if that fails, get the npm source code, and do:
|
||||
|
||||
sudo make uninstall
|
||||
|
||||
## More Severe Uninstalling
|
||||
|
||||
Usually, the above instructions are sufficient. That will remove
|
||||
npm, but leave behind anything you've installed.
|
||||
|
||||
If that doesn't work, or if you require more drastic measures,
|
||||
continue reading.
|
||||
|
||||
Note that this is only necessary for globally-installed packages. Local
|
||||
installs are completely contained within a project's `node_modules`
|
||||
folder. Delete that folder, and everything is gone (unless a package's
|
||||
install script is particularly ill-behaved).
|
||||
|
||||
This assumes that you installed node and npm in the default place. If
|
||||
you configured node with a different `--prefix`, or installed npm with a
|
||||
different prefix setting, then adjust the paths accordingly, replacing
|
||||
`/usr/local` with your install prefix.
|
||||
|
||||
To remove everything npm-related manually:
|
||||
|
||||
rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/npm*
|
||||
|
||||
If you installed things *with* npm, then your best bet is to uninstall
|
||||
them with npm first, and then install them again once you have a
|
||||
proper install. This can help find any symlinks that are lying
|
||||
around:
|
||||
|
||||
ls -laF /usr/local/{lib/node{,/.npm},bin,share/man} | grep npm
|
||||
|
||||
Prior to version 0.3, npm used shim files for executables and node
|
||||
modules. To track those down, you can do the following:
|
||||
|
||||
find /usr/local/{lib/node,bin} -exec grep -l npm \{\} \; ;
|
||||
|
||||
(This is also in the README file.)
|
||||
|
||||
## SEE ALSO
|
||||
|
||||
* README
|
||||
* npm-uninstall(1)
|
||||
* npm-prune(1)
|
327
node_modules/npm/doc/misc/semver.md
generated
vendored
Normal file
327
node_modules/npm/doc/misc/semver.md
generated
vendored
Normal file
@@ -0,0 +1,327 @@
|
||||
semver(7) -- The semantic versioner for npm
|
||||
===========================================
|
||||
|
||||
## Usage
|
||||
|
||||
$ npm install semver
|
||||
|
||||
semver.valid('1.2.3') // '1.2.3'
|
||||
semver.valid('a.b.c') // null
|
||||
semver.clean(' =v1.2.3 ') // '1.2.3'
|
||||
semver.satisfies('1.2.3', '1.x || >=2.5.0 || 5.0.0 - 7.2.3') // true
|
||||
semver.gt('1.2.3', '9.8.7') // false
|
||||
semver.lt('1.2.3', '9.8.7') // true
|
||||
|
||||
As a command-line utility:
|
||||
|
||||
$ semver -h
|
||||
|
||||
Usage: semver <version> [<version> [...]] [-r <range> | -i <inc> | --preid <identifier> | -l | -rv]
|
||||
Test if version(s) satisfy the supplied range(s), and sort them.
|
||||
|
||||
Multiple versions or ranges may be supplied, unless increment
|
||||
option is specified. In that case, only a single version may
|
||||
be used, and it is incremented by the specified level
|
||||
|
||||
Program exits successfully if any valid version satisfies
|
||||
all supplied ranges, and prints all satisfying versions.
|
||||
|
||||
If no versions are valid, or ranges are not satisfied,
|
||||
then exits failure.
|
||||
|
||||
Versions are printed in ascending order, so supplying
|
||||
multiple versions to the utility will just sort them.
|
||||
|
||||
## Versions
|
||||
|
||||
A "version" is described by the `v2.0.0` specification found at
|
||||
<http://semver.org/>.
|
||||
|
||||
A leading `"="` or `"v"` character is stripped off and ignored.
|
||||
|
||||
## Ranges
|
||||
|
||||
A `version range` is a set of `comparators` which specify versions
|
||||
that satisfy the range.
|
||||
|
||||
A `comparator` is composed of an `operator` and a `version`. The set
|
||||
of primitive `operators` is:
|
||||
|
||||
* `<` Less than
|
||||
* `<=` Less than or equal to
|
||||
* `>` Greater than
|
||||
* `>=` Greater than or equal to
|
||||
* `=` Equal. If no operator is specified, then equality is assumed,
|
||||
so this operator is optional, but MAY be included.
|
||||
|
||||
For example, the comparator `>=1.2.7` would match the versions
|
||||
`1.2.7`, `1.2.8`, `2.5.3`, and `1.3.9`, but not the versions `1.2.6`
|
||||
or `1.1.0`.
|
||||
|
||||
Comparators can be joined by whitespace to form a `comparator set`,
|
||||
which is satisfied by the **intersection** of all of the comparators
|
||||
it includes.
|
||||
|
||||
A range is composed of one or more comparator sets, joined by `||`. A
|
||||
version matches a range if and only if every comparator in at least
|
||||
one of the `||`-separated comparator sets is satisfied by the version.
|
||||
|
||||
For example, the range `>=1.2.7 <1.3.0` would match the versions
|
||||
`1.2.7`, `1.2.8`, and `1.2.99`, but not the versions `1.2.6`, `1.3.0`,
|
||||
or `1.1.0`.
|
||||
|
||||
The range `1.2.7 || >=1.2.9 <2.0.0` would match the versions `1.2.7`,
|
||||
`1.2.9`, and `1.4.6`, but not the versions `1.2.8` or `2.0.0`.
|
||||
|
||||
### Prerelease Tags
|
||||
|
||||
If a version has a prerelease tag (for example, `1.2.3-alpha.3`) then
|
||||
it will only be allowed to satisfy comparator sets if at least one
|
||||
comparator with the same `[major, minor, patch]` tuple also has a
|
||||
prerelease tag.
|
||||
|
||||
For example, the range `>1.2.3-alpha.3` would be allowed to match the
|
||||
version `1.2.3-alpha.7`, but it would *not* be satisfied by
|
||||
`3.4.5-alpha.9`, even though `3.4.5-alpha.9` is technically "greater
|
||||
than" `1.2.3-alpha.3` according to the SemVer sort rules. The version
|
||||
range only accepts prerelease tags on the `1.2.3` version. The
|
||||
version `3.4.5` *would* satisfy the range, because it does not have a
|
||||
prerelease flag, and `3.4.5` is greater than `1.2.3-alpha.7`.
|
||||
|
||||
The purpose for this behavior is twofold. First, prerelease versions
|
||||
frequently are updated very quickly, and contain many breaking changes
|
||||
that are (by the author's design) not yet fit for public consumption.
|
||||
Therefore, by default, they are excluded from range matching
|
||||
semantics.
|
||||
|
||||
Second, a user who has opted into using a prerelease version has
|
||||
clearly indicated the intent to use *that specific* set of
|
||||
alpha/beta/rc versions. By including a prerelease tag in the range,
|
||||
the user is indicating that they are aware of the risk. However, it
|
||||
is still not appropriate to assume that they have opted into taking a
|
||||
similar risk on the *next* set of prerelease versions.
|
||||
|
||||
#### Prerelease Identifiers
|
||||
|
||||
The method `.inc` takes an additional `identifier` string argument that
|
||||
will append the value of the string as a prerelease identifier:
|
||||
|
||||
```javascript
|
||||
> semver.inc('1.2.3', 'prerelease', 'beta')
|
||||
'1.2.4-beta.0'
|
||||
```
|
||||
|
||||
command-line example:
|
||||
|
||||
```shell
|
||||
$ semver 1.2.3 -i prerelease --preid beta
|
||||
1.2.4-beta.0
|
||||
```
|
||||
|
||||
Which then can be used to increment further:
|
||||
|
||||
```shell
|
||||
$ semver 1.2.4-beta.0 -i prerelease
|
||||
1.2.4-beta.1
|
||||
```
|
||||
|
||||
### Advanced Range Syntax
|
||||
|
||||
Advanced range syntax desugars to primitive comparators in
|
||||
deterministic ways.
|
||||
|
||||
Advanced ranges may be combined in the same way as primitive
|
||||
comparators using white space or `||`.
|
||||
|
||||
#### Hyphen Ranges `X.Y.Z - A.B.C`
|
||||
|
||||
Specifies an inclusive set.
|
||||
|
||||
* `1.2.3 - 2.3.4` := `>=1.2.3 <=2.3.4`
|
||||
|
||||
If a partial version is provided as the first version in the inclusive
|
||||
range, then the missing pieces are replaced with zeroes.
|
||||
|
||||
* `1.2 - 2.3.4` := `>=1.2.0 <=2.3.4`
|
||||
|
||||
If a partial version is provided as the second version in the
|
||||
inclusive range, then all versions that start with the supplied parts
|
||||
of the tuple are accepted, but nothing that would be greater than the
|
||||
provided tuple parts.
|
||||
|
||||
* `1.2.3 - 2.3` := `>=1.2.3 <2.4.0`
|
||||
* `1.2.3 - 2` := `>=1.2.3 <3.0.0`
|
||||
|
||||
#### X-Ranges `1.2.x` `1.X` `1.2.*` `*`
|
||||
|
||||
Any of `X`, `x`, or `*` may be used to "stand in" for one of the
|
||||
numeric values in the `[major, minor, patch]` tuple.
|
||||
|
||||
* `*` := `>=0.0.0` (Any version satisfies)
|
||||
* `1.x` := `>=1.0.0 <2.0.0` (Matching major version)
|
||||
* `1.2.x` := `>=1.2.0 <1.3.0` (Matching major and minor versions)
|
||||
|
||||
A partial version range is treated as an X-Range, so the special
|
||||
character is in fact optional.
|
||||
|
||||
* `""` (empty string) := `*` := `>=0.0.0`
|
||||
* `1` := `1.x.x` := `>=1.0.0 <2.0.0`
|
||||
* `1.2` := `1.2.x` := `>=1.2.0 <1.3.0`
|
||||
|
||||
#### Tilde Ranges `~1.2.3` `~1.2` `~1`
|
||||
|
||||
Allows patch-level changes if a minor version is specified on the
|
||||
comparator. Allows minor-level changes if not.
|
||||
|
||||
* `~1.2.3` := `>=1.2.3 <1.(2+1).0` := `>=1.2.3 <1.3.0`
|
||||
* `~1.2` := `>=1.2.0 <1.(2+1).0` := `>=1.2.0 <1.3.0` (Same as `1.2.x`)
|
||||
* `~1` := `>=1.0.0 <(1+1).0.0` := `>=1.0.0 <2.0.0` (Same as `1.x`)
|
||||
* `~0.2.3` := `>=0.2.3 <0.(2+1).0` := `>=0.2.3 <0.3.0`
|
||||
* `~0.2` := `>=0.2.0 <0.(2+1).0` := `>=0.2.0 <0.3.0` (Same as `0.2.x`)
|
||||
* `~0` := `>=0.0.0 <(0+1).0.0` := `>=0.0.0 <1.0.0` (Same as `0.x`)
|
||||
* `~1.2.3-beta.2` := `>=1.2.3-beta.2 <1.3.0` Note that prereleases in
|
||||
the `1.2.3` version will be allowed, if they are greater than or
|
||||
equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but
|
||||
`1.2.4-beta.2` would not, because it is a prerelease of a
|
||||
different `[major, minor, patch]` tuple.
|
||||
|
||||
#### Caret Ranges `^1.2.3` `^0.2.5` `^0.0.4`
|
||||
|
||||
Allows changes that do not modify the left-most non-zero digit in the
|
||||
`[major, minor, patch]` tuple. In other words, this allows patch and
|
||||
minor updates for versions `1.0.0` and above, patch updates for
|
||||
versions `0.X >=0.1.0`, and *no* updates for versions `0.0.X`.
|
||||
|
||||
Many authors treat a `0.x` version as if the `x` were the major
|
||||
"breaking-change" indicator.
|
||||
|
||||
Caret ranges are ideal when an author may make breaking changes
|
||||
between `0.2.4` and `0.3.0` releases, which is a common practice.
|
||||
However, it presumes that there will *not* be breaking changes between
|
||||
`0.2.4` and `0.2.5`. It allows for changes that are presumed to be
|
||||
additive (but non-breaking), according to commonly observed practices.
|
||||
|
||||
* `^1.2.3` := `>=1.2.3 <2.0.0`
|
||||
* `^0.2.3` := `>=0.2.3 <0.3.0`
|
||||
* `^0.0.3` := `>=0.0.3 <0.0.4`
|
||||
* `^1.2.3-beta.2` := `>=1.2.3-beta.2 <2.0.0` Note that prereleases in
|
||||
the `1.2.3` version will be allowed, if they are greater than or
|
||||
equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but
|
||||
`1.2.4-beta.2` would not, because it is a prerelease of a
|
||||
different `[major, minor, patch]` tuple.
|
||||
* `^0.0.3-beta` := `>=0.0.3-beta <0.0.4` Note that prereleases in the
|
||||
`0.0.3` version *only* will be allowed, if they are greater than or
|
||||
equal to `beta`. So, `0.0.3-pr.2` would be allowed.
|
||||
|
||||
When parsing caret ranges, a missing `patch` value desugars to the
|
||||
number `0`, but will allow flexibility within that value, even if the
|
||||
major and minor versions are both `0`.
|
||||
|
||||
* `^1.2.x` := `>=1.2.0 <2.0.0`
|
||||
* `^0.0.x` := `>=0.0.0 <0.1.0`
|
||||
* `^0.0` := `>=0.0.0 <0.1.0`
|
||||
|
||||
A missing `minor` and `patch` values will desugar to zero, but also
|
||||
allow flexibility within those values, even if the major version is
|
||||
zero.
|
||||
|
||||
* `^1.x` := `>=1.0.0 <2.0.0`
|
||||
* `^0.x` := `>=0.0.0 <1.0.0`
|
||||
|
||||
### Range Grammar
|
||||
|
||||
Putting all this together, here is a Backus-Naur grammar for ranges,
|
||||
for the benefit of parser authors:
|
||||
|
||||
```bnf
|
||||
range-set ::= range ( logical-or range ) *
|
||||
logical-or ::= ( ' ' ) * '||' ( ' ' ) *
|
||||
range ::= hyphen | simple ( ' ' simple ) * | ''
|
||||
hyphen ::= partial ' - ' partial
|
||||
simple ::= primitive | partial | tilde | caret
|
||||
primitive ::= ( '<' | '>' | '>=' | '<=' | '=' | ) partial
|
||||
partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )?
|
||||
xr ::= 'x' | 'X' | '*' | nr
|
||||
nr ::= '0' | ['1'-'9']['0'-'9']+
|
||||
tilde ::= '~' partial
|
||||
caret ::= '^' partial
|
||||
qualifier ::= ( '-' pre )? ( '+' build )?
|
||||
pre ::= parts
|
||||
build ::= parts
|
||||
parts ::= part ( '.' part ) *
|
||||
part ::= nr | [-0-9A-Za-z]+
|
||||
```
|
||||
|
||||
## Functions
|
||||
|
||||
All methods and classes take a final `loose` boolean argument that, if
|
||||
true, will be more forgiving about not-quite-valid semver strings.
|
||||
The resulting output will always be 100% strict, of course.
|
||||
|
||||
Strict-mode Comparators and Ranges will be strict about the SemVer
|
||||
strings that they parse.
|
||||
|
||||
* `valid(v)`: Return the parsed version, or null if it's not valid.
|
||||
* `inc(v, release)`: Return the version incremented by the release
|
||||
type (`major`, `premajor`, `minor`, `preminor`, `patch`,
|
||||
`prepatch`, or `prerelease`), or null if it's not valid
|
||||
* `premajor` in one call will bump the version up to the next major
|
||||
version and down to a prerelease of that major version.
|
||||
`preminor`, and `prepatch` work the same way.
|
||||
* If called from a non-prerelease version, the `prerelease` will work the
|
||||
same as `prepatch`. It increments the patch version, then makes a
|
||||
prerelease. If the input version is already a prerelease it simply
|
||||
increments it.
|
||||
* `major(v)`: Return the major version number.
|
||||
* `minor(v)`: Return the minor version number.
|
||||
* `patch(v)`: Return the patch version number.
|
||||
|
||||
### Comparison
|
||||
|
||||
* `gt(v1, v2)`: `v1 > v2`
|
||||
* `gte(v1, v2)`: `v1 >= v2`
|
||||
* `lt(v1, v2)`: `v1 < v2`
|
||||
* `lte(v1, v2)`: `v1 <= v2`
|
||||
* `eq(v1, v2)`: `v1 == v2` This is true if they're logically equivalent,
|
||||
even if they're not the exact same string. You already know how to
|
||||
compare strings.
|
||||
* `neq(v1, v2)`: `v1 != v2` The opposite of `eq`.
|
||||
* `cmp(v1, comparator, v2)`: Pass in a comparison string, and it'll call
|
||||
the corresponding function above. `"==="` and `"!=="` do simple
|
||||
string comparison, but are included for completeness. Throws if an
|
||||
invalid comparison string is provided.
|
||||
* `compare(v1, v2)`: Return `0` if `v1 == v2`, or `1` if `v1` is greater, or `-1` if
|
||||
`v2` is greater. Sorts in ascending order if passed to `Array.sort()`.
|
||||
* `rcompare(v1, v2)`: The reverse of compare. Sorts an array of versions
|
||||
in descending order when passed to `Array.sort()`.
|
||||
* `diff(v1, v2)`: Returns difference between two versions by the release type
|
||||
(`major`, `premajor`, `minor`, `preminor`, `patch`, `prepatch`, or `prerelease`),
|
||||
or null if the versions are the same.
|
||||
|
||||
|
||||
### Ranges
|
||||
|
||||
* `validRange(range)`: Return the valid range or null if it's not valid
|
||||
* `satisfies(version, range)`: Return true if the version satisfies the
|
||||
range.
|
||||
* `maxSatisfying(versions, range)`: Return the highest version in the list
|
||||
that satisfies the range, or `null` if none of them do.
|
||||
* `gtr(version, range)`: Return `true` if version is greater than all the
|
||||
versions possible in the range.
|
||||
* `ltr(version, range)`: Return `true` if version is less than all the
|
||||
versions possible in the range.
|
||||
* `outside(version, range, hilo)`: Return true if the version is outside
|
||||
the bounds of the range in either the high or low direction. The
|
||||
`hilo` argument must be either the string `'>'` or `'<'`. (This is
|
||||
the function called by `gtr` and `ltr`.)
|
||||
|
||||
Note that, since ranges may be non-contiguous, a version might not be
|
||||
greater than a range, less than a range, *or* satisfy a range! For
|
||||
example, the range `1.2 <1.2.9 || >2.0.0` would have a hole from `1.2.9`
|
||||
until `2.0.0`, so the version `1.2.10` would not be greater than the
|
||||
range (because `2.0.1` satisfies, which is higher), nor less than the
|
||||
range (since `1.2.8` satisfies, which is lower), and it also does not
|
||||
satisfy the range.
|
||||
|
||||
If you want to know if a version satisfies or does not satisfy a
|
||||
range, use the `satisfies(version, range)` function.
|
Reference in New Issue
Block a user