Skip to content
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

[rush] Shell tab completion #2060

Merged
merged 109 commits into from
Aug 18, 2020
Merged
Show file tree
Hide file tree
Changes from 104 commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
cf07cc2
Initial commit
sachinjoseph Jul 27, 2020
68a18cb
WIP
sachinjoseph Jul 28, 2020
adb2a59
WIP
sachinjoseph Jul 28, 2020
64df804
WIP
sachinjoseph Jul 28, 2020
59c60b5
WIP
sachinjoseph Jul 28, 2020
d45da59
WIP
sachinjoseph Jul 28, 2020
5e8d0f2
WIP
sachinjoseph Jul 28, 2020
d6ad7cb
Add autocomplete for common parameter values
sachinjoseph Jul 29, 2020
1d0fe7d
Move action table population to run() method so that custom commands …
sachinjoseph Jul 29, 2020
97d7303
Add support for -d/--debug switch
sachinjoseph Jul 29, 2020
35115e5
Refactor
sachinjoseph Jul 29, 2020
7fdce2f
Autocomplete for partially completed package names
sachinjoseph Jul 29, 2020
abb42e5
Refactor to remove some duplicate code
sachinjoseph Jul 29, 2020
f885dbf
Comment out logs
sachinjoseph Jul 29, 2020
9b7542f
Refactor
sachinjoseph Jul 29, 2020
86666c3
Fix minor bug
sachinjoseph Jul 29, 2020
6c7e213
Add tests
sachinjoseph Jul 29, 2020
a2cd8fa
Rush change
sachinjoseph Jul 29, 2020
4bacae4
Add more tests
sachinjoseph Jul 29, 2020
1b6bb14
Use constants
sachinjoseph Jul 29, 2020
8f4e677
Set default values for args
sachinjoseph Jul 30, 2020
fe00b9f
Refactor some code. Address comments.
sachinjoseph Jul 30, 2020
518c8bf
Change run() to runAsync()
sachinjoseph Jul 31, 2020
12ce2f1
Address David's comments
sachinjoseph Jul 31, 2020
98f9104
Address David's comments. Add a new unit test
sachinjoseph Jul 31, 2020
fffb507
Some refactoring
sachinjoseph Jul 31, 2020
cde89aa
Use importLazy to improve spin up times
sachinjoseph Aug 1, 2020
1296b78
Change _jsonSchema to a static getter
sachinjoseph Aug 1, 2020
a91fc88
Profiling in progress
sachinjoseph Aug 1, 2020
9cf5d08
Further optimization
sachinjoseph Aug 1, 2020
e6a76ad
Remove node-core-library lazyImport
sachinjoseph Aug 1, 2020
2efcac0
Remove trace logs
sachinjoseph Aug 1, 2020
b663e6a
Remove trace logs
sachinjoseph Aug 1, 2020
ea20cfa
Suppress some linter warnings
sachinjoseph Aug 1, 2020
b17f84f
Remove comments
sachinjoseph Aug 1, 2020
e3d6b4b
Rename import
sachinjoseph Aug 1, 2020
6db9624
Address comments
sachinjoseph Aug 1, 2020
38bf225
Fix some bugs. Use a lib for parsing command line sentences.
sachinjoseph Aug 1, 2020
180c363
Change the dependency specifier to ~
sachinjoseph Aug 1, 2020
819189f
Rush change
sachinjoseph Aug 1, 2020
7d05093
Remove trace logs
sachinjoseph Aug 1, 2020
f6415c9
Remove commented-out code.
sachinjoseph Aug 2, 2020
5422f4d
Get choice values from CommandLineChoiceParameter object.
sachinjoseph Aug 2, 2020
b15d4e9
Remove test logs
sachinjoseph Aug 2, 2020
c09564f
Initial commit: Move tab-completion to ts-command-line
sachinjoseph Aug 2, 2020
13c04fb
Move code entirely to ts-commandline. Implement a way to provide cust…
sachinjoseph Aug 2, 2020
114ef50
Commit tests
sachinjoseph Aug 2, 2020
d0a38c0
Rush change
sachinjoseph Aug 2, 2020
e81bc62
Move 'tab-complete' to a constant
sachinjoseph Aug 2, 2020
0b9bc44
Cache the test object
sachinjoseph Aug 3, 2020
9644cd2
Remove commented out code
sachinjoseph Aug 3, 2020
897312f
Use getOwnPackageVersion to reduce spin up times
sachinjoseph Aug 3, 2020
ba42595
Some refactoring
sachinjoseph Aug 3, 2020
719089e
Merge branch 'master' of https://github.com/microsoft/rushstack into …
sachinjoseph Aug 3, 2020
86eaa97
Rename constant. Update comment.
sachinjoseph Aug 3, 2020
3ade0cd
Update libraries/ts-command-line/src/providers/TabCompletionAction.ts
sachinjoseph Aug 3, 2020
7bab8f4
Update libraries/ts-command-line/src/providers/TabCompletionAction.ts
sachinjoseph Aug 3, 2020
d478180
Update apps/rush-lib/src/cli/actions/ListAction.ts
sachinjoseph Aug 3, 2020
7563fce
Address comments
sachinjoseph Aug 3, 2020
a2075e6
Address comments
sachinjoseph Aug 3, 2020
2b5c73b
Eslint disable - specify the rule.
sachinjoseph Aug 3, 2020
f4853c6
Document getOwnPackageJsonVersion
sachinjoseph Aug 3, 2020
ce9420d
Fix comment
sachinjoseph Aug 3, 2020
5d0a5ac
Merge branch 'master' of https://github.com/microsoft/rushstack into …
sachinjoseph Aug 4, 2020
8263b72
Address comments
sachinjoseph Aug 4, 2020
677caa2
Merge branch 'sachinjoseph/rush-shell-tab-complete' of https://github…
sachinjoseph Aug 4, 2020
468bb4b
Rush change
sachinjoseph Aug 4, 2020
147648a
Fix some bugs
sachinjoseph Aug 8, 2020
867cd2d
Update libraries/ts-command-line/src/parameters/CommandLineDefinition.ts
sachinjoseph Aug 8, 2020
72e0b35
Address comments
sachinjoseph Aug 8, 2020
f7a66fb
Merge branch 'sachinjoseph/rush-shell-tab-complete' of https://github…
sachinjoseph Aug 8, 2020
fac7836
Preserve some typing
sachinjoseph Aug 8, 2020
c87dcff
Make completions() only available to choice parameters and parameters…
sachinjoseph Aug 8, 2020
c1ae9b8
Remove completions() hook from CommandLinStringParameter
sachinjoseph Aug 8, 2020
eb0ba41
Remove commented out test code
sachinjoseph Aug 8, 2020
2a9a1b9
Use a flag to prevent adding the tab-complete action multiple times
sachinjoseph Aug 8, 2020
da061db
Get argv as a param
sachinjoseph Aug 8, 2020
e4a04ae
LazyLoad DeployArchiver
sachinjoseph Aug 8, 2020
48b58f9
Update snapshots
sachinjoseph Aug 8, 2020
68b3a84
Prototype of a basic Import API for lazy imports
octogonz Aug 8, 2020
8068c82
Convert more files to use the Import API
octogonz Aug 9, 2020
90c0997
Revert all changes to DeployManager.ts
octogonz Aug 9, 2020
71175bd
Convert DeployManager to be lazy-loaded
octogonz Aug 9, 2020
c34c07e
Revert all changes to RushInstallManager.ts
octogonz Aug 9, 2020
a1cc5d8
Convert RushInstallManager to be lazy-loaded
octogonz Aug 9, 2020
22647a6
Shave off a few hundred milliseconds from the startup time
sachinjoseph Aug 9, 2020
b171210
Update rush-lib api md
sachinjoseph Aug 9, 2020
1d1c828
Merge branch 'sachinjoseph/rush-shell-tab-complete' of https://github…
sachinjoseph Aug 9, 2020
283044d
Merge branch 'master' of https://github.com/microsoft/web-build-tools…
sachinjoseph Aug 9, 2020
dc1ee6d
Merge branch 'sachinjoseph/rush-shell-tab-complete' of https://github…
sachinjoseph Aug 9, 2020
97f926f
Reuse package.json object
sachinjoseph Aug 9, 2020
a5fd7c6
Use get() to determine if a map entry exists
sachinjoseph Aug 9, 2020
acb8b79
Use has() to determine if a map entry exists
sachinjoseph Aug 9, 2020
0f14d3d
Address comments
sachinjoseph Aug 11, 2020
e0ca132
Merge branch 'sachinjoseph/rush-shell-tab-complete' of https://github…
sachinjoseph Aug 11, 2020
7626396
Recommend the __dirname macro for dirname parameter.
sachinjoseph Aug 11, 2020
9fdcefb
Cache the static getter so that runtime perf won't be affected.
sachinjoseph Aug 11, 2020
f3ebdc1
Address comments
sachinjoseph Aug 11, 2020
6661ba8
Use Import.lazy everywhere
sachinjoseph Aug 13, 2020
f33d99f
Merge branch 'master' of https://github.com/microsoft/web-build-tools…
sachinjoseph Aug 13, 2020
7cb6b76
Merge branch 'master' of https://github.com/microsoft/rushstack into …
sachinjoseph Aug 15, 2020
82c377e
Use Import.Lazy in more places
sachinjoseph Aug 15, 2020
c343e4a
Provide a link to the PR in the changelog
sachinjoseph Aug 15, 2020
4b82b36
Merge branch 'master' of https://github.com/microsoft/rushstack into …
sachinjoseph Aug 18, 2020
aa27102
Document `Import` API
octogonz Aug 18, 2020
2ad333f
Remove getOwnPackageJsonVersion() API
sachinjoseph Aug 18, 2020
c7a47f1
Revert changes to schema loading
sachinjoseph Aug 18, 2020
bec2301
Merge remote-tracking branch 'remotes/origin/master' into sachinjosep…
octogonz Aug 18, 2020
ddbf8b6
rush update
octogonz Aug 18, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions apps/rush-lib/src/api/ApprovedPackagesConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,16 @@ export class ApprovedPackagesItem {
* @public
*/
export class ApprovedPackagesConfiguration {
private static _jsonSchema: JsonSchema = JsonSchema.fromFile(
path.join(__dirname, '../schemas/approved-packages.schema.json')
);
private static _jsonSchemaCached: JsonSchema | undefined = undefined;
sachinjoseph marked this conversation as resolved.
Show resolved Hide resolved
private static get _jsonSchema(): JsonSchema {
if (!this._jsonSchemaCached) {
this._jsonSchemaCached = JsonSchema.fromFile(
path.join(__dirname, '../schemas/approved-packages.schema.json')
);
}

return this._jsonSchemaCached;
}

public items: ApprovedPackagesItem[] = [];

Expand Down
13 changes: 10 additions & 3 deletions apps/rush-lib/src/api/CommandLineConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,16 @@ import { CommandJson, ICommandLineJson, ParameterJson } from './CommandLineJson'
* Custom Commands and Options for the Rush Command Line
*/
export class CommandLineConfiguration {
private static _jsonSchema: JsonSchema = JsonSchema.fromFile(
path.join(__dirname, '../schemas/command-line.schema.json')
);
private static _jsonSchemaCached: JsonSchema | undefined = undefined;
private static get _jsonSchema(): JsonSchema {
if (!this._jsonSchemaCached) {
this._jsonSchemaCached = JsonSchema.fromFile(
path.join(__dirname, '../schemas/command-line.schema.json')
);
}

return this._jsonSchemaCached;
}

public readonly commands: CommandJson[] = [];
public readonly parameters: ParameterJson[] = [];
Expand Down
13 changes: 10 additions & 3 deletions apps/rush-lib/src/api/CommonVersionsConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,16 @@ interface ICommonVersionsJson {
* @public
*/
export class CommonVersionsConfiguration {
private static _jsonSchema: JsonSchema = JsonSchema.fromFile(
path.join(__dirname, '../schemas/common-versions.schema.json')
);
private static _jsonSchemaCached: JsonSchema | undefined = undefined;
private static get _jsonSchema(): JsonSchema {
if (!this._jsonSchemaCached) {
this._jsonSchemaCached = JsonSchema.fromFile(
path.join(__dirname, '../schemas/common-versions.schema.json')
);
}

return this._jsonSchemaCached;
}

private _filePath: string;
private _preferredVersions: ProtectableMap<string, string>;
Expand Down
13 changes: 10 additions & 3 deletions apps/rush-lib/src/api/ExperimentsConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,16 @@ export interface IExperimentsJson {
* @beta
*/
export class ExperimentsConfiguration {
private static _jsonSchema: JsonSchema = JsonSchema.fromFile(
path.resolve(__dirname, '..', 'schemas', 'experiments.schema.json')
);
private static _jsonSchemaCached: JsonSchema | undefined = undefined;
private static get _jsonSchema(): JsonSchema {
if (!this._jsonSchemaCached) {
this._jsonSchemaCached = JsonSchema.fromFile(
path.resolve(__dirname, '..', 'schemas', 'experiments.schema.json')
);
}

return this._jsonSchemaCached;
}

private _experimentConfiguration: IExperimentsJson;
private _jsonFileName: string;
Expand Down
8 changes: 5 additions & 3 deletions apps/rush-lib/src/api/LastInstallFlag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
// See LICENSE in the project root for license information.

import * as path from 'path';
import * as _ from 'lodash';
import { FileSystem, JsonFile, JsonObject } from '@rushstack/node-core-library';

import { FileSystem, JsonFile, JsonObject, Import } from '@rushstack/node-core-library';

import { PackageManagerName } from './packageManager/PackageManager';
import { RushConfiguration } from './RushConfiguration';

const lodash: typeof import('lodash') = Import.lazy('lodash', require);

export const LAST_INSTALL_FLAG_FILE_NAME: string = 'last-install.flag';

/**
Expand Down Expand Up @@ -58,7 +60,7 @@ export class LastInstallFlag {

const newState: JsonObject = this._state;

if (!_.isEqual(oldState, newState)) {
if (!lodash.isEqual(oldState, newState)) {
if (checkValidAndReportStoreIssues) {
const pkgManager: PackageManagerName = newState.packageManager;
if (pkgManager === 'pnpm') {
Expand Down
13 changes: 11 additions & 2 deletions apps/rush-lib/src/api/Rush.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { RushConstants } from '../logic/RushConstants';
import { RushXCommandLine } from '../cli/RushXCommandLine';
import { CommandLineMigrationAdvisor } from '../cli/CommandLineMigrationAdvisor';
import { NodeJsCompatibility } from '../logic/NodeJsCompatibility';
import { Utilities } from '../utilities/Utilities';

/**
* Options to pass to the rush "launch" functions.
Expand Down Expand Up @@ -37,6 +38,8 @@ export interface ILaunchOptions {
* @public
*/
export class Rush {
private static _version: string | undefined = undefined;

/**
* This API is used by the `@microsoft/rush` front end to launch the "rush" command-line.
* Third-party tools should not use this API. Instead, they should execute the "rush" binary
Expand All @@ -53,7 +56,9 @@ export class Rush {
public static launch(launcherVersion: string, arg: ILaunchOptions): void {
const options: ILaunchOptions = Rush._normalizeLaunchOptions(arg);

Rush._printStartupBanner(options.isManaged);
if (!Utilities.shouldRestrictConsoleOutput()) {
sachinjoseph marked this conversation as resolved.
Show resolved Hide resolved
Rush._printStartupBanner(options.isManaged);
}

if (!CommandLineMigrationAdvisor.checkArgv(process.argv)) {
// The migration advisor recognized an obsolete command-line
Expand Down Expand Up @@ -87,7 +92,11 @@ export class Rush {
* This is the same as the Rush tool version for that release.
*/
public static get version(): string {
return PackageJsonLookup.loadOwnPackageJson(__dirname).version;
if (!this._version) {
this._version = PackageJsonLookup.getOwnPackageJsonVersion(__dirname);
}

return this._version!;
}

/**
Expand Down
13 changes: 9 additions & 4 deletions apps/rush-lib/src/api/RushConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,9 +423,14 @@ export type ResolutionStrategy = 'fewer-dependencies' | 'fast';
* @public
*/
export class RushConfiguration {
private static _jsonSchema: JsonSchema = JsonSchema.fromFile(
path.join(__dirname, '../schemas/rush.schema.json')
);
private static _jsonSchemaCached: JsonSchema | undefined = undefined;
private static get _jsonSchema(): JsonSchema {
if (!this._jsonSchemaCached) {
this._jsonSchemaCached = JsonSchema.fromFile(path.join(__dirname, '../schemas/rush.schema.json'));
}

return this._jsonSchemaCached;
}

private _rushJsonFile: string;
private _rushJsonFolder: string;
Expand Down Expand Up @@ -716,7 +721,7 @@ export class RushConfiguration {
tempProjectName
);
this._projects.push(project);
if (this._projectsByName.get(project.packageName)) {
if (this._projectsByName.has(project.packageName)) {
throw new Error(
`The project name "${project.packageName}" was specified more than once` +
` in the rush.json configuration file.`
Expand Down
2 changes: 1 addition & 1 deletion apps/rush-lib/src/api/RushConfigurationProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export class RushConfigurationProject {
);
}

this._packageJsonEditor = PackageJsonEditor.load(packageJsonFilename);
this._packageJsonEditor = PackageJsonEditor.fromObject(this._packageJson, packageJsonFilename);
sachinjoseph marked this conversation as resolved.
Show resolved Hide resolved

this._tempProjectName = tempProjectName;

Expand Down
9 changes: 5 additions & 4 deletions apps/rush-lib/src/api/VersionPolicy.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.

import { cloneDeep } from 'lodash';
import * as semver from 'semver';
import { IPackageJson } from '@rushstack/node-core-library';
import { IPackageJson, Import } from '@rushstack/node-core-library';

import {
IVersionPolicyJson,
Expand All @@ -17,6 +16,8 @@ import { PackageJsonEditor } from './PackageJsonEditor';
import { RushConfiguration } from './RushConfiguration';
import { RushConfigurationProject } from './RushConfigurationProject';

const lodash: typeof import('lodash') = Import.lazy('lodash', require);

/**
* Type of version bumps
* @beta
Expand Down Expand Up @@ -320,7 +321,7 @@ export class LockStepVersionPolicy extends VersionPolicy {
}

private _updatePackageVersion(project: IPackageJson, newVersion: semver.SemVer): IPackageJson {
const updatedProject: IPackageJson = cloneDeep(project);
const updatedProject: IPackageJson = lodash.cloneDeep(project);
updatedProject.version = newVersion.format();
return updatedProject;
}
Expand Down Expand Up @@ -379,7 +380,7 @@ export class IndividualVersionPolicy extends VersionPolicy {
if (this.lockedMajor) {
const version: semver.SemVer = new semver.SemVer(project.version);
if (version.major < this.lockedMajor) {
const updatedProject: IPackageJson = cloneDeep(project);
const updatedProject: IPackageJson = lodash.cloneDeep(project);
updatedProject.version = `${this._lockedMajor}.0.0`;
return updatedProject;
} else if (version.major > this.lockedMajor) {
Expand Down
13 changes: 10 additions & 3 deletions apps/rush-lib/src/api/VersionPolicyConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,16 @@ export interface IVersionPolicyDependencyJson {
* @beta
*/
export class VersionPolicyConfiguration {
private static _jsonSchema: JsonSchema = JsonSchema.fromFile(
path.join(__dirname, '../schemas/version-policies.schema.json')
);
private static _jsonSchemaCached: JsonSchema | undefined = undefined;
private static get _jsonSchema(): JsonSchema {
if (!this._jsonSchemaCached) {
this._jsonSchemaCached = JsonSchema.fromFile(
path.join(__dirname, '../schemas/version-policies.schema.json')
);
}

return this._jsonSchemaCached;
}

private _versionPolicies: Map<string, VersionPolicy>;
private _jsonFileName: string;
Expand Down
5 changes: 3 additions & 2 deletions apps/rush-lib/src/cli/RushCommandLineParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,16 @@ export class RushCommandLineParser extends CommandLineParser {
' and automates package publishing. It can manage decoupled subsets of projects with different' +
' release and versioning strategies. A full API is included to facilitate integration with other' +
' automation tools. If you are looking for a proven turnkey solution for monorepo management,' +
' Rush is for you.'
' Rush is for you.',
enableTabCompletionAction: true
});

this._rushOptions = this._normalizeOptions(options || {});

try {
const rushJsonFilename: string | undefined = RushConfiguration.tryFindRushJsonLocation({
startingFolder: this._rushOptions.cwd,
showVerbose: true
showVerbose: !Utilities.shouldRestrictConsoleOutput()
});
if (rushJsonFilename) {
this.rushConfiguration = RushConfiguration.loadFromConfigurationFile(rushJsonFilename);
Expand Down
27 changes: 18 additions & 9 deletions apps/rush-lib/src/cli/actions/AddAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,21 @@

import * as os from 'os';
import * as semver from 'semver';

import { Import } from '@rushstack/node-core-library';
import { CommandLineFlagParameter, CommandLineStringParameter } from '@rushstack/ts-command-line';

import { RushConfigurationProject } from '../../api/RushConfigurationProject';
import { BaseRushAction } from './BaseRushAction';
import { RushCommandLineParser } from '../RushCommandLineParser';
import { PackageJsonUpdater, SemVerStyle } from '../../logic/PackageJsonUpdater';
import { DependencySpecifier } from '../../logic/DependencySpecifier';

// TODO: Convert this to "import type" after we upgrade to TypeScript 3.8
import * as PackageJsonUpdaterTypes from '../../logic/PackageJsonUpdater';
const packageJsonUpdaterModule: typeof PackageJsonUpdaterTypes = Import.lazy(
'../../logic/PackageJsonUpdater',
require
);

export class AddAction extends BaseRushAction {
private _allFlag: CommandLineFlagParameter;
private _exactFlag: CommandLineFlagParameter;
Expand Down Expand Up @@ -87,7 +93,7 @@ export class AddAction extends BaseRushAction {
});
}

public async run(): Promise<void> {
public async runAsync(): Promise<void> {
let projects: RushConfigurationProject[];
if (this._allFlag.value) {
projects = this.rushConfiguration.projects;
Expand Down Expand Up @@ -136,9 +142,12 @@ export class AddAction extends BaseRushAction {
}
}

const updater: PackageJsonUpdater = new PackageJsonUpdater(this.rushConfiguration, this.rushGlobalFolder);
const updater: PackageJsonUpdaterTypes.PackageJsonUpdater = new packageJsonUpdaterModule.PackageJsonUpdater(
this.rushConfiguration,
this.rushGlobalFolder
);

let rangeStyle: SemVerStyle;
let rangeStyle: PackageJsonUpdaterTypes.SemVerStyle;
if (version && version !== 'latest') {
if (this._exactFlag.value || this._caretFlag.value) {
throw new Error(
Expand All @@ -147,13 +156,13 @@ export class AddAction extends BaseRushAction {
);
}

rangeStyle = SemVerStyle.Passthrough;
rangeStyle = PackageJsonUpdaterTypes.SemVerStyle.Passthrough;
} else {
rangeStyle = this._caretFlag.value
? SemVerStyle.Caret
? PackageJsonUpdaterTypes.SemVerStyle.Caret
: this._exactFlag.value
? SemVerStyle.Exact
: SemVerStyle.Tilde;
? PackageJsonUpdaterTypes.SemVerStyle.Exact
: PackageJsonUpdaterTypes.SemVerStyle.Tilde;
}

await updater.doRushAdd({
Expand Down
11 changes: 8 additions & 3 deletions apps/rush-lib/src/cli/actions/BaseInstallAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import * as colors from 'colors';
import * as os from 'os';

import { Import } from '@rushstack/node-core-library';
import {
CommandLineFlagParameter,
CommandLineIntegerParameter,
Expand All @@ -13,7 +14,6 @@ import {
import { BaseRushAction } from './BaseRushAction';
import { Event } from '../../api/EventHooks';
import { BaseInstallManager, IInstallManagerOptions } from '../../logic/base/BaseInstallManager';
import { InstallManagerFactory } from '../../logic/InstallManagerFactory';
import { PurgeManager } from '../../logic/PurgeManager';
import { SetupChecks } from '../../logic/SetupChecks';
import { StandardScriptUpdater } from '../../logic/StandardScriptUpdater';
Expand All @@ -22,6 +22,11 @@ import { VersionMismatchFinder } from '../../logic/versionMismatch/VersionMismat
import { Variants } from '../../api/Variants';
import { RushConstants } from '../../logic/RushConstants';

const installManagerFactoryModule: typeof import('../../logic/InstallManagerFactory') = Import.lazy(
'../../logic/InstallManagerFactory',
require
);

/**
* This is the common base class for InstallAction and UpdateAction.
*/
Expand Down Expand Up @@ -77,7 +82,7 @@ export abstract class BaseInstallAction extends BaseRushAction {

protected abstract buildInstallOptions(): IInstallManagerOptions;

protected run(): Promise<void> {
protected runAsync(): Promise<void> {
VersionMismatchFinder.ensureConsistentVersions(this.rushConfiguration, {
variant: this._variant.value
});
Expand Down Expand Up @@ -119,7 +124,7 @@ export abstract class BaseInstallAction extends BaseRushAction {

const installManagerOptions: IInstallManagerOptions = this.buildInstallOptions();

const installManager: BaseInstallManager = InstallManagerFactory.getInstallManager(
const installManager: BaseInstallManager = installManagerFactoryModule.InstallManagerFactory.getInstallManager(
this.rushConfiguration,
this.rushGlobalFolder,
purgeManager,
Expand Down
8 changes: 5 additions & 3 deletions apps/rush-lib/src/cli/actions/BaseRushAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,17 @@ export abstract class BaseConfiglessRushAction extends CommandLineAction {
}
}

console.log(`Starting "rush ${this.actionName}"${os.EOL}`);
return this.run();
if (!Utilities.shouldRestrictConsoleOutput()) {
console.log(`Starting "rush ${this.actionName}"${os.EOL}`);
}
return this.runAsync();
}

/**
* All Rush actions need to implement this method. This method runs after
* environment has been set up by the base class.
*/
protected abstract run(): Promise<void>;
protected abstract runAsync(): Promise<void>;

private _ensureEnvironment(): void {
if (this.rushConfiguration) {
Expand Down
Loading