UNPKG

europa-build

Version:

Tool for generating and maintaining Europa plugins and presets

97 lines 4.13 kB
"use strict"; /* * Copyright (C) 2022 neocotic * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.CommonPluginTemplateProvider = void 0; const PackageInfo_1 = require("../../../PackageInfo"); const CommonTemplateProvider_1 = require("../CommonTemplateProvider"); const TemplateProviderType_1 = require("../TemplateProviderType"); /** * An abstract {@link TemplateProvider} that is intended for plugin package template providers. */ class CommonPluginTemplateProvider extends CommonTemplateProvider_1.CommonTemplateProvider { /** * Creates an instance of {@link CommonPluginTemplateProvider} using the `options` provided. * * @param options - The options to be used. */ constructor(options) { super(options); } createCommonCliOptions() { return [ { arg: '<desc>', description: 'description of the package', longName: 'description', }, { arg: '<keywords...>', description: 'keywords of the package', longName: 'keywords', }, { arg: '<name>', description: 'name of the package', longName: 'name', }, { arg: '<name>', description: 'name of the preset package containing the package', longName: 'preset', }, { arg: '<version>', description: 'version of the package', longName: 'version', }, ]; } async createCommonContext(options) { var _a, _b, _c, _d, _e; const packageInfo = await PackageInfo_1.PackageInfo.getSingleton(); let name = this.getRequiredContextOption(options, 'name'); if (!name.startsWith('europa-plugin-')) { name = `europa-plugin-${name}`; } let preset = options.preset; if (preset && !preset.startsWith('europa-preset-')) { preset = `europa-preset-${preset}`; } return { authorName: this.getAuthorName(options), copyrightYear: (_a = options.copyrightYear) !== null && _a !== void 0 ? _a : new Date().getFullYear(), description: (_b = options.description) !== null && _b !== void 0 ? _b : 'TODO: Description', europaVersion: (_c = options.europaVersion) !== null && _c !== void 0 ? _c : packageInfo.json.version, isDefaultPreset: preset === 'europa-preset-default', keywords: (_d = options.keywords) !== null && _d !== void 0 ? _d : [], name, preset, version: (_e = options.version) !== null && _e !== void 0 ? _e : (await this.getDefaultVersion()), }; } getType() { return TemplateProviderType_1.TemplateProviderType.Plugin; } } exports.CommonPluginTemplateProvider = CommonPluginTemplateProvider; //# sourceMappingURL=CommonPluginTemplateProvider.js.map