Skip to content

Commit 061a6b3

Browse files
committed
update display when deploied
1 parent 6a698b9 commit 061a6b3

File tree

1 file changed

+42
-7
lines changed

1 file changed

+42
-7
lines changed

index.js

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,20 @@ class ServerlessStepFunctions {
195195
.then(this.compile)
196196
.then(this.getIamRole)
197197
.then(this.deleteStateMachine)
198-
.then(this.createStateMachine);
198+
.then(this.createStateMachine)
199+
.then(() => {
200+
this.serverless.cli.consoleLog('');
201+
this.serverless.cli.log(`Finish to deploy ${this.options.state} step function`);
202+
let message = '';
203+
message += `${chalk.yellow.underline('Service Information')}\n`;
204+
message += `${chalk.yellow('service:')} ${this.service}\n`;
205+
message += `${chalk.yellow('stage:')} ${this.stage}\n`;
206+
message += `${chalk.yellow('region:')} ${this.region}\n\n`;
207+
message += `${chalk.yellow.underline('State Machine Information')}\n`;
208+
message += `${chalk.yellow(this.options.state)}${chalk.yellow(':')} ${this.stateMachineArn}\n`;
209+
this.serverless.cli.consoleLog(message);
210+
return BbPromise.resolve();
211+
});
199212
} else {
200213
this.serverless.cli.log(`Start to deploy all step functions...`);
201214
return BbPromise.bind(this)
@@ -205,7 +218,22 @@ class ServerlessStepFunctions {
205218
.then(this.compileAll)
206219
.then(this.getIamRoles)
207220
.then(this.deleteStateMachines)
208-
.then(this.createStateMachines);
221+
.then(this.createStateMachines)
222+
.then(() => {
223+
this.serverless.cli.consoleLog('');
224+
this.serverless.cli.log('Finish to deploy all step functions');
225+
let message = '';
226+
message += `${chalk.yellow.underline('Service Information')}\n`;
227+
message += `${chalk.yellow('service:')} ${this.service}\n`;
228+
message += `${chalk.yellow('stage:')} ${this.stage}\n`;
229+
message += `${chalk.yellow('region:')} ${this.region}\n\n`;
230+
message += `${chalk.yellow.underline('State Machine Information')}\n`;
231+
_.forEach(this.stateMachineArns, (arn, name) => {
232+
message += `${chalk.yellow(name)}${chalk.yellow(':')} ${arn}\n`;
233+
});
234+
this.serverless.cli.consoleLog(message);
235+
return BbPromise.resolve();
236+
});
209237
}
210238
}
211239

@@ -392,7 +420,7 @@ class ServerlessStepFunctions {
392420
this.stateMachineArns = {};
393421
_.forEach(this.serverless.service.stepFunctions, (value, key) => {
394422
this.stateMachineArns[key] =
395-
`arn:aws:states:${this.region}:${result.Account}:stateMachine:${key}`;
423+
`arn:aws:states:${this.region}:${result.Account}:stateMachine:${this.getStateMachineName(key)}`;
396424
});
397425
return BbPromise.resolve();
398426
});
@@ -433,19 +461,26 @@ class ServerlessStepFunctions {
433461
this.options.stage,
434462
this.options.region)
435463
.then(() => {
436-
this.serverless.cli.consoleLog('');
437-
this.serverless.cli.log(`Finish to deploy ${this.getStateMachineName(state)} step function`);
438464
return BbPromise.resolve();
439465
}).catch((error) => {
440466
if (error.message.match(/State Machine is being deleted/)) {
441467
this.serverless.cli.printDot();
442-
setTimeout(this.createStateMachine(state).bind(this), 5000);
468+
this.createStateMachine.bin
469+
return this.setTimeout().then(() => {
470+
return this.createStateMachine(state);
471+
});
443472
} else {
444473
throw new this.serverless.classes.Error(error.message);
445474
}
446475
});
447476
}
448477

478+
setTimeout() {
479+
return new BbPromise((resolve, reject) => {
480+
setTimeout(resolve, 5000);
481+
})
482+
}
483+
449484
createStateMachines() {
450485
const promises = [];
451486
_.forEach(this.serverless.service.stepFunctions, (value, key) => {
@@ -454,7 +489,7 @@ class ServerlessStepFunctions {
454489

455490
return BbPromise.map(promises, (state) => {
456491
return this.createStateMachine(state);
457-
}).then(() => BbPromise.resolve());
492+
}).then(() => BbPromise.resolve());
458493
}
459494

460495
parseInputdate() {

0 commit comments

Comments
 (0)