@@ -27,13 +27,25 @@ export class UpdateStackCommand extends Command {
27
27
default : false , // default value if flag not passed (can be a function that returns a string or undefined)
28
28
required : false , // make flag required (this is not common and you should probably use an argument instead)
29
29
} ) ,
30
+ currentdirectory : flags . string ( {
31
+ char : 'p' , // shorter flag version
32
+ description : 'current working directory that will be used for execution' , // help description for flag
33
+ hidden : false , // hide from help
34
+ default : '' , // default value if flag not passed (can be a function that returns a string or undefined)
35
+ required : false , // make flag required (this is not common and you should probably use an argument instead)
36
+ } ) ,
30
37
} ;
31
38
32
39
async run ( ) {
33
40
const logo = await Helpers . generateLogo ( 'json-serverless' ) ;
34
41
this . log ( `${ chalk . blueBright ( logo ) } ` ) ;
35
42
this . log ( ) ;
36
43
const { args, flags } = this . parse ( UpdateStackCommand ) ;
44
+
45
+ if ( flags . currentdirectory ) {
46
+ Helpers . changeDirectory ( flags . currentdirectory ) ;
47
+ }
48
+
37
49
cli . action . start (
38
50
`${ chalk . blueBright ( 'Check AWS Identity' ) } ` ,
39
51
`${ chalk . blueBright ( 'initializing' ) } ` ,
@@ -47,7 +59,10 @@ export class UpdateStackCommand extends Command {
47
59
}
48
60
cli . action . stop ( ) ;
49
61
this . log ( ) ;
50
- const templateFolder = path . normalize ( this . config . root + '/template' ) ;
62
+
63
+ const templateFolder = path . normalize (
64
+ this . config . root + '/node_modules/json-serverless-template/'
65
+ ) ;
51
66
const stackFolder = process . cwd ( ) ;
52
67
const tasks = new Listr ( [
53
68
{
@@ -77,8 +92,8 @@ export class UpdateStackCommand extends Command {
77
92
stackFolder + '/tsconfig.json'
78
93
) ;
79
94
await fs . copy (
80
- templateFolder + '/webpack.config.prod. js' ,
81
- stackFolder + '/webpack.config.prod. js'
95
+ templateFolder + '/webpack.config.js' ,
96
+ stackFolder + '/webpack.config.js'
82
97
) ;
83
98
} ,
84
99
} ,
@@ -111,6 +126,18 @@ export class UpdateStackCommand extends Command {
111
126
) ;
112
127
} ,
113
128
} ,
129
+ {
130
+ title : 'Build Code' ,
131
+ task : async ( ) => {
132
+ await Helpers . executeChildProcess (
133
+ 'npm run build' ,
134
+ {
135
+ cwd : stackFolder ,
136
+ } ,
137
+ false
138
+ ) ;
139
+ } ,
140
+ } ,
114
141
{
115
142
title : 'Deploy Stack on AWS' ,
116
143
task : async ( ) => {
0 commit comments