Skip to content

Commit 5546e38

Browse files
author
Aleksander Dikanski
committed
Use immutable functions
1 parent dc59cc1 commit 5546e38

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/stackInformation.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,12 +171,15 @@ module.exports = {
171171
BbPromise.bind(this).then(this.aliasStackLoadAliasTemplates)
172172
)
173173
.spread((currentTemplate, aliasStackTemplates) => {
174-
const currentAliasStackTemplate = _.get(_.first(aliasStackTemplates, 'template', {}));
175-
const deployedAliasStackTemplates = _.map(aliasStackTemplates, template => template.template);
174+
const removed = _.filter(aliasStackTemplates, ['stack', `${this._provider.naming.getStackName()}-${this._alias}`]);
175+
const filteredAliasStackTemplates = _.without(aliasStackTemplates, ['stack', `${this._provider.naming.getStackName()}-${this._alias}`]);
176176

177+
const currentAliasStackTemplate = _.get(_.first(removed), 'template', {});
178+
const deployedAliasStackTemplates = _.map(filteredAliasStackTemplates, template => template.template);
179+
177180
this._serverless.service.provider.deployedCloudFormationTemplate = currentTemplate;
178181
this._serverless.service.provider.deployedCloudFormationAliasTemplate = currentAliasStackTemplate;
179-
this._serverless.service.provider.deployedAliasTemplates = aliasStackTemplates;
182+
this._serverless.service.provider.deployedAliasTemplates = filteredAliasStackTemplates;
180183
return BbPromise.resolve([ currentTemplate, deployedAliasStackTemplates, currentAliasStackTemplate ]);
181184
});
182185
},

0 commit comments

Comments
 (0)