UNPKG

@salesforce/templates

Version:

Salesforce JS library for templates

45 lines 2.72 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /* * Copyright (c) 2019, salesforce.com, inc. * All rights reserved. * Licensed under the BSD 3-Clause license. * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ const path = require("path"); const i18n_1 = require("../i18n"); const utils_1 = require("../utils"); const sfdxGenerator_1 = require("./sfdxGenerator"); class LightningAppGenerator extends sfdxGenerator_1.SfdxGenerator { constructor(args, options) { super(args, options); this.sourceRootWithPartialPath('lightningapp'); } validateOptions() { utils_1.CreateUtil.checkInputs(this.options.appname); utils_1.CreateUtil.checkInputs(this.options.template); const fileparts = path.resolve(this.outputdir).split(path.sep); if (!fileparts.includes('aura') && !this.options.internal) { throw new Error(i18n_1.nls.localize('MissingAuraDir')); } } writing() { const { template, appname, internal } = this.options; // tslint:disable-next-line:no-unused-expression if (!internal) { this.fs.copyTpl(this.templatePath('_auradefinitionbundle.app-meta.xml'), this.destinationPath(path.join(this.outputdir, appname, `${appname}.app-meta.xml`)), { apiVersion: this.apiversion, description: i18n_1.nls.localize('LightningAppBundle'), }); } this.fs.copyTpl(this.templatePath(`${template}.app`), this.destinationPath(path.join(this.outputdir, appname, `${appname}.app`)), {}), this.fs.copyTpl(this.templatePath('DefaultLightningAuradoc.auradoc'), this.destinationPath(path.join(this.outputdir, appname, `${appname}.auradoc`)), {}), this.fs.copyTpl(this.templatePath('DefaultLightningController.js'), this.destinationPath(path.join(this.outputdir, appname, `${appname}Controller.js`)), {}), this.fs.copyTpl(this.templatePath('DefaultLightningCss.css'), this.destinationPath(path.join(this.outputdir, appname, `${appname}.css`)), {}), this.fs.copyTpl(this.templatePath('DefaultLightningHelper.js'), this.destinationPath(path.join(this.outputdir, appname, `${appname}Helper.js`)), {}), this.fs.copyTpl(this.templatePath('DefaultLightningRenderer.js'), this.destinationPath(path.join(this.outputdir, appname, `${appname}Renderer.js`)), {}), this.fs.copyTpl(this.templatePath('DefaultLightningSVG.svg'), this.destinationPath(path.join(this.outputdir, appname, `${appname}.svg`)), {}); } } exports.default = LightningAppGenerator; //# sourceMappingURL=lightningAppGenerator.js.map