File tree 3 files changed +24
-19
lines changed
3 files changed +24
-19
lines changed Original file line number Diff line number Diff line change @@ -50,18 +50,21 @@ export class DisableCommand extends Command<Context> {
50
50
? SupportedPackageManagerSetWithoutNpm
51
51
: this . names ;
52
52
53
+ const allBinNames : Array < string > = [ ] ;
54
+
53
55
for ( const name of new Set ( names ) ) {
54
56
if ( ! isSupportedPackageManager ( name ) )
55
57
throw new UsageError ( `Invalid package manager name '${ name } '` ) ;
56
58
57
- for ( const binName of this . context . engine . getBinariesFor ( name ) ) {
58
- if ( process . platform === `win32` ) {
59
- await this . removeWin32Link ( installDirectory , binName ) ;
60
- } else {
61
- await this . removePosixLink ( installDirectory , binName ) ;
62
- }
63
- }
59
+ const binNames = this . context . engine . getBinariesFor ( name ) ;
60
+ allBinNames . push ( ...binNames ) ;
64
61
}
62
+
63
+ const removeLink = process . platform === `win32` ?
64
+ ( binName : string ) => this . removeWin32Link ( installDirectory , binName ) :
65
+ ( binName : string ) => this . removePosixLink ( installDirectory , binName ) ;
66
+
67
+ await Promise . all ( allBinNames . map ( removeLink ) ) ;
65
68
}
66
69
67
70
async removePosixLink ( installDirectory : string , binName : string ) {
Original file line number Diff line number Diff line change @@ -60,18 +60,21 @@ export class EnableCommand extends Command<Context> {
60
60
? SupportedPackageManagerSetWithoutNpm
61
61
: this . names ;
62
62
63
+ const allBinNames : Array < string > = [ ] ;
64
+
63
65
for ( const name of new Set ( names ) ) {
64
66
if ( ! isSupportedPackageManager ( name ) )
65
67
throw new UsageError ( `Invalid package manager name '${ name } '` ) ;
66
68
67
- for ( const binName of this . context . engine . getBinariesFor ( name ) ) {
68
- if ( process . platform === `win32` ) {
69
- await this . generateWin32Link ( installDirectory , distFolder , binName ) ;
70
- } else {
71
- await this . generatePosixLink ( installDirectory , distFolder , binName ) ;
72
- }
73
- }
69
+ const binNames = this . context . engine . getBinariesFor ( name ) ;
70
+ allBinNames . push ( ...binNames ) ;
74
71
}
72
+
73
+ const generateLink = process . platform === `win32` ?
74
+ ( binName : string ) => this . generateWin32Link ( installDirectory , distFolder , binName ) :
75
+ ( binName : string ) => this . generatePosixLink ( installDirectory , distFolder , binName ) ;
76
+
77
+ await Promise . all ( allBinNames . map ( generateLink ) ) ;
75
78
}
76
79
77
80
async generatePosixLink ( installDirectory : string , distFolder : string , binName : string ) {
Original file line number Diff line number Diff line change @@ -43,13 +43,13 @@ export class InstallGlobalCommand extends BaseCommand {
43
43
if ( this . args . length === 0 )
44
44
throw new UsageError ( `No package managers specified` ) ;
45
45
46
- for ( const arg of this . args ) {
46
+ await Promise . all ( this . args . map ( arg => {
47
47
if ( arg . endsWith ( `.tgz` ) ) {
48
- await this . installFromTarball ( path . resolve ( this . context . cwd , arg ) ) ;
48
+ return this . installFromTarball ( path . resolve ( this . context . cwd , arg ) ) ;
49
49
} else {
50
- await this . installFromDescriptor ( specUtils . parseSpec ( arg , `CLI arguments` , { enforceExactVersion : false } ) ) ;
50
+ return this . installFromDescriptor ( specUtils . parseSpec ( arg , `CLI arguments` , { enforceExactVersion : false } ) ) ;
51
51
}
52
- }
52
+ } ) ) ;
53
53
}
54
54
55
55
log ( locator : Locator ) {
@@ -86,7 +86,6 @@ export class InstallGlobalCommand extends BaseCommand {
86
86
if ( segments . length > 0 && segments [ segments . length - 1 ] !== `.corepack` )
87
87
return ;
88
88
89
-
90
89
if ( segments . length < 3 ) {
91
90
hasShortEntries = true ;
92
91
} else {
You can’t perform that action at this time.
0 commit comments