@@ -16,6 +16,7 @@ import { PackageJsonUpdater, SemVerStyle } from '../../logic/PackageJsonUpdater'
1616import { PackageName } from '@microsoft/node-core-library' ;
1717
1818export 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}
0 commit comments