Skip to content

Commit

Permalink
Block serverless remove and point to alias remove to remove the service
Browse files Browse the repository at this point in the history
  • Loading branch information
Frank Schmid committed Jun 21, 2017
1 parent 4a93ce2 commit 3add038
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,13 @@ class AwsAlias {
.then(this.validate)
.then(this.listAliases),

'before:remove:remove': () => {
if (!this._validated) {
throw new this._serverless.classes.Error(`Use "serverless alias remove --alias=${this._stage}" to remove the service.`);
}
return BbPromise.resolve();
},

// Override the logs command - must be, because the $LATEST filter
// in the original logs command is not easy to change without hacks.
'logs:logs': () => BbPromise.bind(this)
Expand Down
2 changes: 2 additions & 0 deletions lib/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ module.exports = {
this._aliasResources = true;
}

this._validated = true;

return BbPromise.resolve();

}
Expand Down

0 comments on commit 3add038

Please sign in to comment.