reusable-serverless-template
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -57,5 +57,6 @@ /** | ||
* @param params sls variable name -> value map. E.g. Map { '(foo' => 'bar', 'stage' => 'test)' } | ||
* @param print print the resolved template before converting to Yaml object | ||
* @return yaml object | ||
*/ | ||
export declare const load: (filePath: string, params?: Map<string, string>) => string; | ||
export declare const load: (filePath: string, params?: Map<string, string>, print?: boolean) => string; | ||
/** | ||
@@ -62,0 +63,0 @@ * Dump yaml object |
@@ -103,3 +103,3 @@ "use strict"; | ||
resolveFiles(content, dir) { | ||
const paramRegexpStr = '([\\t ]*)\\${tfile:([^:}]+)(:([^}]))?}'; | ||
const paramRegexpStr = '([\\t ]*)\\${tfile:([^:}]+)(:([^}]+))?}'; | ||
const paramRegexp = new RegExp(paramRegexpStr, 'g'); //global to find all occurrences | ||
@@ -152,6 +152,11 @@ content = content.replace(paramRegexp, (match) => { | ||
* @param params sls variable name -> value map. E.g. Map { '(foo' => 'bar', 'stage' => 'test)' } | ||
* @param print print the resolved template before converting to Yaml object | ||
* @return yaml object | ||
*/ | ||
exports.load = function (filePath, params) { | ||
return js_yaml_1.load(new YamlTemplate().loadFile(filePath, params)); | ||
exports.load = function (filePath, params, print = true) { | ||
const resolvedTemplate = new YamlTemplate().loadFile(filePath, params); | ||
if (print) { | ||
console.log(resolvedTemplate); | ||
} | ||
return js_yaml_1.load(resolvedTemplate); | ||
}; | ||
@@ -158,0 +163,0 @@ /** |
{ | ||
"name": "reusable-serverless-template", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"main": "dist/src/index.js", | ||
@@ -5,0 +5,0 @@ "scripts": { |
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
18564
8
312