UNPKG

@salesforce/templates

Version:

Salesforce JS library for templates

39 lines 1.81 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 LightningInterfaceGenerator extends sfdxGenerator_1.SfdxGenerator { constructor(args, options) { super(args, options); this.sourceRootWithPartialPath('lightninginterface'); } validateOptions() { utils_1.CreateUtil.checkInputs(this.options.interfacename); utils_1.CreateUtil.checkInputs(this.options.template); const fileparts = path.resolve(this.outputdir).split(path.sep); if (!this.options.internal && !fileparts.includes('aura')) { throw new Error(i18n_1.nls.localize('MissingAuraDir')); } } writing() { const { template, interfacename, internal } = this.options; // tslint:disable-next-line:no-unused-expression if (!internal) { this.fs.copyTpl(this.templatePath('_auradefinitionbundle.intf-meta.xml'), this.destinationPath(path.join(this.outputdir, interfacename, `${interfacename}.intf-meta.xml`)), { apiVersion: this.apiversion, description: i18n_1.nls.localize('LightningInterfaceBundle'), }); } this.fs.copyTpl(this.templatePath(`${template}.intf`), this.destinationPath(path.join(this.outputdir, interfacename, `${interfacename}.intf`)), {}); } } exports.default = LightningInterfaceGenerator; //# sourceMappingURL=lightningInterfaceGenerator.js.map