@@ -8,7 +8,7 @@ import cli from 'cli-ux';
88import { Helpers } from '../actions/helpers' ;
99import { AWSActions } from '../actions/aws-actions' ;
1010import { ServerlessConfig } from '../classes/serverlessconfig' ;
11- import chalk from 'chalk'
11+ import chalk from 'chalk' ;
1212export class CreateStackCommand extends Command {
1313 static description = 'describe the command here' ;
1414
@@ -58,26 +58,33 @@ export class CreateStackCommand extends Command {
5858 await Helpers . generateLogo ( 'json-serverless' ) ;
5959 this . log ( ) ;
6060 const { args, flags } = this . parse ( CreateStackCommand ) ;
61- cli . action . start ( `${ chalk . blueBright ( 'Check AWS Identity' ) } ` , `${ chalk . blueBright ( 'initializing' ) } ` , { stdout : true } ) ;
61+ cli . action . start (
62+ `${ chalk . blueBright ( 'Check AWS Identity' ) } ` ,
63+ `${ chalk . blueBright ( 'initializing' ) } ` ,
64+ { stdout : true }
65+ ) ;
6266 try {
6367 const identity = await AWSActions . checkValidAWSIdentity ( ) ;
6468 this . log ( `${ chalk . green ( 'AWS Account: ' + identity . Account ) } ` ) ;
6569 } catch ( error ) {
66-
6770 this . error ( `${ chalk . red ( error . message ) } ` ) ;
6871 }
6972 cli . action . stop ( ) ;
7073 this . log ( ) ;
71-
7274
73- const stackName = await cli . prompt ( `${ chalk . magenta ( 'What is the name of the api ?' ) } ` ) ;
75+ const stackName = await cli . prompt (
76+ `${ chalk . magenta ( 'What is the name of the api ?' ) } `
77+ ) ;
7478 this . log ( ) ;
7579 const region = await this . getRegion ( ) ;
7680 let filePath = path . normalize ( args . file ) ;
7781 const templateFolder = path . normalize ( this . config . root + '/template' ) ;
7882 const stackFolder = path . normalize ( process . cwd ( ) + '/' + stackName ) ;
7983 this . log ( ) ;
80- this . log ( 'New stack template folder will be created under path: ' + `${ chalk . blueBright . bold . underline ( stackFolder ) } ` ) ;
84+ this . log (
85+ 'New stack template folder will be created under path: ' +
86+ `${ chalk . blueBright . bold . underline ( stackFolder ) } `
87+ ) ;
8188 this . log ( ) ;
8289 await cli . confirm ( `${ chalk . magenta ( 'Continue ? y/n' ) } ` ) ;
8390 this . log ( ) ;
@@ -109,7 +116,7 @@ export class CreateStackCommand extends Command {
109116 appconfig . readOnly = flags . readonly ;
110117 appconfig . enableSwagger = flags . swagger ;
111118 appconfig . stackName = stackName ;
112- Helpers . createDir ( stackFolder + " /config" ) ;
119+ Helpers . createDir ( stackFolder + ' /config' ) ;
113120 fs . writeFileSync (
114121 path . normalize ( stackFolder + '/config/appconfig.json' ) ,
115122 JSON . stringify ( appconfig , null , 2 ) ,
@@ -123,7 +130,7 @@ export class CreateStackCommand extends Command {
123130 const serverlessConfig = new ServerlessConfig ( ) ;
124131 serverlessConfig . awsRegion = region ;
125132 serverlessConfig . stage = args . stage ;
126- Helpers . createDir ( stackFolder + " /config" ) ;
133+ Helpers . createDir ( stackFolder + ' /config' ) ;
127134 fs . writeFileSync (
128135 path . normalize ( stackFolder + '/config/serverlessconfig.json' ) ,
129136 JSON . stringify ( serverlessConfig , null , 2 ) ,
@@ -133,7 +140,7 @@ export class CreateStackCommand extends Command {
133140 } ,
134141 {
135142 title : 'Install Dependencies' ,
136- task : async ( task ) => {
143+ task : async task => {
137144 task . output = 'INSTALL DEPENDENCIES' ;
138145 await Helpers . executeChildProcess (
139146 'npm i' ,
@@ -148,7 +155,7 @@ export class CreateStackCommand extends Command {
148155 title : 'Deploy Stack on AWS' ,
149156 task : async ( ) => {
150157 await Helpers . executeChildProcess (
151- 'sls deploy' ,
158+ 'node_modules/serverless/bin/serverless deploy' ,
152159 {
153160 cwd : stackFolder ,
154161 } ,
@@ -159,7 +166,10 @@ export class CreateStackCommand extends Command {
159166 ] ) ;
160167 try {
161168 await tasks . run ( ) ;
162- await Helpers . executeChildProcess ( 'sls info' , { cwd : stackFolder } ) ;
169+ await Helpers . executeChildProcess (
170+ 'node_modules/serverless/bin/serverless info' ,
171+ { cwd : stackFolder }
172+ ) ;
163173 } catch ( error ) {
164174 this . error ( `${ chalk . red ( error . message ) } ` ) ;
165175 }
@@ -176,7 +186,7 @@ export class CreateStackCommand extends Command {
176186 name : 'region' ,
177187 message : 'select a region' ,
178188 type : 'list' ,
179- choices : regions
189+ choices : regions ,
180190 } ,
181191 ] ) ;
182192 region = responses . region ;
0 commit comments