File tree 4 files changed +14
-9
lines changed
4 files changed +14
-9
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @relate/cli ' : patch
3
+ ---
4
+
5
+ Fix ES import of open package
Original file line number Diff line number Diff line change 1
1
import { Inject , Module , OnApplicationBootstrap } from '@nestjs/common' ;
2
2
import { SystemModule , SystemProvider } from '@relate/common' ;
3
- import { openApp } from 'open' ;
4
3
5
4
import OpenCommand from '../../commands/dbms/open' ;
6
5
import { isInteractive } from '../../stdin' ;
@@ -18,10 +17,11 @@ export class OpenModule implements OnApplicationBootstrap {
18
17
@Inject ( SystemProvider ) protected readonly systemProvider : SystemProvider ,
19
18
) { }
20
19
21
- logOrOpen ( path : string ) : void {
20
+ async logOrOpen ( path : string ) : Promise < void > {
22
21
if ( this . parsed . flags . log ) {
23
22
this . utils . log ( path ) ;
24
23
} else {
24
+ const { openApp} = await import ( 'open' ) ;
25
25
openApp ( path ) ;
26
26
}
27
27
}
@@ -43,6 +43,6 @@ export class OpenModule implements OnApplicationBootstrap {
43
43
throw new Error ( `DBMS ${ dbmsId } could not be opened` ) ;
44
44
}
45
45
46
- this . logOrOpen ( dbms . rootPath ) ;
46
+ await this . logOrOpen ( dbms . rootPath ) ;
47
47
}
48
48
}
Original file line number Diff line number Diff line change 1
1
import { Inject , Module , OnApplicationBootstrap } from '@nestjs/common' ;
2
2
import { SystemModule , SystemProvider } from '@relate/common' ;
3
- import { openApp } from 'open' ;
4
3
5
4
import OpenCommand from '../../commands/environment/open' ;
6
5
@@ -16,10 +15,11 @@ export class OpenModule implements OnApplicationBootstrap {
16
15
@Inject ( SystemProvider ) protected readonly systemProvider : SystemProvider ,
17
16
) { }
18
17
19
- logOrOpen ( path : string ) : void {
18
+ async logOrOpen ( path : string ) : Promise < void > {
20
19
if ( this . parsed . flags . log ) {
21
20
this . utils . log ( path ) ;
22
21
} else {
22
+ const { openApp} = await import ( 'open' ) ;
23
23
openApp ( path ) ;
24
24
}
25
25
}
@@ -29,6 +29,6 @@ export class OpenModule implements OnApplicationBootstrap {
29
29
const { environment : environmentId } = args ;
30
30
const environment = await this . systemProvider . getEnvironment ( environmentId ) ;
31
31
32
- this . logOrOpen ( environment . configPath ) ;
32
+ await this . logOrOpen ( environment . configPath ) ;
33
33
}
34
34
}
Original file line number Diff line number Diff line change 1
1
import { OnApplicationBootstrap , Module , Inject } from '@nestjs/common' ;
2
2
import { SystemModule , SystemProvider } from '@relate/common' ;
3
- import { openApp } from 'open' ;
4
3
5
4
import { selectProjectPrompt } from '../../prompts' ;
6
5
import OpenCommand from '../../commands/project/open' ;
@@ -17,10 +16,11 @@ export class OpenModule implements OnApplicationBootstrap {
17
16
@Inject ( SystemProvider ) protected readonly systemProvider : SystemProvider ,
18
17
) { }
19
18
20
- logOrOpen ( path : string ) : void {
19
+ async logOrOpen ( path : string ) : Promise < void > {
21
20
if ( this . parsed . flags . log ) {
22
21
this . utils . log ( path ) ;
23
22
} else {
23
+ const { openApp} = await import ( 'open' ) ;
24
24
openApp ( path ) ;
25
25
}
26
26
}
@@ -33,6 +33,6 @@ export class OpenModule implements OnApplicationBootstrap {
33
33
34
34
const project = await environment . projects . get ( projectId ) ;
35
35
36
- this . logOrOpen ( project . root ) ;
36
+ await this . logOrOpen ( project . root ) ;
37
37
}
38
38
}
You can’t perform that action at this time.
0 commit comments