From 059916b9a76ae853de52d587e72d22ed6cb21c95 Mon Sep 17 00:00:00 2001 From: Cheng Liu Date: Wed, 21 Feb 2024 16:23:19 -0800 Subject: [PATCH] feat: turn on phased commands --- common/config/rush/command-line.json | 93 ++++++++++++++++++++++++---- common/config/rush/experiments.json | 2 +- 2 files changed, 82 insertions(+), 13 deletions(-) diff --git a/common/config/rush/command-line.json b/common/config/rush/command-line.json index 3753628..db76338 100644 --- a/common/config/rush/command-line.json +++ b/common/config/rush/command-line.json @@ -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", @@ -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 } ], @@ -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"] + } ] } diff --git a/common/config/rush/experiments.json b/common/config/rush/experiments.json index 811c954..518a171 100644 --- a/common/config/rush/experiments.json +++ b/common/config/rush/experiments.json @@ -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