Skip to content

Commit

Permalink
Merge pull request #7 from tiktok/chore-command-line
Browse files Browse the repository at this point in the history
feat: turn on phased commands
  • Loading branch information
chengcyber authored Feb 22, 2024
2 parents a407458 + 059916b commit e705f50
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 13 deletions.
93 changes: 81 additions & 12 deletions common/config/rush/command-line.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,49 @@
// */
// // "autoinstallerName": "my-task"
// }
{
"commandKind": "phased",
"name": "build",
"phases": ["_phase:build"]
},

{
"commandKind": "phased",
"name": "test",
"summary": "Builds all projects and runs their tests.",
"phases": ["_phase:build", "_phase:test"],
"enableParallelism": true,
"incremental": true
},

{
"commandKind": "phased",
"name": "retest",
"summary": "Rebuilds all projects and reruns their tests.",
"phases": ["_phase:build", "_phase:test"],
"enableParallelism": true,
"incremental": false
},

{
"commandKind": "phased",
"name": "start",
"summary": "Build all projects, then watch for changes, build and test.",
"description": "Build all projects, then watches for changes and builds and runs tests for affected projects.",
"safeForSimultaneousRushProcesses": false,

"enableParallelism": true,
"incremental": true,
// Initial execution only uses the build phase so that all dependencies of watch phases have been built
"phases": ["_phase:build"],
"watchOptions": {
// Act as though `--watch` is always passed. If false, adds support for passing `--watch`.
"alwaysWatch": true,
// During watch recompilation run both build and test for affected projects
"watchPhases": ["_phase:build", "_phase:test"]
}
},

{
"name": "prettier",
"commandKind": "global",
Expand All @@ -185,20 +228,25 @@

// This will invoke common/autoinstallers/rush-prettier/node_modules/.bin/pretty-quick
"shellCommand": "pretty-quick --staged"
}
],

"phases": [
{
"name": "_phase:build",
"dependencies": {
"upstream": ["_phase:build"]
},
"ignoreMissingScript": true,
"allowWarningsOnSuccess": false
},
{
"commandKind": "bulk",
"name": "test",
"summary": "Bulk test script",
"description": "This is an command that runs test script separately for each project",
"safeForSimultaneousRushProcesses": false,
"enableParallelism": true,
"ignoreDependencyOrder": false,
"ignoreMissingScript": false,
"allowWarningsInSuccessfulBuild": false,
"incremental": false,
"watchForChanges": false,
"disableBuildCache": false
"name": "_phase:test",
"dependencies": {
"self": ["_phase:build"]
},
"ignoreMissingScript": true,
"allowWarningsOnSuccess": false
}
],

Expand Down Expand Up @@ -420,5 +468,26 @@
// }
// ]
// }
{
"longName": "--no-color",
"parameterKind": "flag",
"description": "disable colors in the build log, defaults to 'true'",
"associatedPhases": ["_phase:build", "_phase:test"],
"associatedCommands": ["build", "rebuild", "test", "retest"]
},
{
"longName": "--update-snapshots",
"parameterKind": "flag",
"description": "Update Jest snapshots",
"associatedPhases": ["_phase:test"],
"associatedCommands": ["test", "retest"]
},
{
"longName": "--production",
"parameterKind": "flag",
"description": "Perform a production build, including minification and localization steps",
"associatedPhases": ["_phase:build", "_phase:test"],
"associatedCommands": ["build", "rebuild", "test", "retest"]
}
]
}
2 changes: 1 addition & 1 deletion common/config/rush/experiments.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
* If true, the phased commands feature is enabled. To use this feature, create a "phased" command
* in common/config/rush/command-line.json.
*/
// "phasedCommands": true,
"phasedCommands": true

/**
* If true, perform a clean install after when running `rush install` or `rush update` if the
Expand Down

0 comments on commit e705f50

Please sign in to comment.