-
Notifications
You must be signed in to change notification settings - Fork 678
Add RUSH_QUIET_MODE environment variable equivalent to --quiet
#5700
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
11b07c8
a295d7f
6ae0d6a
b55606c
3910a1c
3e8bca2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| { | ||
| "changes": [ | ||
| { | ||
| "packageName": "@microsoft/rush", | ||
| "comment": "Add RUSH_QUIET_MODE environment variable that, when set to `1` or `true`, is equivalent to passing `--quiet` for `rush`, `rushx`, and `install-run-rush.ts`", | ||
| "type": "minor" | ||
| } | ||
| ], | ||
| "packageName": "@microsoft/rush" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -63,6 +63,7 @@ import { InitSubspaceAction } from './actions/InitSubspaceAction'; | |
| import { RushAlerts } from '../utilities/RushAlerts'; | ||
| import { initializeDotEnv } from '../logic/dotenv'; | ||
| import { measureAsyncFn } from '../utilities/performance'; | ||
| import { EnvironmentVariableNames } from '../api/EnvironmentConfiguration'; | ||
|
|
||
| /** | ||
| * Options for `RushCommandLineParser`. | ||
|
|
@@ -220,6 +221,12 @@ export class RushCommandLineParser extends CommandLineParser { | |
| } | ||
| } | ||
|
|
||
| const quietModeValue: string | undefined = | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Leave a comment about why this is checked outside of |
||
| process.env[EnvironmentVariableNames.RUSH_QUIET_MODE]; | ||
| if (quietModeValue === '1' || quietModeValue === 'true') { | ||
| return true; | ||
| } | ||
|
|
||
| return false; | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -295,6 +295,12 @@ export class RushXCommandLine { | |
| } | ||
| } | ||
|
|
||
| const quietModeValue: string | undefined = | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Leave a comment about why this is checked outside of |
||
| process.env[EnvironmentVariableNames.RUSH_QUIET_MODE]; | ||
| if (quietModeValue === '1' || quietModeValue === 'true') { | ||
| quiet = true; | ||
| } | ||
|
|
||
| if (!commandName) { | ||
| help = true; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -16,6 +16,7 @@ import type { ILogger } from '../utilities/npmrcUtilities'; | |||||||||
|
|
||||||||||
| const PACKAGE_NAME: string = '@microsoft/rush'; | ||||||||||
| const RUSH_PREVIEW_VERSION: string = 'RUSH_PREVIEW_VERSION'; | ||||||||||
| const RUSH_QUIET_MODE: string = 'RUSH_QUIET_MODE'; | ||||||||||
|
Comment on lines
18
to
+19
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Also can we get the type from |
||||||||||
| const INSTALL_RUN_RUSH_LOCKFILE_PATH_VARIABLE: 'INSTALL_RUN_RUSH_LOCKFILE_PATH' = | ||||||||||
| 'INSTALL_RUN_RUSH_LOCKFILE_PATH'; | ||||||||||
|
|
||||||||||
|
|
@@ -72,7 +73,9 @@ function _run(): void { | |||||||||
| } | ||||||||||
|
|
||||||||||
| let commandFound: boolean = false; | ||||||||||
| let logger: ILogger = { info: console.log, error: console.error }; | ||||||||||
|
|
||||||||||
| const quietModeEnvValue: string | undefined = process.env[RUSH_QUIET_MODE]; | ||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Leave a comment about why this is checked outside of |
||||||||||
| let quiet: boolean = quietModeEnvValue === '1' || quietModeEnvValue === 'true'; | ||||||||||
|
|
||||||||||
| for (const arg of packageBinArgs) { | ||||||||||
| if (arg === '-q' || arg === '--quiet') { | ||||||||||
|
|
@@ -82,10 +85,7 @@ function _run(): void { | |||||||||
| // To maintain the same user experience, the install-run* scripts pass along this | ||||||||||
| // flag but also use it to suppress any diagnostic information normally printed | ||||||||||
| // to stdout. | ||||||||||
| logger = { | ||||||||||
| info: () => {}, | ||||||||||
| error: console.error | ||||||||||
| }; | ||||||||||
| quiet = true; | ||||||||||
| } else if (!arg.startsWith('-') || arg === '-h' || arg === '--help') { | ||||||||||
| // We either found something that looks like a command (i.e. - doesn't start with a "-"), | ||||||||||
| // or we found the -h/--help flag, which can be run without a command | ||||||||||
|
|
@@ -105,6 +105,10 @@ function _run(): void { | |||||||||
| process.exit(1); | ||||||||||
| } | ||||||||||
|
|
||||||||||
| const logger: ILogger = quiet | ||||||||||
| ? { info: () => {}, error: console.error } | ||||||||||
| : { info: console.log, error: console.error }; | ||||||||||
|
|
||||||||||
| runWithErrorAndStatusCode(logger, () => { | ||||||||||
| const version: string = _getRushVersion(logger); | ||||||||||
| logger.info(`The ${RUSH_JSON_FILENAME} configuration requests Rush version ${version}`); | ||||||||||
|
|
||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we also accepting
true/false?