diff options
author | Rebecca Turner <me@re-becca.org> | 2018-04-20 18:26:37 -0700 |
---|---|---|
committer | Rebecca Turner <me@re-becca.org> | 2018-05-24 23:24:45 -0700 |
commit | 468ab4519e1b92473acefb22801497a1af6aebae (patch) | |
tree | bdac1d062cd4b094bde3a21147bab5d82c792ece /deps/npm/doc/cli/npm-init.md | |
parent | ac8226115e2192a7a46ba07789fa5136f74223e1 (diff) | |
download | android-node-v8-468ab4519e1b92473acefb22801497a1af6aebae.tar.gz android-node-v8-468ab4519e1b92473acefb22801497a1af6aebae.tar.bz2 android-node-v8-468ab4519e1b92473acefb22801497a1af6aebae.zip |
deps: upgrade npm to 6.1.0
PR-URL: https://github.com/nodejs/node/pull/20190
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Diffstat (limited to 'deps/npm/doc/cli/npm-init.md')
-rw-r--r-- | deps/npm/doc/cli/npm-init.md | 62 |
1 files changed, 45 insertions, 17 deletions
diff --git a/deps/npm/doc/cli/npm-init.md b/deps/npm/doc/cli/npm-init.md index ec4c25beda..b91bcafae8 100644 --- a/deps/npm/doc/cli/npm-init.md +++ b/deps/npm/doc/cli/npm-init.md @@ -1,34 +1,62 @@ -npm-init(1) -- Interactively create a package.json file +npm-init(1) -- create a package.json file ======================================================= ## SYNOPSIS - npm init [-f|--force|-y|--yes] + npm init [--force|-f|--yes|-y|--scope] + npm init <@scope> (same as `npx <@scope>/create`) + npm init [<@scope>/]<name> (same as `npx [<@scope>/]create-<name>`) -## DESCRIPTION +## EXAMPLES + +Create a new React-based project using [`create-react-app`](https://npm.im/create-react-app): +``` +$ npm init react-app ./my-react-app +``` -This will ask you a bunch of questions, and then write a package.json for you. +Create a new `esm`-compatible package using [`create-esm`](https://npm.im/create-esm): +``` +$ mkdir my-esm-lib && cd my-esm-lib +$ npm init esm --yes +``` -It attempts to make reasonable guesses about what you want things to be set to, -and then writes a package.json file with the options you've selected. +Generate a plain old package.json using legacy init: +``` +$ mkdir my-npm-pkg && cd my-npm-pkg +$ git init +$ npm init +``` -If you already have a package.json file, it'll read that first, and default to -the options in there. +Generate it without having it ask any questions: +``` +$ npm init -y +``` + +## DESCRIPTION -It is strictly additive, so it does not delete options from your package.json -without a really good reason to do so. +`npm init <initializer>` can be used to set up a new or existing npm package. -If you invoke it with `-f`, `--force`, `-y`, or `--yes`, it will use only -defaults and not prompt you for any options. +`initializer` in this case is an npm package named `create-<initializer>`, which +will be installed by [`npx(1)`](https://npm.im/npx), and then have its main bin +executed -- presumably creating or updating `package.json` and running any other +initialization-related operations. -## CONFIGURATION +The init command is transformed to a corresponding `npx` operation as follows: -### scope +* `npm init foo` -> `npx create-foo` +* `npm init @usr/foo` -> `npx @usr/create-foo` +* `npm init @usr` -> `npx @usr/create` -* Default: none -* Type: String +Any additional options will be passed directly to the command, so `npm init foo +--hello` will map to `npx create-foo --hello`. -The scope under which the new module should be created. +If the initializer is omitted (by just calling `npm init`), init will fall back +to legacy init behavior. It will ask you a bunch of questions, and then write a +package.json for you. It will attempt to make reasonable guesses based on +existing fields, dependencies, and options selected. It is strictly additive, so +it will keep any fields and values that were already set. You can also use +`-y`/`--yes` to skip the questionnaire altogether. If you pass `--scope`, it +will create a scoped package. ## SEE ALSO |