summaryrefslogtreecommitdiff
path: root/deps/npm/man/man1/npm-init.1
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/man/man1/npm-init.1')
-rw-r--r--deps/npm/man/man1/npm-init.178
1 files changed, 60 insertions, 18 deletions
diff --git a/deps/npm/man/man1/npm-init.1 b/deps/npm/man/man1/npm-init.1
index 3395281ac7..91562d6421 100644
--- a/deps/npm/man/man1/npm-init.1
+++ b/deps/npm/man/man1/npm-init.1
@@ -1,39 +1,81 @@
-.TH "NPM\-INIT" "1" "December 2017" "" ""
+.TH "NPM\-INIT" "1" "May 2018" "" ""
.SH "NAME"
-\fBnpm-init\fR \- Interactively create a package\.json file
+\fBnpm-init\fR \- create a package\.json file
.SH SYNOPSIS
.P
.RS 2
.nf
-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>`)
+.fi
+.RE
+.SH EXAMPLES
+.P
+Create a new React\-based project using \fBcreate\-react\-app\fP \fIhttps://npm\.im/create\-react\-app\fR:
+.P
+.RS 2
+.nf
+$ npm init react\-app \./my\-react\-app
+.fi
+.RE
+.P
+Create a new \fBesm\fP\-compatible package using \fBcreate\-esm\fP \fIhttps://npm\.im/create\-esm\fR:
+.P
+.RS 2
+.nf
+$ mkdir my\-esm\-lib && cd my\-esm\-lib
+$ npm init esm \-\-yes
.fi
.RE
-.SH DESCRIPTION
.P
-This will ask you a bunch of questions, and then write a package\.json for you\.
+Generate a plain old package\.json using legacy init:
.P
-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\.
+.RS 2
+.nf
+$ mkdir my\-npm\-pkg && cd my\-npm\-pkg
+$ git init
+$ npm init
+.fi
+.RE
.P
-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:
.P
-It is strictly additive, so it does not delete options from your package\.json
-without a really good reason to do so\.
+.RS 2
+.nf
+$ npm init \-y
+.fi
+.RE
+.SH DESCRIPTION
+.P
+\fBnpm init <initializer>\fP can be used to set up a new or existing npm package\.
.P
-If you invoke it with \fB\-f\fP, \fB\-\-force\fP, \fB\-y\fP, or \fB\-\-yes\fP, it will use only
-defaults and not prompt you for any options\.
-.SH CONFIGURATION
-.SS scope
+\fBinitializer\fP in this case is an npm package named \fBcreate\-<initializer>\fP, which
+will be installed by npm help \fBnpx\fP \fIhttps://npm\.im/npx\fR, and then have its main bin
+executed \-\- presumably creating or updating \fBpackage\.json\fP and running any other
+initialization\-related operations\.
+.P
+The init command is transformed to a corresponding \fBnpx\fP operation as follows:
.RS 0
.IP \(bu 2
-Default: none
+\fBnpm init foo\fP \-> \fBnpx create\-foo\fP
+.IP \(bu 2
+\fBnpm init @usr/foo\fP \-> \fBnpx @usr/create\-foo\fP
.IP \(bu 2
-Type: String
+\fBnpm init @usr\fP \-> \fBnpx @usr/create\fP
.RE
.P
-The scope under which the new module should be created\.
+Any additional options will be passed directly to the command, so \fBnpm init foo
+\-\-hello\fP will map to \fBnpx create\-foo \-\-hello\fP\|\.
+.P
+If the initializer is omitted (by just calling \fBnpm init\fP), 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
+\fB\-y\fP/\fB\-\-yes\fP to skip the questionnaire altogether\. If you pass \fB\-\-scope\fP, it
+will create a scoped package\.
.SH SEE ALSO
.RS 0
.IP \(bu 2