Skip to content

Commit be25968

Browse files
author
uid10804
committed
fix(cli): fix wrong reference to serverless binary in update function
1 parent 31dbaa3 commit be25968

File tree

1 file changed

+36
-13
lines changed

1 file changed

+36
-13
lines changed

packages/cli/src/commands/update-stack.ts

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Listr = require('listr');
44
import * as path from 'path';
55
import { Helpers } from '../actions/helpers';
66
import { AWSActions } from '../actions/aws-actions';
7-
import chalk from 'chalk'
7+
import chalk from 'chalk';
88
import cli from 'cli-ux';
99

1010
export class UpdateStackCommand extends Command {
@@ -37,15 +37,18 @@ export class UpdateStackCommand extends Command {
3737
};
3838

3939
async run() {
40-
await Helpers.generateLogo("json-serverless");
40+
await Helpers.generateLogo('json-serverless');
4141
this.log();
4242
const { args, flags } = this.parse(UpdateStackCommand);
43-
cli.action.start(`${chalk.blueBright('Check AWS Identity')}`, `${chalk.blueBright('initializing')}`, { stdout: true });
43+
cli.action.start(
44+
`${chalk.blueBright('Check AWS Identity')}`,
45+
`${chalk.blueBright('initializing')}`,
46+
{ stdout: true }
47+
);
4448
try {
4549
const identity = await AWSActions.checkValidAWSIdentity();
4650
this.log(`${chalk.green('AWS Account: ' + identity.Account)}`);
4751
} catch (error) {
48-
4952
this.error(`${chalk.red(error.message)}`);
5053
}
5154
cli.action.stop();
@@ -62,18 +65,35 @@ export class UpdateStackCommand extends Command {
6265
{
6366
title: 'Copy Template Files',
6467
task: async task => {
65-
await fs.copy(templateFolder+'/src', stackFolder+'/src');
66-
await fs.copy(templateFolder+'/package.json', stackFolder+'/package.json');
67-
await fs.copy(templateFolder+'/package-lock.json', stackFolder+'/package-lock.json');
68-
await fs.copy(templateFolder+'/serverless.yml', stackFolder+'/serverless.yml');
69-
await fs.copy(templateFolder+'/tsconfig.json', stackFolder+'/tsconfig.json');
70-
await fs.copy(templateFolder+'/webpack.config.prod.js', stackFolder+'/webpack.config.prod.js');
68+
await fs.copy(templateFolder + '/src', stackFolder + '/src');
69+
await fs.copy(
70+
templateFolder + '/package.json',
71+
stackFolder + '/package.json'
72+
);
73+
await fs.copy(
74+
templateFolder + '/package-lock.json',
75+
stackFolder + '/package-lock.json'
76+
);
77+
await fs.copy(
78+
templateFolder + '/serverless.yml',
79+
stackFolder + '/serverless.yml'
80+
);
81+
await fs.copy(
82+
templateFolder + '/tsconfig.json',
83+
stackFolder + '/tsconfig.json'
84+
);
85+
await fs.copy(
86+
templateFolder + '/webpack.config.prod.js',
87+
stackFolder + '/webpack.config.prod.js'
88+
);
7189
},
7290
},
7391
{
7492
title: 'Update Appconfig',
7593
task: (ctx, task) => {
76-
const appConfig = JSON.parse(fs.readFileSync(stackFolder + '/config/appconfig.json', 'UTF-8'));
94+
const appConfig = JSON.parse(
95+
fs.readFileSync(stackFolder + '/config/appconfig.json', 'UTF-8')
96+
);
7797
appConfig.enableApiKeyAuth = flags.apikeyauth;
7898
appConfig.readOnly = flags.readonly;
7999
appConfig.enableSwagger = flags.swagger;
@@ -100,7 +120,7 @@ export class UpdateStackCommand extends Command {
100120
title: 'Deploy Stack on AWS',
101121
task: async () => {
102122
await Helpers.executeChildProcess(
103-
'sls deploy',
123+
'node_modules/serverless/bin/serverless deploy',
104124
{
105125
cwd: stackFolder,
106126
},
@@ -111,7 +131,10 @@ export class UpdateStackCommand extends Command {
111131
]);
112132
try {
113133
await tasks.run();
114-
await Helpers.executeChildProcess('sls info', { cwd: stackFolder });
134+
await Helpers.executeChildProcess(
135+
'node_modules/serverless/bin/serverless info',
136+
{ cwd: stackFolder }
137+
);
115138
} catch (error) {
116139
this.error(`${chalk.red(error.message)}`);
117140
}

0 commit comments

Comments
 (0)