Skip to content

Commit aba4cc5

Browse files
committed
add serverless message
1 parent 5279b28 commit aba4cc5

File tree

4 files changed

+23
-6
lines changed

4 files changed

+23
-6
lines changed

index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ class ServerlessStepFunctions {
6565
shortcut: 's',
6666
required: true,
6767
},
68+
data: {
69+
usage: 'String data to be passed as an event to your step function',
70+
shortcut: 'd',
71+
}
6872
},
6973
},
7074
},

lib/deploy.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ module.exports = {
2121
]
2222
}
2323
`;
24+
25+
this.serverless.cli.log(`Start to deploy ${this.options.state} step function...`);
2426
BbPromise.bind(this)
2527
.then(this.yamlParse)
2628
.then(this.getStateMachineArn)
@@ -163,10 +165,13 @@ module.exports = {
163165
},
164166
this.options.stage,
165167
this.options.region)
166-
.then(() => BbPromise.resolve())
167-
.catch((error) => {
168-
console.log(error)
168+
.then(() => {
169+
this.serverless.cli.consoleLog('');
170+
this.serverless.cli.log(`Finish to deploy ${this.options.state} step function`);
171+
return BbPromise.resolve()
172+
}).catch((error) => {
169173
if (error.message.match(/State Machine is being deleted/)) {
174+
this.serverless.cli.printDot();
170175
setTimeout(this.createStateMachine.bind(this), 5000);
171176
} else {
172177
throw new this.serverless.classes.Error(error.message);

lib/invoke.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,13 @@ module.exports = {
1212
},
1313

1414
startExecution() {
15+
this.serverless.cli.log(`Start function ${this.options.state}...`);
16+
1517
return this.provider.request('StepFunctions',
1618
'startExecution',
1719
{
1820
stateMachineArn: this.stateMachineArn,
21+
input: this.options.data
1922
},
2023
this.options.stage,
2124
this.options.region)
@@ -36,11 +39,12 @@ module.exports = {
3639
this.options.stage,
3740
this.options.region)
3841
.then((result) => {
39-
4042
if (result.status === 'RUNNING') {
43+
this.serverless.cli.printDot();
4144
setTimeout(this.describeExecution.bind(this), 5000);
4245
} else {
43-
46+
this.serverless.cli.consoleLog('');
47+
this.serverless.cli.consoleLog(result);
4448
}
4549
return BbPromise.resolve();
4650
}).catch((error) => {

lib/remove.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ module.exports = {
55
remove() {
66
BbPromise.bind(this)
77
.then(this.getStateMachineArn)
8-
.then(this.deleteStateMachine);
8+
.then(this.deleteStateMachine)
9+
.then(() => {
10+
this.serverless.cli.log(`Remove ${this.options.state}`);
11+
return BbPromise.resolve();
12+
});
913

1014
return BbPromise.resolve();
1115
},

0 commit comments

Comments
 (0)