diff --git a/apps/generator/cli.js b/apps/generator/cli.js old mode 100755 new mode 100644 diff --git a/apps/generator/lib/generator.js b/apps/generator/lib/generator.js index 8a07a5670..1c15de72a 100644 --- a/apps/generator/lib/generator.js +++ b/apps/generator/lib/generator.js @@ -130,15 +130,16 @@ class Generator { /** @type {Object} The template parameters. The structure for this object is based on each individual template. */ this.templateParams = {}; Object.keys(templateParams).forEach(key => { - const self = this; Object.defineProperty(this.templateParams, key, { enumerable: true, - get() { - if (!self.templateConfig.parameters || !self.templateConfig.parameters[key]) { - throw new Error(`Template parameter "${key}" has not been defined in the package.json file under generator property. Please make sure it's listed there before you use it in your template.`); + get: () => { + if (this.templateConfig.parameters?.[key] == null) { + throw new Error( + `Template parameter "${key}" has not been defined in the package.json file under generator property. Please make sure it's listed there before you use it in your template.` + ); } return templateParams[key]; - } + }, }); }); }