mirror of
https://github.com/titanscouting/tra-analysis.git
synced 2025-09-06 15:07:21 +00:00
push all website files
This commit is contained in:
192
website/node_modules/npm/doc/misc/npm-coding-style.md
generated
vendored
Normal file
192
website/node_modules/npm/doc/misc/npm-coding-style.md
generated
vendored
Normal file
@@ -0,0 +1,192 @@
|
||||
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
|
||||
|
||||
## Quotes
|
||||
Use single quotes for strings except to avoid escaping.
|
||||
|
||||
Bad:
|
||||
|
||||
var notOk = "Just double quotes"
|
||||
|
||||
Good:
|
||||
|
||||
var ok = 'String contains "double" quotes'
|
||||
var alsoOk = "String contains 'single' quotes or apostrophe"
|
||||
|
||||
## 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 forbidden.
|
||||
|
||||
## SEE ALSO
|
||||
|
||||
* npm-developers(7)
|
||||
* npm(1)
|
1243
website/node_modules/npm/doc/misc/npm-config.md
generated
vendored
Normal file
1243
website/node_modules/npm/doc/misc/npm-config.md
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
233
website/node_modules/npm/doc/misc/npm-developers.md
generated
vendored
Normal file
233
website/node_modules/npm/doc/misc/npm-developers.md
generated
vendored
Normal file
@@ -0,0 +1,233 @@
|
||||
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`
|
||||
|
||||
If, given the structure of your project, you find `.npmignore` to be a
|
||||
maintenance headache, you might instead try populating the `files`
|
||||
property of `package.json`, which is an array of file or directory names
|
||||
that should be included in your package. Sometimes a whitelist is easier
|
||||
to manage than a blacklist.
|
||||
|
||||
### Testing whether your `.npmignore` or `files` config works
|
||||
|
||||
If you want to double check that your package will include only the files
|
||||
you intend it to when published, you can run the `npm pack` command locally
|
||||
which will generate a tarball in the working directory, the same way it
|
||||
does for publishing.
|
||||
|
||||
## 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(1)
|
||||
* npm-init(1)
|
||||
* package.json(5)
|
||||
* npm-scripts(7)
|
||||
* npm-publish(1)
|
||||
* npm-adduser(1)
|
||||
* npm-registry(7)
|
130
website/node_modules/npm/doc/misc/npm-disputes.md
generated
vendored
Normal file
130
website/node_modules/npm/doc/misc/npm-disputes.md
generated
vendored
Normal file
@@ -0,0 +1,130 @@
|
||||
npm-disputes(7) -- Handling Module Name Disputes
|
||||
================================================
|
||||
|
||||
This document describes the steps that you should take to resolve module name
|
||||
disputes with other npm publishers. It also describes special steps you should
|
||||
take about names you think infringe your trademarks.
|
||||
|
||||
This document is a clarification of the acceptable behavior outlined in the
|
||||
[npm Code of Conduct](https://www.npmjs.com/policies/conduct), and nothing in
|
||||
this document should be interpreted to contradict any aspect of the npm Code of
|
||||
Conduct.
|
||||
|
||||
## TL;DR
|
||||
|
||||
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. Alice writes a JavaScript module `foo`, which is not node-specific. Alice
|
||||
doesn't use node at all. Yusuf wants to use `foo` in node, so he wraps it in
|
||||
an npm module. Some time later, Alice starts using node, and wants to take
|
||||
over management of her program.
|
||||
2. Yusuf writes an npm module `foo`, and publishes it. Perhaps much later, Alice
|
||||
finds a bug in `foo`, and fixes it. She sends a pull request to Yusuf, but
|
||||
Yusuf 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. Alice would like to publish a new `foo`, but can't,
|
||||
because the name is taken.
|
||||
3. Yusuf 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. Alice 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. Yusuf 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, Alice writes a much more complete `foo` parser, but can't publish,
|
||||
because Yusuf's `foo` is in the way.
|
||||
|
||||
1. `npm owner ls foo`. This will tell Alice the email address of the owner
|
||||
(Yusuf).
|
||||
2. Alice emails Yusuf, explaining the situation **as respectfully as possible**,
|
||||
and what she would like to do with the module name. She adds the npm support
|
||||
staff <support@npmjs.com> to the CC list of the email. Mention in the email
|
||||
that Yusuf can run npm owner `add alice foo` to add Alice as an owner of the
|
||||
foo package.
|
||||
3. After a reasonable amount of time, if Yusuf has not responded, or if Yusuf
|
||||
and Alice 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.)
|
||||
|
||||
## 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.
|
||||
7. Other things forbidden by the npm
|
||||
[Code of Conduct](https://www.npmjs.com/policies/conduct) such as hateful
|
||||
language, pornographic content, or harassment.
|
||||
|
||||
If you see bad behavior like this, please report it to <abuse@npmjs.com> right
|
||||
away. **You are never expected to resolve abusive behavior on your own. We are
|
||||
here to help.**
|
||||
|
||||
## TRADEMARKS
|
||||
|
||||
If you think another npm publisher is infringing your trademark, such as by
|
||||
using a confusingly similar package name, email <abuse@npmjs.com> with a link to
|
||||
the package or user account on [https://www.npmjs.com/](https://www.npmjs.com/).
|
||||
Attach a copy of your trademark registration certificate.
|
||||
|
||||
If we see that the package's publisher is intentionally misleading others by
|
||||
misusing your registered mark without permission, we will transfer the package
|
||||
name to you. Otherwise, we will contact the package publisher and ask them to
|
||||
clear up any confusion with changes to their package's `README` file or
|
||||
metadata.
|
||||
|
||||
## CHANGES
|
||||
|
||||
This is a living document and may be updated from time to time. Please refer to
|
||||
the [git history for this document](https://github.com/npm/cli/commits/latest/doc/misc/npm-disputes.md)
|
||||
to view the changes.
|
||||
|
||||
## LICENSE
|
||||
|
||||
Copyright (C) npm, Inc., All rights reserved
|
||||
|
||||
This document may be reused under a Creative Commons Attribution-ShareAlike
|
||||
License.
|
||||
|
||||
## SEE ALSO
|
||||
|
||||
* npm-registry(7)
|
||||
* npm-owner(1)
|
319
website/node_modules/npm/doc/misc/npm-index.md
generated
vendored
Normal file
319
website/node_modules/npm/doc/misc/npm-index.md
generated
vendored
Normal file
@@ -0,0 +1,319 @@
|
||||
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-audit(1)
|
||||
|
||||
Run a security audit
|
||||
|
||||
### 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-ci(1)
|
||||
|
||||
Install a project with a clean slate
|
||||
|
||||
### 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-doctor(1)
|
||||
|
||||
Check your environments
|
||||
|
||||
### 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-hook(1)
|
||||
|
||||
Manage registry hooks
|
||||
|
||||
### npm-init(1)
|
||||
|
||||
create a package.json file
|
||||
|
||||
### npm-install-ci-test(1)
|
||||
|
||||
Install a project with a clean slate and run tests
|
||||
|
||||
### npm-install-test(1)
|
||||
|
||||
Install package(s) and run tests
|
||||
|
||||
### 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-profile(1)
|
||||
|
||||
Change settings on your registry profile
|
||||
|
||||
### 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-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 for publication
|
||||
|
||||
### 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-team(1)
|
||||
|
||||
Manage organization teams and team memberships
|
||||
|
||||
### npm-test(1)
|
||||
|
||||
Test a package
|
||||
|
||||
### npm-token(1)
|
||||
|
||||
Manage your authentication tokens
|
||||
|
||||
### 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
|
||||
|
||||
## Files
|
||||
|
||||
File system structures npm uses
|
||||
|
||||
### npm-folders(5)
|
||||
|
||||
Folder Structures Used by npm
|
||||
|
||||
### npm-package-locks(5)
|
||||
|
||||
An explanation of npm lockfiles
|
||||
|
||||
### npm-shrinkwrap.json(5)
|
||||
|
||||
A publishable lockfile
|
||||
|
||||
### npmrc(5)
|
||||
|
||||
The npm config files
|
||||
|
||||
### package-lock.json(5)
|
||||
|
||||
A manifestation of the manifest
|
||||
|
||||
### 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
website/node_modules/npm/doc/misc/npm-orgs.md
generated
vendored
Normal file
90
website/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)
|
100
website/node_modules/npm/doc/misc/npm-registry.md
generated
vendored
Normal file
100
website/node_modules/npm/doc/misc/npm-registry.md
generated
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
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.
|
||||
|
||||
npm is configured to use npm, Inc.'s public registry at
|
||||
<https://registry.npmjs.org> by default. Use of the npm public registry is
|
||||
subject to terms of use available at <https://www.npmjs.com/policies/terms>.
|
||||
|
||||
You can configure npm to use any compatible registry you like, and even run
|
||||
your own registry. Use of someone else's registry may be governed by their
|
||||
terms of use.
|
||||
|
||||
npm's package registry implementation supports several
|
||||
write APIs as well, to allow for publishing packages and managing user
|
||||
account information.
|
||||
|
||||
The npm public registry 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.
|
||||
|
||||
## Does npm send any information about me back to the registry?
|
||||
|
||||
Yes.
|
||||
|
||||
When making requests of the registry npm adds two headers with information
|
||||
about your environment:
|
||||
|
||||
* `Npm-Scope` – If your project is scoped, this header will contain its
|
||||
scope. In the future npm hopes to build registry features that use this
|
||||
information to allow you to customize your experience for your
|
||||
organization.
|
||||
* `Npm-In-CI` – Set to "true" if npm believes this install is running in a
|
||||
continuous integration environment, "false" otherwise. This is detected by
|
||||
looking for the following environment variables: `CI`, `TDDIUM`,
|
||||
`JENKINS_URL`, `bamboo.buildKey`. If you'd like to learn more you may find
|
||||
the [original PR](https://github.com/npm/npm-registry-client/pull/129)
|
||||
interesting.
|
||||
This is used to gather better metrics on how npm is used by humans, versus
|
||||
build farms.
|
||||
|
||||
The npm registry does not try to correlate the information in these headers
|
||||
with any authenticated accounts that may be used in the same requests.
|
||||
|
||||
## 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://www.npmjs.com/>
|
||||
|
||||
## SEE ALSO
|
||||
|
||||
* npm-config(1)
|
||||
* npm-config(7)
|
||||
* npmrc(5)
|
||||
* npm-developers(7)
|
||||
* npm-disputes(7)
|
113
website/node_modules/npm/doc/misc/npm-scope.md
generated
vendored
Normal file
113
website/node_modules/npm/doc/misc/npm-scope.md
generated
vendored
Normal file
@@ -0,0 +1,113 @@
|
||||
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, scopes are 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.
|
||||
|
||||
Each npm user/organization has their own scope, and only you can add packages
|
||||
in your scope. This means you don't have to worry about someone taking your
|
||||
package name ahead of you. Thus it is also a good way to signal official packages
|
||||
for organizations.
|
||||
|
||||
Scoped packages can be published and installed as of `npm@2` and are supported
|
||||
by the primary npm registry. Unscoped packages can depend on scoped packages and
|
||||
vice versa. The npm client is backwards-compatible with unscoped registries,
|
||||
so it can be used to work with scoped and unscoped 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 installed 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
|
||||
simply requires the `mypackage` module in the folder named `@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 better, 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://docs.npmjs.com/private-modules/intro)
|
||||
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)
|
||||
* npm-registry(7)
|
268
website/node_modules/npm/doc/misc/npm-scripts.md
generated
vendored
Normal file
268
website/node_modules/npm/doc/misc/npm-scripts.md
generated
vendored
Normal file
@@ -0,0 +1,268 @@
|
||||
npm-scripts(7) -- How npm handles the "scripts" field
|
||||
=====================================================
|
||||
|
||||
## DESCRIPTION
|
||||
|
||||
npm supports the "scripts" property of the package.json file, for the
|
||||
following scripts:
|
||||
|
||||
* prepublish:
|
||||
Run BEFORE the package is packed and published, as well as on local `npm
|
||||
install` without any arguments. (See below)
|
||||
* prepare:
|
||||
Run both BEFORE the package is packed and published, on local `npm
|
||||
install` without any arguments, and when installing git dependencies (See
|
||||
below). This is run AFTER `prepublish`, but BEFORE `prepublishOnly`.
|
||||
* prepublishOnly:
|
||||
Run BEFORE the package is prepared and packed, ONLY on `npm publish`. (See
|
||||
below.)
|
||||
* prepack:
|
||||
run BEFORE a tarball is packed (on `npm pack`, `npm publish`, and when
|
||||
installing git dependencies)
|
||||
* postpack:
|
||||
Run AFTER the tarball has been generated and moved to its final destination.
|
||||
* 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:
|
||||
Run BEFORE bumping the package version.
|
||||
* version:
|
||||
Run AFTER bumping the package version, but BEFORE commit.
|
||||
* postversion:
|
||||
Run AFTER bumping the package version, and AFTER commit.
|
||||
* 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.
|
||||
* preshrinkwrap, shrinkwrap, postshrinkwrap:
|
||||
Run by the `npm shrinkwrap` command.
|
||||
|
||||
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>`.
|
||||
|
||||
## PREPUBLISH AND PREPARE
|
||||
|
||||
### DEPRECATION NOTE
|
||||
|
||||
Since `npm@1.1.71`, the npm CLI has run the `prepublish` script for both `npm
|
||||
publish` and `npm install`, because it's a convenient way to prepare a package
|
||||
for use (some common use cases are described in the section below). It has
|
||||
also turned out to be, in practice, [very
|
||||
confusing](https://github.com/npm/npm/issues/10074). As of `npm@4.0.0`, a new
|
||||
event has been introduced, `prepare`, that preserves this existing behavior. A
|
||||
_new_ event, `prepublishOnly` has been added as a transitional strategy to
|
||||
allow users to avoid the confusing behavior of existing npm versions and only
|
||||
run on `npm publish` (for instance, running the tests one last time to ensure
|
||||
they're in good shape).
|
||||
|
||||
See <https://github.com/npm/npm/issues/10074> for a much lengthier
|
||||
justification, with further reading, for this change.
|
||||
|
||||
### USE CASES
|
||||
|
||||
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". You can access these variables
|
||||
in your code with `process.env.npm_package_name` and
|
||||
`process.env.npm_package_version`, and so on for other fields.
|
||||
|
||||
### 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
website/node_modules/npm/doc/misc/removing-npm.md
generated
vendored
Normal file
54
website/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)
|
388
website/node_modules/npm/doc/misc/semver.md
generated
vendored
Normal file
388
website/node_modules/npm/doc/misc/semver.md
generated
vendored
Normal file
@@ -0,0 +1,388 @@
|
||||
semver(7) -- The semantic versioner for npm
|
||||
===========================================
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
npm install --save semver
|
||||
````
|
||||
|
||||
## Usage
|
||||
|
||||
As a node module:
|
||||
|
||||
```js
|
||||
const semver = require('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
|
||||
semver.valid(semver.coerce('v2')) // '2.0.0'
|
||||
semver.valid(semver.coerce('42.6.7.9.3-alpha')) // '42.6.7'
|
||||
```
|
||||
|
||||
As a command-line utility:
|
||||
|
||||
```
|
||||
$ semver -h
|
||||
|
||||
SemVer 5.3.0
|
||||
|
||||
A JavaScript implementation of the http://semver.org/ specification
|
||||
Copyright Isaac Z. Schlueter
|
||||
|
||||
Usage: semver [options] <version> [<version> [...]]
|
||||
Prints valid versions sorted by SemVer precedence
|
||||
|
||||
Options:
|
||||
-r --range <range>
|
||||
Print versions that match the specified range.
|
||||
|
||||
-i --increment [<level>]
|
||||
Increment a version by the specified level. Level can
|
||||
be one of: major, minor, patch, premajor, preminor,
|
||||
prepatch, or prerelease. Default level is 'patch'.
|
||||
Only one version may be specified.
|
||||
|
||||
--preid <identifier>
|
||||
Identifier to be used to prefix premajor, preminor,
|
||||
prepatch or prerelease version increments.
|
||||
|
||||
-l --loose
|
||||
Interpret versions and ranges loosely
|
||||
|
||||
-c --coerce
|
||||
Coerce a string into SemVer if possible
|
||||
(does not imply --loose)
|
||||
|
||||
Program exits successfully if any valid version satisfies
|
||||
all supplied ranges, and prints all satisfying versions.
|
||||
|
||||
If no satisfying versions are found, 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:
|
||||
|
||||
```bash
|
||||
$ semver 1.2.3 -i prerelease --preid beta
|
||||
1.2.4-beta.0
|
||||
```
|
||||
|
||||
Which then can be used to increment further:
|
||||
|
||||
```bash
|
||||
$ 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.
|
||||
* `prerelease(v)`: Returns an array of prerelease components, or null
|
||||
if none exist. Example: `prerelease('1.2.3-alpha.1') -> ['alpha', 1]`
|
||||
* `major(v)`: Return the major version number.
|
||||
* `minor(v)`: Return the minor version number.
|
||||
* `patch(v)`: Return the patch version number.
|
||||
* `intersects(r1, r2, loose)`: Return true if the two supplied ranges
|
||||
or comparators intersect.
|
||||
|
||||
### 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.
|
||||
|
||||
### Comparators
|
||||
|
||||
* `intersects(comparator)`: Return true if the comparators intersect
|
||||
|
||||
### 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.
|
||||
* `minSatisfying(versions, range)`: Return the lowest 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`.)
|
||||
* `intersects(range)`: Return true if any of the ranges comparators intersect
|
||||
|
||||
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.
|
||||
|
||||
### Coercion
|
||||
|
||||
* `coerce(version)`: Coerces a string to semver if possible
|
||||
|
||||
This aims to provide a very forgiving translation of a non-semver
|
||||
string to semver. It looks for the first digit in a string, and
|
||||
consumes all remaining characters which satisfy at least a partial semver
|
||||
(e.g., `1`, `1.2`, `1.2.3`) up to the max permitted length (256 characters).
|
||||
Longer versions are simply truncated (`4.6.3.9.2-alpha2` becomes `4.6.3`).
|
||||
All surrounding text is simply ignored (`v3.4 replaces v3.3.1` becomes `3.4.0`).
|
||||
Only text which lacks digits will fail coercion (`version one` is not valid).
|
||||
The maximum length for any semver component considered for coercion is 16 characters;
|
||||
longer components will be ignored (`10000000000000000.4.7.4` becomes `4.7.4`).
|
||||
The maximum value for any semver component is `Integer.MAX_SAFE_INTEGER || (2**53 - 1)`;
|
||||
higher value components are invalid (`9999999999999999.4.7.4` is likely invalid).
|
Reference in New Issue
Block a user