UNPKG

create-cliz

Version:
49 lines (48 loc) 1.34 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CLIConfig = void 0; const path = require("path"); class CLIConfig { constructor() { this.data = {}; } get template() { return `template-${this.get('type')}`; } get templateURL() { return `https://github.com/cliz-design/${this.template}`; } get packageName() { const scope = this.get('scope'); const name = this.get('name'); if (scope) { return `@${scope}/${name}`; } return name; } get projectPath() { var _a, _b; return path.resolve((_a = this.get('codePath')) !== null && _a !== void 0 ? _a : '', (_b = this.get('name')) !== null && _b !== void 0 ? _b : ''); } set(key, value) { this.data[key] = value; } get(key) { return this.data[key]; } toJSON() { const { data } = this; return { ...data, template: this.template, templateURL: this.templateURL, packageName: this.packageName, projectPath: this.projectPath, }; } getProjectPath(name) { var _a; return path.resolve((_a = this.get('codePath')) !== null && _a !== void 0 ? _a : '', name); } } exports.CLIConfig = CLIConfig;