X Tutup
Skip to content

Commit e6ccacf

Browse files
committed
build fix
1 parent ea61873 commit e6ccacf

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

apps/rush-lib/src/cli/actions/AddAction.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { PackageJsonUpdater, SemVerStyle } from '../../logic/PackageJsonUpdater'
1616
import { PackageName } from '@microsoft/node-core-library';
1717

1818
export class AddAction extends BaseRushAction {
19+
private _allFlag: CommandLineFlagParameter;
1920
private _exactFlag: CommandLineFlagParameter;
2021
private _caretFlag: CommandLineFlagParameter;
2122
private _devDependencyFlag: CommandLineFlagParameter;
@@ -85,7 +86,7 @@ export class AddAction extends BaseRushAction {
8586
});
8687
}
8788

88-
public run(): Promise<void> {
89+
public async run(): Promise<void> {
8990
const currentProject: RushConfigurationProject | undefined = this.rushConfiguration.tryGetProjectForPath(
9091
process.cwd()
9192
);
@@ -122,13 +123,15 @@ export class AddAction extends BaseRushAction {
122123

123124
let projects: RushConfigurationProject[];
124125
if (this._allFlag) {
125-
projects = Object.values(this._rushConfiguration.projectsByName);
126+
projects = this.rushConfiguration.projects;
126127
} else {
127128
projects = [currentProject];
128129
}
129130

131+
const updater: PackageJsonUpdater = new PackageJsonUpdater(this.rushConfiguration, this.rushGlobalFolder);
132+
130133
for (const project of projects) {
131-
return new PackageJsonUpdater(this.rushConfiguration, this.rushGlobalFolder).doRushAdd({
134+
await updater.doRushAdd({
132135
currentProject: project,
133136
packageName: packageName,
134137
initialVersion: version,
@@ -140,5 +143,7 @@ export class AddAction extends BaseRushAction {
140143
: (this._exactFlag.value ? SemVerStyle.Exact : SemVerStyle.Tilde)
141144
});
142145
}
146+
147+
return;
143148
}
144149
}

apps/rush-lib/src/cli/test/__snapshots__/CommandLineHelp.test.ts.snap

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ For detailed help about a specific command, use: rush <command> -h
5454
`;
5555
5656
exports[`CommandLineHelp prints the help for each action: add 1`] = `
57-
"usage: rush add [-h] -p PACKAGE [--exact] [--caret] [--dev] [-m] [-s]
57+
"usage: rush add [-h] -p PACKAGE [--exact] [--caret] [--dev] [-m] [-s] [--all]
5858
5959
Adds a specified package as a dependency of the current project (as
6060
determined by the current working directory) and then runs \\"rush update\\". If
@@ -90,6 +90,8 @@ Optional arguments:
9090
same version of the dependency.
9191
-s, --skip-update If specified, the \\"rush update\\" command will not be
9292
run after updating the package.json files.
93+
--all If specified, the dependency will be added to all of
94+
your projects.
9395
"
9496
`;
9597

0 commit comments

Comments
 (0)
X Tutup