serverless-pseudo-parameters
Advanced tools
Comparing version 2.1.0 to 2.2.0
@@ -85,6 +85,13 @@ 'use strict'; | ||
if (typeof value === 'string' && value.search(aws_regex) >= 0) { | ||
dictionary[key] = { | ||
"Fn::Sub": value.replace(aws_regex, '${$1}') | ||
}; | ||
let replacedString = value.replace(aws_regex, '${$1}'); | ||
if (key === 'Fn::Sub') { | ||
dictionary[key] = replacedString; | ||
} else { | ||
dictionary[key] = { | ||
"Fn::Sub": replacedString | ||
}; | ||
} | ||
// do some fancy logging | ||
@@ -91,0 +98,0 @@ let m = aws_regex.exec(value); |
@@ -34,2 +34,5 @@ const Plugin = require('.'); | ||
Reference: "#{SomeResource}", | ||
Substitution: { | ||
"Fn::Sub": "#{SomeResource}" | ||
} | ||
} | ||
@@ -42,7 +45,7 @@ } | ||
resultTemplate = serverlessPseudoParamsPlugin.serverless.service.provider.compiledCloudFormationTemplate; | ||
expect(Object.keys(resultTemplate.Resources.acmeResource.Properties).length).toEqual(9); | ||
expect(Object.keys(resultTemplate.Resources.acmeResource.Properties).length).toEqual(10); | ||
}); | ||
it('replaces #{AWS::[VAR]} with the correct CF pseudo parameter', () => { | ||
expect(Object.keys(resultTemplate.Resources.acmeResource.Properties).length).toEqual(9); | ||
expect(Object.keys(resultTemplate.Resources.acmeResource.Properties).length).toEqual(10); | ||
}); | ||
@@ -77,2 +80,5 @@ | ||
}); | ||
it('should not add Fn::Sub to items with Fn::Sub already', () => { | ||
expect(resultTemplate.Resources.acmeResource.Properties.Substitution).toEqual({ 'Fn::Sub': '${SomeResource}'}); | ||
}); | ||
@@ -79,0 +85,0 @@ }); |
{ | ||
"name": "serverless-pseudo-parameters", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"devDependencies": { | ||
@@ -13,4 +13,4 @@ "jest": "^22.4.2" | ||
"scripts": { | ||
"test": "jest", | ||
"test:watch": "jest --watch" | ||
"test": "jest --env node", | ||
"test:watch": "jest --env node --watch" | ||
}, | ||
@@ -17,0 +17,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15962
286