@@ -27,13 +27,25 @@ export class UpdateStackCommand extends Command {
2727 default : false , // default value if flag not passed (can be a function that returns a string or undefined)
2828 required : false , // make flag required (this is not common and you should probably use an argument instead)
2929 } ) ,
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+ } ) ,
3037 } ;
3138
3239 async run ( ) {
3340 const logo = await Helpers . generateLogo ( 'json-serverless' ) ;
3441 this . log ( `${ chalk . blueBright ( logo ) } ` ) ;
3542 this . log ( ) ;
3643 const { args, flags } = this . parse ( UpdateStackCommand ) ;
44+
45+ if ( flags . currentdirectory ) {
46+ Helpers . changeDirectory ( flags . currentdirectory ) ;
47+ }
48+
3749 cli . action . start (
3850 `${ chalk . blueBright ( 'Check AWS Identity' ) } ` ,
3951 `${ chalk . blueBright ( 'initializing' ) } ` ,
@@ -47,7 +59,10 @@ export class UpdateStackCommand extends Command {
4759 }
4860 cli . action . stop ( ) ;
4961 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+ ) ;
5166 const stackFolder = process . cwd ( ) ;
5267 const tasks = new Listr ( [
5368 {
@@ -77,8 +92,8 @@ export class UpdateStackCommand extends Command {
7792 stackFolder + '/tsconfig.json'
7893 ) ;
7994 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'
8297 ) ;
8398 } ,
8499 } ,
@@ -111,6 +126,18 @@ export class UpdateStackCommand extends Command {
111126 ) ;
112127 } ,
113128 } ,
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+ } ,
114141 {
115142 title : 'Deploy Stack on AWS' ,
116143 task : async ( ) => {
0 commit comments