Merge pull request #66 from microsoft/octogonz/cli-help
Document "rush deploy" and fix up some other content
This commit is contained in:
Коммит
0a49947028
28
Gemfile.lock
28
Gemfile.lock
|
@ -1,18 +1,18 @@
|
|||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
activesupport (6.0.2.2)
|
||||
activesupport (6.0.3.1)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (>= 0.7, < 2)
|
||||
minitest (~> 5.1)
|
||||
tzinfo (~> 1.1)
|
||||
zeitwerk (~> 2.2)
|
||||
zeitwerk (~> 2.2, >= 2.2.2)
|
||||
addressable (2.7.0)
|
||||
public_suffix (>= 2.0.2, < 5.0)
|
||||
algolia_html_extractor (2.6.2)
|
||||
json (~> 2.0)
|
||||
nokogiri (~> 1.10.4)
|
||||
algoliasearch (1.27.1)
|
||||
algoliasearch (1.27.3)
|
||||
httpclient (~> 2.8, >= 2.8.3)
|
||||
json (>= 1.5.1)
|
||||
coffee-script (2.4.1)
|
||||
|
@ -35,14 +35,14 @@ GEM
|
|||
execjs (2.7.0)
|
||||
faraday (1.0.1)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
ffi (1.12.2)
|
||||
ffi (1.12.2-x64-mingw32)
|
||||
ffi (1.13.1)
|
||||
ffi (1.13.1-x64-mingw32)
|
||||
filesize (0.2.0)
|
||||
forwardable-extended (2.6.0)
|
||||
gemoji (3.0.1)
|
||||
github-pages (204)
|
||||
github-pages (206)
|
||||
github-pages-health-check (= 1.16.1)
|
||||
jekyll (= 3.8.5)
|
||||
jekyll (= 3.8.7)
|
||||
jekyll-avatar (= 0.7.0)
|
||||
jekyll-coffeescript (= 1.1.1)
|
||||
jekyll-commonmark-ghpages (= 0.1.6)
|
||||
|
@ -81,7 +81,7 @@ GEM
|
|||
mercenary (~> 0.3)
|
||||
minima (= 2.5.1)
|
||||
nokogiri (>= 1.10.4, < 2.0)
|
||||
rouge (= 3.13.0)
|
||||
rouge (= 3.19.0)
|
||||
terminal-table (~> 1.4)
|
||||
github-pages-health-check (1.16.1)
|
||||
addressable (~> 2.3)
|
||||
|
@ -89,14 +89,14 @@ GEM
|
|||
octokit (~> 4.0)
|
||||
public_suffix (~> 3.0)
|
||||
typhoeus (~> 1.3)
|
||||
html-pipeline (2.12.3)
|
||||
html-pipeline (2.13.0)
|
||||
activesupport (>= 2)
|
||||
nokogiri (>= 1.4)
|
||||
http_parser.rb (0.6.0)
|
||||
httpclient (2.8.3)
|
||||
i18n (0.9.5)
|
||||
concurrent-ruby (~> 1.0)
|
||||
jekyll (3.8.5)
|
||||
jekyll (3.8.7)
|
||||
addressable (~> 2.4)
|
||||
colorator (~> 1.0)
|
||||
em-websocket (~> 0.5)
|
||||
|
@ -222,7 +222,7 @@ GEM
|
|||
jekyll (>= 3.5, < 5.0)
|
||||
jekyll-feed (~> 0.9)
|
||||
jekyll-seo-tag (~> 2.1)
|
||||
minitest (5.14.0)
|
||||
minitest (5.14.1)
|
||||
multipart-post (2.1.1)
|
||||
nokogiri (1.10.9)
|
||||
mini_portile2 (~> 2.4.0)
|
||||
|
@ -235,10 +235,10 @@ GEM
|
|||
forwardable-extended (~> 2.6)
|
||||
progressbar (1.10.1)
|
||||
public_suffix (3.1.1)
|
||||
rb-fsevent (0.10.3)
|
||||
rb-fsevent (0.10.4)
|
||||
rb-inotify (0.10.1)
|
||||
ffi (~> 1.0)
|
||||
rouge (3.13.0)
|
||||
rouge (3.19.0)
|
||||
ruby-enum (0.8.0)
|
||||
i18n
|
||||
rubyzip (2.3.0)
|
||||
|
@ -254,7 +254,7 @@ GEM
|
|||
terminal-table (1.8.0)
|
||||
unicode-display_width (~> 1.1, >= 1.1.1)
|
||||
thread_safe (0.3.6)
|
||||
typhoeus (1.3.1)
|
||||
typhoeus (1.4.0)
|
||||
ethon (>= 0.9.0)
|
||||
tzinfo (1.2.7)
|
||||
thread_safe (~> 0.1)
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
top_nav:
|
||||
- title: Docs
|
||||
url: /pages/intro/welcome
|
||||
|
@ -53,8 +52,10 @@ docs_nav:
|
|||
url: /pages/maintainer/setup_policies
|
||||
- title: Custom commands
|
||||
url: /pages/maintainer/custom_commands
|
||||
- title: Publishing Packages
|
||||
- title: Publishing packages
|
||||
url: /pages/maintainer/publishing
|
||||
- title: Deploying projects
|
||||
url: /pages/maintainer/deploying
|
||||
- title: Installing Git hooks
|
||||
url: /pages/maintainer/git_hooks
|
||||
|
||||
|
@ -86,8 +87,12 @@ docs_nav:
|
|||
url: /pages/commands/rush_change
|
||||
- title: rush check
|
||||
url: /pages/commands/rush_check
|
||||
- title: rush deploy
|
||||
url: /pages/commands/rush_deploy
|
||||
- title: rush init
|
||||
url: /pages/commands/rush_init
|
||||
- title: rush init-deploy
|
||||
url: /pages/commands/rush_init-deploy
|
||||
- title: rush install
|
||||
url: /pages/commands/rush_install
|
||||
- title: rush link
|
||||
|
@ -121,6 +126,8 @@ docs_nav:
|
|||
url: /pages/configs/common_versions_json
|
||||
- title: experiments.json
|
||||
url: /pages/configs/experiments_json
|
||||
- title: deploy.json
|
||||
url: /pages/configs/deploy_json
|
||||
- title: pnpmfile.js
|
||||
url: /pages/configs/pnpmfile_js
|
||||
- title: rush.json
|
||||
|
|
|
@ -26,11 +26,14 @@ therein; a full rebuild is forced whenever the command has changed (e.g.
|
|||
Optional arguments:
|
||||
-h, --help Show this help message and exit.
|
||||
-p COUNT, --parallelism COUNT
|
||||
Specify the number of concurrent build processes The
|
||||
value "max" can be specified to indicate the number
|
||||
of CPU cores. If this parameter omitted, the default
|
||||
value depends on the operating system and number of
|
||||
CPU cores.
|
||||
Specifies the maximum number of concurrent processes
|
||||
to launch during a build. The COUNT should be a
|
||||
positive integer or else the word "max" to specify a
|
||||
count that is equal to the number of CPU cores. If
|
||||
this parameter is omitted, then the default value
|
||||
depends on the operating system and number of CPU
|
||||
cores. This parameter may alternatively be specified
|
||||
via the RUSH_PARALLELISM environment variable.
|
||||
-t PROJECT1, --to PROJECT1
|
||||
Run command in the specified project and all of its
|
||||
dependencies. "." can be used as shorthand to specify
|
||||
|
@ -55,3 +58,7 @@ Optional arguments:
|
|||
projects that have changed, but not any projects that
|
||||
directly or indirectly depend on the changed package.
|
||||
```
|
||||
|
||||
### See Also
|
||||
|
||||
- [rush rebuild]({% link pages/commands/rush_rebuild.md %})
|
||||
|
|
|
@ -58,3 +58,4 @@ Optional arguments:
|
|||
### See Also
|
||||
|
||||
- [Authoring change logs]({% link pages/best_practices/change_logs.md %})
|
||||
- [rush version]({% link pages/commands/rush_version.md %})
|
||||
|
|
|
@ -13,7 +13,7 @@ are of the same version throughout the repository.
|
|||
Optional arguments:
|
||||
-h, --help Show this help message and exit.
|
||||
--variant VARIANT Run command using a variant installation configuration.
|
||||
This parameter may alternatively specified via the
|
||||
This parameter may alternatively be specified via the
|
||||
RUSH_VARIANT environment variable.
|
||||
--json If this flag is specified, output will be in JSON format.
|
||||
```
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
---
|
||||
layout: page
|
||||
title: rush deploy
|
||||
navigation_source: docs_nav
|
||||
---
|
||||
|
||||
```
|
||||
usage: rush deploy [-h] [-p PROJECT_NAME] [-s SCENARIO_NAME] [--overwrite]
|
||||
[-t PATH]
|
||||
|
||||
|
||||
(EXPERIMENTAL) After building the repo, "rush deploy" can be used to prepare
|
||||
a deployment by copying a subset of Rush projects and their dependencies to a
|
||||
target folder, which can then be uploaded to a production server. The "rush
|
||||
deploy" behavior is specified by a scenario config file that must be created
|
||||
first, using the "rush init-deploy" command.
|
||||
|
||||
Optional arguments:
|
||||
-h, --help Show this help message and exit.
|
||||
-p PROJECT_NAME, --project PROJECT_NAME
|
||||
Specifies the name of the main Rush project to be
|
||||
deployed. It must appear in the
|
||||
"deploymentProjectNames" setting in the deployment
|
||||
config file.
|
||||
-s SCENARIO_NAME, --scenario SCENARIO_NAME
|
||||
By default, the deployment configuration is specified
|
||||
in "common/config/rush/deploy.json". You can use
|
||||
"--scenario" to specify an alternate name. The name
|
||||
must be lowercase and separated by dashes. For
|
||||
example, if SCENARIO_NAME is "web", then the config
|
||||
file would be "common/config/rush/deploy-web.json".
|
||||
--overwrite By default, deployment will fail if the target folder
|
||||
is not empty. SPECIFYING THIS FLAG WILL RECURSIVELY
|
||||
DELETE EXISTING CONTENTS OF THE TARGET FOLDER.
|
||||
-t PATH, --target-folder PATH
|
||||
By default, files are deployed to the "common/deploy"
|
||||
folder inside the Rush repo. Use this parameter to
|
||||
specify a different location. WARNING: USE CAUTION
|
||||
WHEN COMBINING WITH "--overwrite". This parameter may
|
||||
alternatively be specified via the
|
||||
RUSH_DEPLOY_TARGET_FOLDER environment variable.
|
||||
```
|
||||
|
||||
### See Also
|
||||
|
||||
- [Deploying projects]({% link pages/maintainer/deploying.md %})
|
||||
- [rush init-deploy]({% link pages/commands/rush_init-deploy.md %})
|
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
layout: page
|
||||
title: rush init-deploy
|
||||
navigation_source: docs_nav
|
||||
---
|
||||
|
||||
```
|
||||
usage: rush init-deploy [-h] -p PROJECT_NAME [-s SCENARIO]
|
||||
|
||||
(EXPERIMENTAL) Use this command to initialize a new scenario config file for
|
||||
use with "rush deploy". The default filename is common/config/rush/deploy.json.
|
||||
However, if you need to manage multiple deployments with different
|
||||
settings, you can use use "--scenario" to create additional config files.
|
||||
|
||||
Optional arguments:
|
||||
-h, --help Show this help message and exit.
|
||||
-p PROJECT_NAME, --project PROJECT_NAME
|
||||
Specifies the name of the main Rush project to be
|
||||
deployed in this scenario. It will be added to the
|
||||
"deploymentProjectNames" setting.
|
||||
-s SCENARIO, --scenario SCENARIO
|
||||
By default, the deployment configuration will be
|
||||
written to "common/config/rush/deploy.json". You can
|
||||
use "--scenario" to specify an alternate name. The
|
||||
name must be lowercase and separated by dashes. For
|
||||
example, if the name is "web", then the config file
|
||||
would be "common/config/rush/deploy-web.json".
|
||||
```
|
||||
|
||||
### See Also
|
||||
|
||||
- [Deploying projects]({% link pages/maintainer/deploying.md %})
|
||||
- [deploy.json]({% link pages/configs/deploy_json.md %}) config file
|
||||
- [rush deploy]({% link pages/commands/rush_deploy.md %})
|
||||
- [rush init]({% link pages/commands/rush_init.md %})
|
|
@ -28,3 +28,4 @@ Optional arguments:
|
|||
|
||||
- [Setting up a new repo]({% link pages/maintainer/setup_new_repo.md %})
|
||||
- The [rush-example](https://github.com/microsoft/rush-example) repo on GitHub
|
||||
- [rush init-deploy]({% link pages/commands/rush_init-deploy.md %})
|
||||
|
|
|
@ -7,7 +7,7 @@ navigation_source: docs_nav
|
|||
```
|
||||
usage: rush install [-h] [-p] [--bypass-policy] [--no-link]
|
||||
[--network-concurrency COUNT] [--debug-package-manager]
|
||||
[--variant VARIANT]
|
||||
[--max-install-attempts NUMBER] [--variant VARIANT]
|
||||
|
||||
|
||||
The "rush install" command installs package dependencies for all your
|
||||
|
@ -41,7 +41,14 @@ Optional arguments:
|
|||
Activates verbose logging for the package manager.
|
||||
You will probably want to pipe the output of Rush to
|
||||
a file when using this command.
|
||||
--max-install-attempts NUMBER
|
||||
Overrides the default maximum number of install
|
||||
attempts. The default value is 3.
|
||||
--variant VARIANT Run command using a variant installation
|
||||
configuration. This parameter may alternatively
|
||||
configuration. This parameter may alternatively be
|
||||
specified via the RUSH_VARIANT environment variable.
|
||||
```
|
||||
|
||||
### See Also
|
||||
|
||||
- [rush update]({% link pages/commands/rush_update.md %})
|
||||
|
|
|
@ -18,3 +18,7 @@ Optional arguments:
|
|||
-f, --force Deletes and recreates all links, even if the filesystem state
|
||||
seems to indicate that this is unnecessary.
|
||||
```
|
||||
|
||||
### See Also
|
||||
|
||||
- [rush unlink]({% link pages/commands/rush_unlink.md %})
|
||||
|
|
|
@ -90,3 +90,8 @@ Optional arguments:
|
|||
tags at the commit hash specified. If not provided,
|
||||
the current HEAD will be tagged.
|
||||
```
|
||||
|
||||
### See Also
|
||||
|
||||
- [Publishing packages]({% link pages/maintainer/publishing.md %})
|
||||
- [rush version]({% link pages/commands/rush_version.md %})
|
||||
|
|
|
@ -23,11 +23,14 @@ of "rush rebuild".)
|
|||
Optional arguments:
|
||||
-h, --help Show this help message and exit.
|
||||
-p COUNT, --parallelism COUNT
|
||||
Specify the number of concurrent build processes The
|
||||
value "max" can be specified to indicate the number
|
||||
of CPU cores. If this parameter omitted, the default
|
||||
value depends on the operating system and number of
|
||||
CPU cores.
|
||||
Specifies the maximum number of concurrent processes
|
||||
to launch during a build. The COUNT should be a
|
||||
positive integer or else the word "max" to specify a
|
||||
count that is equal to the number of CPU cores. If
|
||||
this parameter is omitted, then the default value
|
||||
depends on the operating system and number of CPU
|
||||
cores. This parameter may alternatively be specified
|
||||
via the RUSH_PARALLELISM environment variable.
|
||||
-t PROJECT1, --to PROJECT1
|
||||
Run command in the specified project and all of its
|
||||
dependencies. "." can be used as shorthand to specify
|
||||
|
@ -48,3 +51,7 @@ Optional arguments:
|
|||
-v, --verbose Display the logs during the build, rather than just
|
||||
displaying the build status summary
|
||||
```
|
||||
|
||||
### See Also
|
||||
|
||||
- [rush build]({% link pages/commands/rush_build.md %})
|
||||
|
|
|
@ -14,3 +14,7 @@ files, or for using standard NPM commands on a project.
|
|||
Optional arguments:
|
||||
-h, --help Show this help message and exit.
|
||||
```
|
||||
|
||||
### See Also
|
||||
|
||||
- [rush link]({% link pages/commands/rush_link.md %})
|
||||
|
|
|
@ -7,7 +7,8 @@ navigation_source: docs_nav
|
|||
```
|
||||
usage: rush update [-h] [-p] [--bypass-policy] [--no-link]
|
||||
[--network-concurrency COUNT] [--debug-package-manager]
|
||||
[--variant VARIANT] [--full] [--recheck]
|
||||
[--max-install-attempts NUMBER] [--variant VARIANT]
|
||||
[--full] [--recheck]
|
||||
|
||||
|
||||
The "rush update" command installs the dependencies described in your package.
|
||||
|
@ -40,8 +41,11 @@ Optional arguments:
|
|||
Activates verbose logging for the package manager.
|
||||
You will probably want to pipe the output of Rush to
|
||||
a file when using this command.
|
||||
--max-install-attempts NUMBER
|
||||
Overrides the default maximum number of install
|
||||
attempts. The default value is 3.
|
||||
--variant VARIANT Run command using a variant installation
|
||||
configuration. This parameter may alternatively
|
||||
configuration. This parameter may alternatively be
|
||||
specified via the RUSH_VARIANT environment variable.
|
||||
--full Normally "rush update" tries to preserve your
|
||||
existing installed versions and only makes the
|
||||
|
@ -63,3 +67,7 @@ Optional arguments:
|
|||
shrinkwrap churn, these fixups are normally performed
|
||||
only in the temporary folder.)
|
||||
```
|
||||
|
||||
### See Also
|
||||
|
||||
- [rush install]({% link pages/commands/rush_install.md %})
|
||||
|
|
|
@ -46,3 +46,9 @@ Optional arguments:
|
|||
replaces the prerelease name when
|
||||
"--ensure-version-policy" is provided.
|
||||
```
|
||||
|
||||
### See Also
|
||||
|
||||
- [Publishing packages]({% link pages/maintainer/publishing.md %})
|
||||
- [rush change]({% link pages/commands/rush_change.md %})
|
||||
- [rush publish]({% link pages/commands/rush_publish.md %})
|
||||
|
|
|
@ -4,7 +4,8 @@ title: command-line.json
|
|||
navigation_source: docs_nav
|
||||
---
|
||||
|
||||
This is the template that `rush init` generates for **./common/config/rush/command-line.json**:
|
||||
This is the template that [rush init]({% link pages/commands/rush_init.md %})
|
||||
generates for **common/config/rush/command-line.json**:
|
||||
|
||||
```js
|
||||
/**
|
||||
|
@ -37,6 +38,9 @@ This is the template that `rush init` generates for **./common/config/rush/comma
|
|||
// * The name should be comprised of lower case words separated by hyphens or colons. The name should include an
|
||||
// * English verb (e.g. "deploy"). Use a hyphen to separate words (e.g. "upload-docs"). A group of related commands
|
||||
// * can be prefixed with a colon (e.g. "docs:generate", "docs:deploy", "docs:serve", etc).
|
||||
// *
|
||||
// * Note that if the "rebuild" command is overridden here, it becomes separated from the "build" command
|
||||
// * and will call the "rebuild" script instead of the "build" script.
|
||||
// */
|
||||
// "name": "my-bulk-command",
|
||||
//
|
||||
|
@ -125,11 +129,31 @@ This is the template that `rush init` generates for **./common/config/rush/comma
|
|||
// "safeForSimultaneousRushProcesses": false,
|
||||
//
|
||||
// /**
|
||||
// * A script that will be invoked using the OS shell. The working directory will be the folder
|
||||
// * that contains rush.json. If custom parameters are associated with this command, their
|
||||
// * (Required) A script that will be invoked using the OS shell. The working directory will be
|
||||
// * the folder that contains rush.json. If custom parameters are associated with this command, their
|
||||
// * values will be appended to the end of this string.
|
||||
// */
|
||||
// "shellCommand": "node common/scripts/my-global-command.js"
|
||||
// "shellCommand": "node common/scripts/my-global-command.js",
|
||||
//
|
||||
// /**
|
||||
// * If your "shellCommand" script depends on NPM packages, the recommended best practice is
|
||||
// * to make it into a regular Rush project that builds using your normal toolchain. In cases where
|
||||
// * the command needs to work without first having to run "rush build", the recommended practice
|
||||
// * is to publish the project to an NPM registry and use common/scripts/install-run.js to launch it.
|
||||
// *
|
||||
// * Autoinstallers offer another possibility: They are folders under "common/autoinstallers" with
|
||||
// * a package.json file and shrinkwrap file. Rush will automatically invoke the package manager to
|
||||
// * install these dependencies before an associated command is invoked. Autoinstallers have the
|
||||
// * advantage that they work even in a branch where "rush install" is broken, which makes them a
|
||||
// * good solution for Git hook scripts. But they have the disadvantages of not being buildable
|
||||
// * projects, and of increasing the overall installation footprint for your monorepo.
|
||||
// *
|
||||
// * The "autoinstallerName" setting must not contain a path and must be a valid NPM package name.
|
||||
// * For example, the name "my-task" would map to "common/autoinstallers/my-task/package.json", and
|
||||
// * the "common/autoinstallers/my-task/node_modules/.bin" folder would be added to the shell PATH when
|
||||
// * invoking the "shellCommand".
|
||||
// */
|
||||
// // "autoinstallerName": "my-task"
|
||||
// }
|
||||
],
|
||||
|
||||
|
@ -173,7 +197,7 @@ This is the template that `rush init` generates for **./common/config/rush/comma
|
|||
// * (Required) A list of custom commands and/or built-in Rush commands that this parameter may
|
||||
// * be used with. The parameter will be appended to the shell command that Rush invokes.
|
||||
// */
|
||||
// "associatedCommands": [ "build", "rebuild" ]
|
||||
// "associatedCommands": ["build", "rebuild"]
|
||||
// },
|
||||
//
|
||||
// {
|
||||
|
@ -185,7 +209,7 @@ This is the template that `rush init` generates for **./common/config/rush/comma
|
|||
// "longName": "--my-string",
|
||||
// "description": "A custom string parameter for the \"my-global-command\" custom command",
|
||||
//
|
||||
// "associatedCommands": [ "my-global-command" ],
|
||||
// "associatedCommands": ["my-global-command"],
|
||||
//
|
||||
// /**
|
||||
// * The name of the argument, which will be shown in the command-line help.
|
||||
|
@ -212,12 +236,12 @@ This is the template that `rush init` generates for **./common/config/rush/comma
|
|||
// "longName": "--my-choice",
|
||||
// "description": "A custom choice parameter for the \"my-global-command\" custom command",
|
||||
//
|
||||
// "associatedCommands": [ "my-global-command" ],
|
||||
// "associatedCommands": ["my-global-command"],
|
||||
//
|
||||
// /**
|
||||
// * If true, this parameter must be included with the command. The default is false.
|
||||
// */
|
||||
// "required": false,
|
||||
// "required": false,
|
||||
//
|
||||
// /**
|
||||
// * Normally if a parameter is omitted from the command line, it will not be passed
|
||||
|
|
|
@ -4,7 +4,8 @@ title: common-versions.json
|
|||
navigation_source: docs_nav
|
||||
---
|
||||
|
||||
This is the template that `rush init` generates for **./common/config/rush/common-versions.json**:
|
||||
This is the template that [rush init]({% link pages/commands/rush_init.md %})
|
||||
generates for **common/config/rush/common-versions.json**:
|
||||
|
||||
```js
|
||||
/**
|
||||
|
@ -28,7 +29,6 @@ This is the template that `rush init` generates for **./common/config/rush/commo
|
|||
* will recalculate all version selections.
|
||||
*/
|
||||
"preferredVersions": {
|
||||
|
||||
/**
|
||||
* When someone asks for "^1.0.0" make sure they get "1.2.3" when working in this repo,
|
||||
* instead of the latest version.
|
||||
|
@ -60,8 +60,7 @@ This is the template that `rush init` generates for **./common/config/rush/commo
|
|||
* USUAL VERSION (WHICH IS INFERRED BY LOOKING AT ALL PROJECTS IN THE REPO).
|
||||
* This design avoids unnecessary churn in this file.
|
||||
*/
|
||||
"allowedAlternativeVersions": {
|
||||
|
||||
"allowedAlternativeVersions": {
|
||||
/**
|
||||
* For example, allow some projects to use an older TypeScript compiler
|
||||
* (in addition to whatever "usual" version is being used by other projects in the repo):
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
---
|
||||
layout: page
|
||||
title: deploy.json
|
||||
navigation_source: docs_nav
|
||||
---
|
||||
|
||||
This is the template that [rush init-deploy]({% link pages/commands/rush_init-deploy.md %})
|
||||
generates for **common/config/rush/deploy.json**:
|
||||
|
||||
```js
|
||||
/**
|
||||
* This configuration file defines a deployment scenario for use with the "rush deploy" command.
|
||||
* The default scenario file path is "deploy.json"; additional files use the naming pattern
|
||||
* "deploy-<scenario-name>.json". For full documentation, please see https://rushjs.io
|
||||
*/
|
||||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/rush/v5/deploy-scenario.schema.json",
|
||||
|
||||
/**
|
||||
* The "rush deploy" command prepares a deployment folder, starting from the main project and collecting
|
||||
* all of its dependencies (both NPM packages and other Rush projects). The main project is specified
|
||||
* using the "--project" parameter. The "deploymentProjectNames" setting lists the allowable choices for
|
||||
* the "--project" parameter; this documents the intended deployments for your monorepo and helps validate
|
||||
* that "rush deploy" is invoked correctly. If there is only one item in the "deploymentProjectNames" array,
|
||||
* then "--project" can be omitted. The names should be complete package names as declared in rush.json.
|
||||
*
|
||||
* If the main project should include other unrelated Rush projects, add it to the "projectSettings" section,
|
||||
* and then specify those projects in the "additionalProjectsToInclude" list.
|
||||
*/
|
||||
"deploymentProjectNames": [ /* YOUR PROJECT HERE */ ],
|
||||
|
||||
/**
|
||||
* When deploying a local Rush project, the package.json "devDependencies" are normally excluded.
|
||||
* If you want to include them, set "includeDevDependencies" to true.
|
||||
*
|
||||
* The default value is false.
|
||||
*/
|
||||
// "includeDevDependencies": true,
|
||||
|
||||
/**
|
||||
* When deploying a local Rush project, normally the .npmignore filter is applied so that Rush only copies
|
||||
* files that would be packaged by "npm pack". Setting "includeNpmIgnoreFiles" to true will disable this
|
||||
* filtering so that all files are copied (with a few trivial exceptions such as the "node_modules" folder).
|
||||
*
|
||||
* The default value is false.
|
||||
*/
|
||||
// "includeNpmIgnoreFiles": true,
|
||||
|
||||
/**
|
||||
* Specify how links (symbolic links, hard links, and/or NTFS junctions) will be created in the deployed folder:
|
||||
*
|
||||
* - "default": Create the links while copying the files; this is the default behavior.
|
||||
* - "script": A Node.js script called "create-links.js" will be written. When executed, this script will
|
||||
* create the links described in the "deploy-metadata.json" output file.
|
||||
* - "none": Do nothing; some other tool may create the links later.
|
||||
*/
|
||||
// "linkCreation": "script",
|
||||
|
||||
/**
|
||||
* Customize how Rush projects are processed during deployment.
|
||||
*/
|
||||
"projectSettings": [
|
||||
// {
|
||||
// /**
|
||||
// * The full package name of the project, which must be declared in rush.json.
|
||||
// */
|
||||
// "projectName": "@my-scope/my-project",
|
||||
//
|
||||
// /**
|
||||
// * A list of additional local Rush projects to be deployed with this project (beyond the package.json
|
||||
// * dependencies). Specify full package names, which must be declared in rush.json.
|
||||
// */
|
||||
// "additionalProjectsToInclude": [
|
||||
// // "@my-scope/my-project2"
|
||||
// ]
|
||||
// }
|
||||
]
|
||||
}
|
||||
```
|
|
@ -4,17 +4,44 @@ title: Environment variables
|
|||
navigation_source: docs_nav
|
||||
---
|
||||
|
||||
There are several shell environment variables that you can use to customize the Rush tool's behavior.
|
||||
The Rush tool's behavior can be customized using the shell environment variables described below:
|
||||
|
||||
## RUSH_TEMP_FOLDER
|
||||
## RUSH_ABSOLUTE_SYMLINKS
|
||||
|
||||
This variable overrides the temporary folder used by Rush. The default value is "common/temp" under the
|
||||
repository root.
|
||||
If this variable is set to `true`, Rush will create symlinks with absolute paths instead
|
||||
of relative paths. This can be necessary when a repository is moved during a build or
|
||||
if parts of a repository are moved into a sandbox.
|
||||
|
||||
## RUSH_ALLOW_UNSUPPORTED_NODEJS
|
||||
|
||||
If this variable is set to `true`, Rush will not fail the build when running a version
|
||||
of Node that does not match the criteria specified in the `nodeSupportedVersionRange`
|
||||
field from **rush.json**.
|
||||
|
||||
## RUSH_DEPLOY_TARGET_FOLDER
|
||||
|
||||
This environment variable can be used to specify the `--target-folder` parameter
|
||||
for the [rush deploy]({% link pages/commands/rush_deploy.md %}) command.
|
||||
|
||||
## RUSH_PARALLELISM
|
||||
|
||||
Specifies the maximum number of concurrent processes to launch during a build.
|
||||
For more information, see the command-line help for the `--parallelism` parameter for
|
||||
[rush build]({% link pages/commands/rush_build.md %}).
|
||||
|
||||
## RUSH_PNPM_STORE_PATH
|
||||
|
||||
When using PNPM as the package manager, this variable can be used to configure the path that
|
||||
PNPM will use as the store directory.
|
||||
|
||||
If a relative path is used, then the store path will be resolved relative to the process's
|
||||
current working directory. An absolute path is recommended.
|
||||
|
||||
## RUSH_PREVIEW_VERSION
|
||||
|
||||
This variable overrides the version of Rush that will be installed by the version selector. The default value
|
||||
is determined by the `rushVersion` field from rush.json.
|
||||
This variable overrides the version of Rush that will be installed by
|
||||
the version selector. The default value is determined by the `rushVersion`
|
||||
field from rush.json.
|
||||
|
||||
For example, if you want to try out a different release of Rush before upgrading your repo, you can assign
|
||||
the variable like this:
|
||||
|
@ -24,14 +51,15 @@ $ set RUSH_PREVIEW_VERSION=5.0.0-dev.25
|
|||
$ rush install
|
||||
```
|
||||
|
||||
## RUSH_TEMP_FOLDER
|
||||
|
||||
This variable overrides the temporary folder used by Rush.
|
||||
The default value is **common/temp** under the repository root.
|
||||
|
||||
## RUSH_VARIANT
|
||||
|
||||
This variable selects an alternate installation variant for Rush to use when installing and linking
|
||||
package dependencies. For more information about this feature, see
|
||||
This variable selects a specific installation variant for Rush to use when installing
|
||||
and linking package dependencies.
|
||||
|
||||
For more information about this feature, see
|
||||
[Installation Variants]({% link pages/advanced/installation_variants.md %}).
|
||||
|
||||
## RUSH_ABSOLUTE_SYMLINKS
|
||||
|
||||
If this variable is set to "true", Rush will create symlinks with absolute paths instead
|
||||
of relative paths. This can be necessary when a repository is moved during a build or
|
||||
if parts of a repository are moved into a sandbox.
|
||||
|
|
|
@ -4,7 +4,8 @@ title: experiments.json
|
|||
navigation_source: docs_nav
|
||||
---
|
||||
|
||||
This is the template that `rush init` generates for **./common/config/rush/experiments.json**:
|
||||
This is the template that [rush init]({% link pages/commands/rush_init.md %})
|
||||
generates for **common/config/rush/experiments.json**:
|
||||
|
||||
```js
|
||||
/**
|
||||
|
@ -15,12 +16,24 @@ This is the template that `rush init` generates for **./common/config/rush/exper
|
|||
"$schema": "https://developer.microsoft.com/json-schemas/rush/v5/experiments.schema.json",
|
||||
|
||||
/**
|
||||
* Rush 5.14.0 improved incremental builds to ignore spurious changes in the pnpm-lock.json file.
|
||||
* This optimization is enabled by default. If you encounter a problem where "rush build" is neglecting
|
||||
* to build some projects, please open a GitHub issue. As a workaround you can uncomment this line
|
||||
* to temporarily restore the old behavior where everything must be rebuilt whenever pnpm-lock.json
|
||||
* is modified.
|
||||
*/
|
||||
// "legacyIncrementalBuildDependencyDetection": true
|
||||
* Rush 5.14.0 improved incremental builds to ignore spurious changes in the pnpm-lock.json file.
|
||||
* This optimization is enabled by default. If you encounter a problem where "rush build" is neglecting
|
||||
* to build some projects, please open a GitHub issue. As a workaround you can uncomment this line
|
||||
* to temporarily restore the old behavior where everything must be rebuilt whenever pnpm-lock.json
|
||||
* is modified.
|
||||
*/
|
||||
// "legacyIncrementalBuildDependencyDetection": true,
|
||||
|
||||
/**
|
||||
* By default, rush passes --no-prefer-frozen-lockfile to 'pnpm install'.
|
||||
* Set this option to true to pass '--frozen-lockfile' instead.
|
||||
*/
|
||||
// "usePnpmFrozenLockfileForRushInstall": true,
|
||||
|
||||
/**
|
||||
* If true, the chmod field in temporary project tar headers will not be normalized.
|
||||
* This normalization can help ensure consistent tarball integrity across platforms.
|
||||
*/
|
||||
// "noChmodFieldInTarHeaderNormalization": true
|
||||
}
|
||||
```
|
||||
|
|
|
@ -4,7 +4,8 @@ title: .npmrc
|
|||
navigation_source: docs_nav
|
||||
---
|
||||
|
||||
This is the template that `rush init` generates for **./common/config/rush/.npmrc**:
|
||||
This is the template that [rush init]({% link pages/commands/rush_init.md %})
|
||||
generates for **common/config/rush/.npmrc**:
|
||||
|
||||
```shell
|
||||
# Rush uses this file to configure the package registry, regardless of whether the
|
||||
|
|
|
@ -4,7 +4,8 @@ title: pnpmfile.js
|
|||
navigation_source: docs_nav
|
||||
---
|
||||
|
||||
This is the template that `rush init` generates for **./common/config/rush/pnpmfile.js**:
|
||||
This is the template that [rush init]({% link pages/commands/rush_init.md %})
|
||||
generates for **common/config/rush/pnpmfile.js**:
|
||||
|
||||
```js
|
||||
"use strict";
|
||||
|
|
|
@ -4,7 +4,8 @@ title: rush.json
|
|||
navigation_source: docs_nav
|
||||
---
|
||||
|
||||
This is the template that `rush init` generates for **rush.json** (in the repo root folder):
|
||||
This is the template that [rush init]({% link pages/commands/rush_init.md %})
|
||||
generates for **rush.json** (in the repo root folder):
|
||||
|
||||
```js
|
||||
/**
|
||||
|
@ -25,7 +26,7 @@ This is the template that `rush init` generates for **rush.json** (in the repo r
|
|||
* path segment in the "$schema" field for all your Rush config files. This will ensure
|
||||
* correct error-underlining and tab-completion for editors such as VS Code.
|
||||
*/
|
||||
"rushVersion": "5.21.0",
|
||||
"rushVersion": "5.26.0",
|
||||
|
||||
/**
|
||||
* The next field selects which package manager should be installed and determines its version.
|
||||
|
@ -35,7 +36,7 @@ This is the template that `rush init` generates for **rush.json** (in the repo r
|
|||
* Specify one of: "pnpmVersion", "npmVersion", or "yarnVersion". See the Rush documentation
|
||||
* for details about these alternatives.
|
||||
*/
|
||||
"pnpmVersion": "2.15.1",
|
||||
"pnpmVersion": "4.12.5",
|
||||
|
||||
// "npmVersion": "4.5.0",
|
||||
// "yarnVersion": "1.9.4",
|
||||
|
@ -73,7 +74,6 @@ This is the template that `rush init` generates for **rush.json** (in the repo r
|
|||
*/
|
||||
// "strictPeerDependencies": true,
|
||||
|
||||
|
||||
/**
|
||||
* Configures the strategy used to select versions during installation.
|
||||
*
|
||||
|
@ -86,7 +86,25 @@ This is the template that `rush init` generates for **rush.json** (in the repo r
|
|||
* After modifying this field, it's recommended to run "rush update --full" so that the package manager
|
||||
* will recalculate all version selections.
|
||||
*/
|
||||
// "resolutionStrategy": "fast"
|
||||
// "resolutionStrategy": "fast",
|
||||
|
||||
/**
|
||||
* If true, then `rush install` will report an error if manual modifications
|
||||
* were made to the PNPM shrinkwrap file without running "rush update" afterwards.
|
||||
*
|
||||
* This feature protects against accidental inconsistencies that may be introduced
|
||||
* if the PNPM shrinkwrap file ("pnpm-lock.yaml") is manually edited. When this
|
||||
* feature is enabled, "rush update" will append a hash to the file as a YAML comment,
|
||||
* and then "rush update" and "rush install" will validate the hash. Note that this does not prohibit
|
||||
* manual modifications, but merely requires "rush update" be run
|
||||
* afterwards, ensuring that PNPM can report or repair any potential inconsistencies.
|
||||
*
|
||||
* To temporarily disable this validation when invoking "rush install", use the
|
||||
* "--bypass-policy" command-line parameter.
|
||||
*
|
||||
* The default value is false.
|
||||
*/
|
||||
// "preventManualShrinkwrapChanges": true
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -97,19 +115,19 @@ This is the template that `rush init` generates for **rush.json** (in the repo r
|
|||
* Specify a SemVer range to ensure developers use a Node.js version that is appropriate
|
||||
* for your repo.
|
||||
*/
|
||||
"nodeSupportedVersionRange": ">=10.13.0 <11.0.0",
|
||||
"nodeSupportedVersionRange": ">=12.13.0 <13.0.0",
|
||||
|
||||
/**
|
||||
* Odd-numbered major versions of Node.js are experimental. Even-numbered releases
|
||||
* spend six months in a stabilization period before the first Long Term Support (LTS) version.
|
||||
* For example, 8.9.0 was the first LTS version of Node.js 8. Pre-LTS versions are not recommended
|
||||
* for production usage because they frequently have bugs. They may cause Rush itself
|
||||
* to malfunction.
|
||||
*
|
||||
* Rush normally prints a warning if it detects a pre-LTS Node.js version. If you are testing
|
||||
* pre-LTS versions in preparation for supporting the first LTS version, you can use this setting
|
||||
* to disable Rush's warning.
|
||||
*/
|
||||
* Odd-numbered major versions of Node.js are experimental. Even-numbered releases
|
||||
* spend six months in a stabilization period before the first Long Term Support (LTS) version.
|
||||
* For example, 8.9.0 was the first LTS version of Node.js 8. Pre-LTS versions are not recommended
|
||||
* for production usage because they frequently have bugs. They may cause Rush itself
|
||||
* to malfunction.
|
||||
*
|
||||
* Rush normally prints a warning if it detects a pre-LTS Node.js version. If you are testing
|
||||
* pre-LTS versions in preparation for supporting the first LTS version, you can use this setting
|
||||
* to disable Rush's warning.
|
||||
*/
|
||||
// "suppressNodeLtsWarning": false,
|
||||
|
||||
/**
|
||||
|
@ -123,7 +141,7 @@ This is the template that `rush init` generates for **rush.json** (in the repo r
|
|||
* version. In those cases, you will need to add an entry to the "allowedAlternativeVersions"
|
||||
* section of the common-versions.json.
|
||||
*/
|
||||
// "ensureConsistentVersions": true,
|
||||
// "ensureConsistentVersions": true,
|
||||
|
||||
/**
|
||||
* Large monorepos can become intimidating for newcomers if project folder paths don't follow
|
||||
|
@ -151,6 +169,19 @@ This is the template that `rush init` generates for **rush.json** (in the repo r
|
|||
// "projectFolderMinDepth": 2,
|
||||
// "projectFolderMaxDepth": 2,
|
||||
|
||||
/**
|
||||
* Today the npmjs.com registry enforces fairly strict naming rules for packages, but in the early
|
||||
* days there was no standard and hardly any enforcement. A few large legacy projects are still using
|
||||
* nonstandard package names, and private registries sometimes allow it. Set "allowMostlyStandardPackageNames"
|
||||
* to true to relax Rush's enforcement of package names. This allows upper case letters and in the future may
|
||||
* relax other rules, however we want to minimize these exceptions. Many popular tools use certain punctuation
|
||||
* characters as delimiters, based on the assumption that they will never appear in a package name; thus if we relax
|
||||
* the rules too much it is likely to cause very confusing malfunctions.
|
||||
*
|
||||
* The default value is false.
|
||||
*/
|
||||
// "allowMostlyStandardPackageNames": true,
|
||||
|
||||
/**
|
||||
* This feature helps you to review and approve new packages before they are introduced
|
||||
* to your monorepo. For example, you may be concerned about licensing, code quality,
|
||||
|
@ -184,7 +215,7 @@ This is the template that `rush init` generates for **rush.json** (in the repo r
|
|||
// * if the underlying package was already approved, this would imply that the typings
|
||||
// * are also approved.
|
||||
// */
|
||||
// // "ignoredNpmScopes": [ "@types" ]
|
||||
// // "ignoredNpmScopes": ["@types"]
|
||||
// },
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,7 +4,8 @@ title: version-policies.json
|
|||
navigation_source: docs_nav
|
||||
---
|
||||
|
||||
This is the template that `rush init` generates for **./common/config/rush/version-policies.json**:
|
||||
This is the template that [rush init]({% link pages/commands/rush_init.md %})
|
||||
generates for **common/config/rush/version-policies.json**:
|
||||
|
||||
```js
|
||||
/**
|
||||
|
@ -12,11 +13,11 @@ This is the template that `rush init` generates for **./common/config/rush/versi
|
|||
* For full documentation, please see https://rushjs.io
|
||||
*/
|
||||
|
||||
/**
|
||||
* A list of version policy definitions. A "version policy" is a custom package versioning
|
||||
* strategy that affects "rush change", "rush version", and "rush publish". The strategy applies
|
||||
* to a set of projects that are specified using the "versionPolicyName" field in rush.json.
|
||||
*/
|
||||
/**
|
||||
* A list of version policy definitions. A "version policy" is a custom package versioning
|
||||
* strategy that affects "rush change", "rush version", and "rush publish". The strategy applies
|
||||
* to a set of projects that are specified using the "versionPolicyName" field in rush.json.
|
||||
*/
|
||||
[
|
||||
// {
|
||||
// /**
|
||||
|
|
|
@ -0,0 +1,209 @@
|
|||
---
|
||||
layout: page
|
||||
title: Deploying projects
|
||||
navigation_source: docs_nav
|
||||
---
|
||||
|
||||
Suppose that your monorepo includes a Node.js service that we want to deploy to a web server.
|
||||
For example, let's say the Node.js service is a local Rush project called `app1`, and the repo is
|
||||
organized as follows:
|
||||
|
||||
- **apps/app1**:
|
||||
- depends on `ext-lib7` (from NPM) and `lib3` (a local project)
|
||||
- dev dependencies on `ext-tool8` (from NPM) and `tool6` (a local project)
|
||||
- **apps/app2**: depends on `lib3` and `lib4`
|
||||
- **libraries/lib3**: depends on `lib5`
|
||||
- **libraries/lib4**: no dependencies
|
||||
- **libraries/lib5**: peer dependency on `ext-lib7`
|
||||
- **tools/tool6**: no dependencies
|
||||
|
||||
One solution might be to run `rush install` and `rush build`, and then copy the entire monorepo to the server.
|
||||
However, this could potentially include many extraneous files and NPM packages. Instead we would like to copy
|
||||
only `app1` and its regular dependencies (`ext-lib7`, `lib3`, `lib5`). We do not want to include dev dependencies such
|
||||
as `ext-tool8`.
|
||||
|
||||
The [rush deploy]({% link pages/commands/rush_deploy.md %}) command calculates this set of files and
|
||||
copies them to a target folder, which you can then upload to your server.
|
||||
|
||||
## Configuring "rush deploy"
|
||||
|
||||
The `rush deploy` command reads its settings from a config file
|
||||
[common/config/rush/deploy.json]({% link pages/configs/deploy_json.md %}). This config file is not created
|
||||
by `rush init`. Instead, you create the file using [rush init-deploy]({% link pages/commands/rush_init-deploy.md %}).
|
||||
|
||||
Continuing our example, we can create the file using this command:
|
||||
|
||||
```shell
|
||||
# Create common/config/rush/deploy.json and configure it to deploy "app1"
|
||||
$ rush init-deploy --project app1
|
||||
```
|
||||
|
||||
After the file **deploy.json** is created, open it in your editor and adjust the settings as appropriate. Then
|
||||
commit this file to Git.
|
||||
|
||||
## Preparing a deployment
|
||||
|
||||
To copy the files to the deployment target folder, you would use these commands:
|
||||
|
||||
```shell
|
||||
# Install dependencies
|
||||
$ rush install
|
||||
|
||||
# Build the monorepo
|
||||
$ rush build
|
||||
|
||||
# Copy app1 and its dependencies to the default target folder: common/deploy/
|
||||
$ rush deploy
|
||||
```
|
||||
|
||||
This will prepare a deployment by copying `app1` and its dependencies the target folder. The copied files will be
|
||||
organized similarly to the monorepo's folder structure:
|
||||
|
||||
- **common/deploy/apps/app1/...**
|
||||
- **common/deploy/common/temp/node_modules/ext-lib7/...**
|
||||
- **common/deploy/libraries/lib3/...**
|
||||
- **common/deploy/libraries/lib4/...**
|
||||
|
||||
You can test that the deployment worked correctly by executing `app1` from within the deployment target folder:
|
||||
|
||||
```shell
|
||||
# Change to the app1 location under the target folder
|
||||
$ cd common/deploy/apps/app1
|
||||
|
||||
# Invoke the package.json script that starts the web service
|
||||
$ rushx start
|
||||
```
|
||||
|
||||
If the project fails to run (but worked correctly from its original location **apps/app1**), then you many
|
||||
need to tune the settings in **deploy.json**. Once you've confirmed that the project works correctly, the next step
|
||||
is to upload the **common/deploy** subtree to your server machine.
|
||||
|
||||
## Handling links
|
||||
|
||||
The **common/deploy** subtree will have symbolic links created by `rush install`. For example, if you are using the
|
||||
PNPM package manager, then **common/deploy/apps/app1/node_modules/ext-lib7** may be a symlink to a folder under the
|
||||
**common/deploy/common/temp/node_modules/.pnpm/...** path. Correctly replicating these links can be problematic for
|
||||
upload tools such as `tar` or `ftp`.
|
||||
|
||||
The **deploy.json** config file provides a setting `linkCreation` that offers choices for handling links:
|
||||
|
||||
- `"default"`: Create the links while copying the files; this is the default behavior. Use this setting if your
|
||||
file copy tool can handle links correctly.
|
||||
- `"script"`: A Node.js script called **create-links.js** will be written to the target folder. Use this setting
|
||||
to create links on the server machine, after the files have been uploaded.
|
||||
- `"none"`: Do nothing; some other tool may create the links later, based on the **deploy-metadata.json** file.
|
||||
|
||||
The **deploy-metadata.json** file is written to the deployment target folder and contains a full inventory of
|
||||
links that need to be created. It might look something like this:
|
||||
|
||||
```js
|
||||
{
|
||||
"scenarioName": "deploy.json",
|
||||
"mainProjectName": "app1",
|
||||
"links": [
|
||||
{
|
||||
"kind": "folderLink",
|
||||
"linkPath": "common/deploy/apps/app1/node_modules/ext-lib7",
|
||||
"targetPath": "common/deploy/common/temp/node_modules/.pnpm/registry.npmjs.org/ext-lib7/1.0.0/node_modules/ext-lib7"
|
||||
},
|
||||
. . .
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
If you specify `"linkCreation": "script"` then `rush deploy` will create the **common/deploy** folder without
|
||||
any links. After you have uploaded this folder to your server machine, you can then invoke the script
|
||||
to create the links:
|
||||
|
||||
```shell
|
||||
# Invoke this command on the server machine, after the files have been uploaded
|
||||
$ node create-links.js create
|
||||
```
|
||||
|
||||
## Including additional projects
|
||||
|
||||
Continuing our example, suppose that we want to include `app1` and `app2` together as a single deployment.
|
||||
Since `app2` is not a dependency of `app1`, it will not be included automatically. We can consider `app1` to be
|
||||
the "main project" (listed in `deploymentProjectNames`), and then declare `app2` as an "additional project".
|
||||
The config file would look like this:
|
||||
|
||||
**common/config/rush/deploy.json**
|
||||
|
||||
```js
|
||||
{
|
||||
. . .
|
||||
// The main project
|
||||
"deploymentProjectNames": ["app1"],
|
||||
. . .
|
||||
"projectSettings": [
|
||||
{
|
||||
"projectName": "app1",
|
||||
|
||||
// When deploying "app1", include "app2". We need to add this explicitly because
|
||||
// "app2" is not a dependency of "app1".
|
||||
"additionalProjectsToInclude": [ "app2" ]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Multiple deployments using the same config file
|
||||
|
||||
Continuing our example, suppose that instead we want `app1` and `app2` to be deployed separately to two different
|
||||
web servers. If the settings are the same, we can simply add both of them to the `deploymentProjectNames` array,
|
||||
like this:
|
||||
|
||||
**common/config/rush/deploy.json**
|
||||
|
||||
```js
|
||||
. . .
|
||||
"deploymentProjectNames": [ "app1", "app2" ],
|
||||
. . .
|
||||
```
|
||||
|
||||
When performing the deployment, the `--project` parameter selects which project to deploy. For example:
|
||||
|
||||
```shell
|
||||
# Copy app1 and its dependencies to /mnt/deploy/app1
|
||||
$ rush deploy --project app1 --target-folder /mnt/deploy/app1
|
||||
|
||||
# Copy app2 and its dependencies to /mnt/deploy/app2
|
||||
$ rush deploy --project app2 --target-folder /mnt/deploy/app2
|
||||
```
|
||||
|
||||
The `--target-folder` parameter copies the files to a custom location instead of the **common/deploy/** default folder.
|
||||
|
||||
## Multiple deployments using different config files
|
||||
|
||||
Continuing our example, suppose that `app2` deploys separately and it requires different settings from `app1`.
|
||||
For example, suppose that we want `"linkCreation": "default"` for `app1`, but `"linkCreation": "script"` for `app2`.
|
||||
We will create two config files:
|
||||
|
||||
- **common/config/rush/deploy.json** - the default scenario file, which we'll use for `app1`
|
||||
- **common/config/rush/deploy-app2-example.json** -- the `app2-example` scenario, which we will use for `app2`
|
||||
|
||||
Both of these files can be created using `rush init-deploy`:
|
||||
|
||||
```shell
|
||||
# Create common/config/rush/deploy.json
|
||||
$ rush init-deploy --project app1
|
||||
|
||||
# Create common/config/rush/deploy-app2-example.json
|
||||
$ rush init-deploy --project app2 --scenario app2-example
|
||||
```
|
||||
|
||||
After editing **deploy-app2-example.json** to specify `"linkCreation": "script"`, we can now use the
|
||||
`--scenario` parameter with `rush deploy`:
|
||||
|
||||
```shell
|
||||
# Copy app1 and its dependencies to /mnt/deploy/app1
|
||||
# Uses scenario file: common/config/rush/deploy.json
|
||||
$ rush deploy --target-folder /mnt/deploy/app1
|
||||
|
||||
# Copy app2 and its dependencies to /mnt/deploy/app2
|
||||
# Uses scenario file: common/config/rush/deploy-app2-example.json
|
||||
$ rush deploy --target-folder /mnt/deploy/app2 --scenario app2-example
|
||||
```
|
||||
|
||||
Note that the `--project` parameter is not needed with `rush deploy` because each config file has only one project
|
||||
in its `"deploymentProjectNames"` array.
|
Загрузка…
Ссылка в новой задаче