diff --git a/source/commandline.md b/source/commandline.md index 5c6ffa53d..c7a62f15e 100644 --- a/source/commandline.md +++ b/source/commandline.md @@ -18,68 +18,72 @@ commands. Running meteor help command will print detailed help about the command. -

meteor run

+

meteor add package

-Run a meteor development server in the current project. Searches -upward from the current directory for the root directory of a Meteor -project. Whenever you change any of the application's source files, the -changes are automatically detected and applied to the running -application. +Add packages to your Meteor project. By convention, names of community packages +include the name of the maintainer. For example: `meteor add iron:router`. You +can add multiple packages with one command. -You can use the application by pointing your web browser at -localhost:3000. No Internet connection is -required. +Optionally, adds version constraints. Running `meteor add package@1.1.0` will +add the package at version `1.1.0` or higher (but not `2.0.0` or higher). If you +want to use version `1.1.0` exactly, use `meteor add package@=1.1.0`. You can also +'or' constraints together: for example, `meteor add 'package@=1.0.0 || =2.0.1'` +means either 1.0.0 (exactly) or 2.0.1 (exactly). -This is the default command. Simply running `meteor` is the -same as `meteor run`. +To remove a version constraint for a specific package, run `meteor add` again +without specifying a version. For example above, to stop using version `1.1.0` +exactly, run `meteor add package`. -To pass additional options to Node.js use the `SERVER_NODE_OPTIONS` environment variable. E.g. for Windows PowerShell: -`$env:SERVER_NODE_OPTIONS = '--inspect' | meteor run`. Or for Linux: `SERVER_NODE_OPTIONS=--inspect-brk meteor run`. -To specify a port to listen on (instead of the default 3000), use `--port [PORT]`. -(The development server also uses port `N+1` for the default MongoDB instance) +

meteor add-platform platform

-For example: `meteor run --port 4000` -will run the development server on `http://localhost:4000` -and the development MongoDB instance on `mongodb://localhost:4001`. +Adds platforms to your Meteor project. You can add multiple +platforms with one command. Once a platform has been added, you +can use 'meteor run platform' to run on the platform, and `meteor build` +to build the Meteor project for every added platform. -Run `meteor help run` to see the full list of options. -

meteor debug

+

meteor admin

-Run the project, but suspend the server process for debugging. +Catch-all for miscellaneous commands that require authorization to use. -> **NOTE:** The `meteor debug` command has been superseded by the more flexible -> `--inspect` and `--inspect-brk` command-line flags, which work for any `run`, -> `test`, or `test-packages` command. -> -> The syntax of these flags is the same as the equivalent Node.js -> [flags](https://nodejs.org/en/docs/inspector/#command-line-options), -> with two notable differences: -> -> * The flags affect the server process spawned by the build process, -> rather than affecting the build process itself. -> -> * The `--inspect-brk` flag causes the server process to pause just after -> server code has loaded but before it begins to execute, giving the -> developer a chance to set breakpoints in server code. +Some example uses of `meteor admin` include adding and removing package +maintainers and setting a homepage for a package. It also includes various +helpful functions for managing a Meteor release. Run `meteor help admin` for +more information. -The server process will be suspended just before the first statement of -server code that would normally execute. In order to continue execution of -server code, use either the web-based Node Inspector or the command-line -debugger (further instructions will be printed in the console). +

meteor build

-Breakpoints can be set using the `debugger` keyword, or through the web UI of Node Inspector ("Sources" tab). +Package this project up for deployment. The output is a directory with several +build artifacts: -The server process debugger will listen for incoming connections from -debugging clients, such as node-inspector, on port 5858 by default. To -specify a different port use the `--debug-port ` option. + -The same debugging functionality can be achieved by adding the `--debug-port ` -option to other `meteor` tool commands, such as `meteor run` and `meteor test-packages`. +You can use the application server bundle to host a Meteor application on your +own server, instead of deploying to Galaxy. You will have to deal +with logging, monitoring, backups, load-balancing, etc, all of which we handle +for you if you use Galaxy. -> **Note:** Due to a [bug in `node-inspector`](https://github.com/node-inspector/node-inspector/issues/903), pushing "Enter" after a command on the Node Inspector Console will not successfully send the command to the server. If you require this functionality, please consider using Safari or `meteor shell` in order to interact with the server console until the `node-inspector` project [fixes the bug](https://github.com/node-inspector/node-inspector/pull/955). Alternatively, there is a hot-patch available [in this comment](https://github.com/meteor/meteor/issues/7991#issuecomment-266709459) on [#7991](https://github.com/meteor/meteor/issues/7991). +The unsigned `apk` bundle and the outputted Xcode project can be used to deploy +your mobile apps to Android Play Store and Apple App Store. +By default, your application is bundled for your current architecture. +This may cause difficulties if your app contains binary code due to, +for example, npm packages. You can try to override that behavior +with the `--architecture` flag. + +You can set optional data for the initial value of `Meteor.settings` +in your mobile application with the `--mobile-settings` flag. A new value for +`Meteor.settings` can be set later by the server as part of hot code push. + +You can also specify which platforms you want to build with the `--platforms` flag. +Examples: `--platforms=android`, `--platforms=ios`, `--platforms=web.browser`.

meteor create name

@@ -169,16 +173,41 @@ Create a basic [Svelte](https://svelte.dev/) app. |[webapp](https://atmospherejs.com/meteor/webapp)| | | |X| | | | | |[react-meteor-data](https://atmospherejs.com/meteor/react-meteor-data)|X| | | | | | | | -

meteor login / logout

+

meteor debug

-Log in and out of your account using Meteor's authentication system. +Run the project, but suspend the server process for debugging. -You can pass `METEOR_SESSION_FILE=token.json` before `meteor login` to generate -a login session token so you don't have to share your login credentials with -third-party service providers. +> **NOTE:** The `meteor debug` command has been superseded by the more flexible +> `--inspect` and `--inspect-brk` command-line flags, which work for any `run`, +> `test`, or `test-packages` command. +> +> The syntax of these flags is the same as the equivalent Node.js +> [flags](https://nodejs.org/en/docs/inspector/#command-line-options), +> with two notable differences: +> +> * The flags affect the server process spawned by the build process, +> rather than affecting the build process itself. +> +> * The `--inspect-brk` flag causes the server process to pause just after +> server code has loaded but before it begins to execute, giving the +> developer a chance to set breakpoints in server code. + +The server process will be suspended just before the first statement of +server code that would normally execute. In order to continue execution of +server code, use either the web-based Node Inspector or the command-line +debugger (further instructions will be printed in the console). + +Breakpoints can be set using the `debugger` keyword, or through the web UI of Node Inspector ("Sources" tab). + +The server process debugger will listen for incoming connections from +debugging clients, such as node-inspector, on port 5858 by default. To +specify a different port use the `--debug-port ` option. + +The same debugging functionality can be achieved by adding the `--debug-port ` +option to other `meteor` tool commands, such as `meteor run` and `meteor test-packages`. + +> **Note:** Due to a [bug in `node-inspector`](https://github.com/node-inspector/node-inspector/issues/903), pushing "Enter" after a command on the Node Inspector Console will not successfully send the command to the server. If you require this functionality, please consider using Safari or `meteor shell` in order to interact with the server console until the `node-inspector` project [fixes the bug](https://github.com/node-inspector/node-inspector/pull/955). Alternatively, there is a hot-patch available [in this comment](https://github.com/meteor/meteor/issues/7991#issuecomment-266709459) on [#7991](https://github.com/meteor/meteor/issues/7991). -Once you have your account you can log in and log out from the command line, and -check your username with `meteor whoami`.

meteor deploy site

@@ -243,66 +272,14 @@ You can change the app plan by providing argument `--plan` with one of the follo The `plan` option is available to Meteor 2.1+ {% endpullquote %} -

meteor update

- -Attempts to bring you to the latest version of Meteor, and then to upgrade your -packages to their latest versions. By default, update will not break -compatibility. - -For example, let's say packages A and B both depend on version 1.1.0 of package -X. If a new version of A depends on X@2.0.0, but there is no new version of -package B, running `meteor update` will not update A, because doing so will -break package B. - -You can pass in the flag `--packages-only` to update only the packages, and not -the release itself. Similarly, you can pass in names of packages -(`meteor update foo:kittens baz:cats`) to only update specific packages. - -Every project is pinned to a specific release of Meteor. You can temporarily try -using your package with another release by passing the `--release` option to any -command; `meteor update` changes the pinned release. - -Sometimes, Meteor will ask you to run `meteor update --patch`. Patch releases -are special releases that contain only very minor changes (usually crucial bug -fixes) from previous releases. We highly recommend that you always run `update ---patch` when prompted. - -You may also pass the `--release` flag to act as an override to update to a -specific release. This is an override: if it cannot find compatible versions of -packages, it will log a warning, but perform the update anyway. This will only -change your package versions if necessary. - - -

meteor add package

- -Add packages to your Meteor project. By convention, names of community packages -include the name of the maintainer. For example: `meteor add iron:router`. You -can add multiple packages with one command. - -Optionally, adds version constraints. Running `meteor add package@1.1.0` will -add the package at version `1.1.0` or higher (but not `2.0.0` or higher). If you -want to use version `1.1.0` exactly, use `meteor add package@=1.1.0`. You can also -'or' constraints together: for example, `meteor add 'package@=1.0.0 || =2.0.1'` -means either 1.0.0 (exactly) or 2.0.1 (exactly). - -To remove a version constraint for a specific package, run `meteor add` again -without specifying a version. For example above, to stop using version `1.1.0` -exactly, run `meteor add package`. - - -

meteor remove package

+

meteor ensure-cordova-dependencies

-Removes a package previously added to your Meteor project. For a -list of the packages that your application is currently using, run -`meteor list`. +Check if the dependencies are installed, otherwise install them. -This removes the package entirely. To continue using the package, -but remove its version constraint, use [`meteor add`](#meteoradd). +

meteor lint

-Meteor does not downgrade transitive dependencies unless it's necessary. This -means that if running `meteor add A` upgrades A's parent package X to a new -version, your project will continue to use X at the new version even after you -run `meteor remove A`. +Run through the whole build process for the app and run all linters the app +uses. Outputs all build errors or linting warnings to the standard output.

meteor list

@@ -335,29 +312,21 @@ Adds more package details to the JSON output. Only functional in combination with `--json`. -

meteor add-platform platform

- -Adds platforms to your Meteor project. You can add multiple -platforms with one command. Once a platform has been added, you -can use 'meteor run platform' to run on the platform, and `meteor build` -to build the Meteor project for every added platform. - - -

meteor remove-platform platform

- -Removes a platform previously added to your Meteor project. For a -list of the platforms that your application is currently using, see -`meteor list-platforms`. - -

meteor list-platforms

Lists all of the platforms that have been explicitly added to your project. -

meteor ensure-cordova-dependencies

+

meteor login / logout

-Check if the dependencies are installed, otherwise install them. +Log in and out of your account using Meteor's authentication system. + +You can pass `METEOR_SESSION_FILE=token.json` before `meteor login` to generate +a login session token so you don't have to share your login credentials with +third-party service providers. + +Once you have your account you can log in and log out from the command line, and +check your username with `meteor whoami`.

meteor mongo

@@ -370,74 +339,48 @@ with `meteor run`. This will be easier in the future. {% endpullquote %} -

meteor reset

- -Reset the current project to a fresh state. Removes the local -mongo database. - -{% pullquote warning %} -This deletes your data! Make sure you do not have any information you -care about in your local mongo database by running `meteor mongo`. -From the mongo shell, use `show collections` -and db.collection.find() to inspect your data. -{% endpullquote %} - -{% pullquote warning %} -For now, you can not run this while a development server is -running. Quit all running meteor applications before running this. -{% endpullquote %} - - -

meteor build

- -Package this project up for deployment. The output is a directory with several -build artifacts: - -
  • a tarball (.tar.gz) that includes everything necessary to run the application - server (see the README in the tarball for details). Using the - `--directory` option will produce a `bundle` directory instead of the tarball.
  • -
  • an unsigned apk bundle and a project source if Android is targeted as a - mobile platform
  • -
  • a directory with an Xcode project source if iOS is targeted as a mobile - platform
- -You can use the application server bundle to host a Meteor application on your -own server, instead of deploying to Galaxy. You will have to deal -with logging, monitoring, backups, load-balancing, etc, all of which we handle -for you if you use Galaxy. - -The unsigned `apk` bundle and the outputted Xcode project can be used to deploy -your mobile apps to Android Play Store and Apple App Store. - -By default, your application is bundled for your current architecture. -This may cause difficulties if your app contains binary code due to, -for example, npm packages. You can try to override that behavior -with the `--architecture` flag. - -You can set optional data for the initial value of `Meteor.settings` -in your mobile application with the `--mobile-settings` flag. A new value for -`Meteor.settings` can be set later by the server as part of hot code push. +

meteor node

-You can also specify which platforms you want to build with the `--platforms` flag. -Examples: `--platforms=android`, `--platforms=ios`, `--platforms=web.browser`. +The `meteor node` command calls the +[`node`](https://nodejs.org) version bundled with Meteor itself. -

meteor lint

+> This is not to be confused with [`meteor shell`](#meteorshell), which provides +an almost identical experience but also gives you access to the "server" context +of a Meteor application. Typically, `meteor shell` will be preferred. -Run through the whole build process for the app and run all linters the app -uses. Outputs all build errors or linting warnings to the standard output. +Additional parameters can be passed in the same way as the `node` command, and +the [Node.js documentation](https://nodejs.org/dist/latest-v4.x/docs/api/cli.html) +should be consulted for the full list of commands and for a better understanding +of their usage. +For example, executing `meteor node` will enter the Node.js +[Read-Eval-Print-Loop (REPL)](https://nodejs.org/dist/latest-v4.x/docs/api/repl.html) +interface and allow you to interactively run JavaScript and see the results. -

meteor search

+Executing `meteor node -e "console.log(process.versions)"` would +run `console.log(process.versions)` in the version of `node` bundled with Meteor. +

meteor npm

-Searches for Meteor packages and releases, whose names contain the specified -regular expression. +The `meteor npm` command calls the +[`npm`](https://docs.npmjs.com/getting-started/what-is-npm) version bundled +with Meteor itself. +Additional parameters can be passed in the same way as the `npm` command +(e.g. `meteor npm rebuild`, `meteor npm ls`, etc.) and the +[npm documentation](https://docs.npmjs.com/) should be consulted for the +full list of commands and for a better understanding of their usage. -

meteor show

+For example, executing `meteor npm install lodash --save` would install `lodash` +from npm to your `node_modules` directory and save its usage in your +[`package.json`](https://docs.npmjs.com/files/package.json) file. -Shows more information about a specific package or release: name, summary, the -usernames of its maintainers, and, if specified, its homepage and git URL. +Using the `meteor npm ...` commands in place of traditional `npm ...` commands +is particularly important when using Node.js modules that have binary +dependencies that make native C calls (like [`bcrypt`](https://www.npmjs.com/package/bcrypt)) +because doing so ensures that they are built using the same libaries. +Additionally, this access to the npm that comes with Meteor avoids the need to +download and install npm separately.

meteor publish

@@ -498,22 +441,78 @@ switching to a corresponding release. For more information, run `meteor help publish-release`. -

meteor test-packages

+

meteor remove package

-Test Meteor packages, either by name, or by directory. Not specifying an -argument will run tests for all local packages. The results are displayed in an -app that runs at `localhost:3000` by default. If you need to, you can pass the -`--settings` and `--port` arguments. +Removes a package previously added to your Meteor project. For a +list of the packages that your application is currently using, run +`meteor list`. +This removes the package entirely. To continue using the package, +but remove its version constraint, use [`meteor add`](#meteoradd). -

meteor admin

+Meteor does not downgrade transitive dependencies unless it's necessary. This +means that if running `meteor add A` upgrades A's parent package X to a new +version, your project will continue to use X at the new version even after you +run `meteor remove A`. -Catch-all for miscellaneous commands that require authorization to use. -Some example uses of `meteor admin` include adding and removing package -maintainers and setting a homepage for a package. It also includes various -helpful functions for managing a Meteor release. Run `meteor help admin` for -more information. +

meteor remove-platform platform

+ +Removes a platform previously added to your Meteor project. For a +list of the platforms that your application is currently using, see +`meteor list-platforms`. + + +

meteor reset

+ +Reset the current project to a fresh state. Removes the local +mongo database. + +{% pullquote warning %} +This deletes your data! Make sure you do not have any information you +care about in your local mongo database by running `meteor mongo`. +From the mongo shell, use `show collections` +and db.collection.find() to inspect your data. +{% endpullquote %} + +{% pullquote warning %} +For now, you can not run this while a development server is +running. Quit all running meteor applications before running this. +{% endpullquote %} + + +

meteor run

+ +Run a meteor development server in the current project. Searches +upward from the current directory for the root directory of a Meteor +project. Whenever you change any of the application's source files, the +changes are automatically detected and applied to the running +application. + +You can use the application by pointing your web browser at +localhost:3000. No Internet connection is +required. + +This is the default command. Simply running `meteor` is the +same as `meteor run`. + +To pass additional options to Node.js use the `SERVER_NODE_OPTIONS` environment variable. E.g. for Windows PowerShell: +`$env:SERVER_NODE_OPTIONS = '--inspect' | meteor run`. Or for Linux: `SERVER_NODE_OPTIONS=--inspect-brk meteor run`. + +To specify a port to listen on (instead of the default 3000), use `--port [PORT]`. +(The development server also uses port `N+1` for the default MongoDB instance) + +For example: `meteor run --port 4000` +will run the development server on `http://localhost:4000` +and the development MongoDB instance on `mongodb://localhost:4001`. + +Run `meteor help run` to see the full list of options. + +

meteor search

+ +Searches for Meteor packages and releases, whose names contain the specified +regular expression. +

meteor shell

@@ -536,46 +535,45 @@ The shell supports tab completion for global variables like `Meteor`, The shell maintains a persistent history across sessions. Previously-run commands can be accessed by pressing the up arrow. -

meteor npm

+

meteor show

-The `meteor npm` command calls the -[`npm`](https://docs.npmjs.com/getting-started/what-is-npm) version bundled -with Meteor itself. +Shows more information about a specific package or release: name, summary, the +usernames of its maintainers, and, if specified, its homepage and git URL. -Additional parameters can be passed in the same way as the `npm` command -(e.g. `meteor npm rebuild`, `meteor npm ls`, etc.) and the -[npm documentation](https://docs.npmjs.com/) should be consulted for the -full list of commands and for a better understanding of their usage. -For example, executing `meteor npm install lodash --save` would install `lodash` -from npm to your `node_modules` directory and save its usage in your -[`package.json`](https://docs.npmjs.com/files/package.json) file. +

meteor test-packages

-Using the `meteor npm ...` commands in place of traditional `npm ...` commands -is particularly important when using Node.js modules that have binary -dependencies that make native C calls (like [`bcrypt`](https://www.npmjs.com/package/bcrypt)) -because doing so ensures that they are built using the same libaries. +Test Meteor packages, either by name, or by directory. Not specifying an +argument will run tests for all local packages. The results are displayed in an +app that runs at `localhost:3000` by default. If you need to, you can pass the +`--settings` and `--port` arguments. -Additionally, this access to the npm that comes with Meteor avoids the need to -download and install npm separately. -

meteor node

+

meteor update

-The `meteor node` command calls the -[`node`](https://nodejs.org) version bundled with Meteor itself. +Attempts to bring you to the latest version of Meteor, and then to upgrade your +packages to their latest versions. By default, update will not break +compatibility. -> This is not to be confused with [`meteor shell`](#meteorshell), which provides -an almost identical experience but also gives you access to the "server" context -of a Meteor application. Typically, `meteor shell` will be preferred. +For example, let's say packages A and B both depend on version 1.1.0 of package +X. If a new version of A depends on X@2.0.0, but there is no new version of +package B, running `meteor update` will not update A, because doing so will +break package B. -Additional parameters can be passed in the same way as the `node` command, and -the [Node.js documentation](https://nodejs.org/dist/latest-v4.x/docs/api/cli.html) -should be consulted for the full list of commands and for a better understanding -of their usage. +You can pass in the flag `--packages-only` to update only the packages, and not +the release itself. Similarly, you can pass in names of packages +(`meteor update foo:kittens baz:cats`) to only update specific packages. -For example, executing `meteor node` will enter the Node.js -[Read-Eval-Print-Loop (REPL)](https://nodejs.org/dist/latest-v4.x/docs/api/repl.html) -interface and allow you to interactively run JavaScript and see the results. +Every project is pinned to a specific release of Meteor. You can temporarily try +using your package with another release by passing the `--release` option to any +command; `meteor update` changes the pinned release. -Executing `meteor node -e "console.log(process.versions)"` would -run `console.log(process.versions)` in the version of `node` bundled with Meteor. +Sometimes, Meteor will ask you to run `meteor update --patch`. Patch releases +are special releases that contain only very minor changes (usually crucial bug +fixes) from previous releases. We highly recommend that you always run `update +--patch` when prompted. + +You may also pass the `--release` flag to act as an override to update to a +specific release. This is an override: if it cannot find compatible versions of +packages, it will log a warning, but perform the update anyway. This will only +change your package versions if necessary.