UNPKG

@salesforce/templates

Version:

Salesforce JS library for templates

31 lines 1.41 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); /* * 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 utils_1 = require("../utils"); const baseGenerator_1 = require("./baseGenerator"); class ApexClassGenerator extends baseGenerator_1.BaseGenerator { constructor(options) { super(options); } validateOptions() { utils_1.CreateUtil.checkInputs(this.options.template); utils_1.CreateUtil.checkInputs(this.options.classname); } generate() { return tslib_1.__awaiter(this, void 0, void 0, function* () { const { template, classname } = this.options; this.sourceRootWithPartialPath('apexclass'); yield this.render(this.templatePath(`${template}.cls`), this.destinationPath(path.join(this.outputdir, `${classname}.cls`)), { apiName: classname }); yield this.render(this.templatePath('_class.cls-meta.xml'), this.destinationPath(path.join(this.outputdir, `${classname}.cls-meta.xml`)), { apiName: classname, apiVersion: this.apiversion }); }); } } exports.default = ApexClassGenerator; //# sourceMappingURL=apexClassGenerator.js.map