create-plume-react-project
Version:
CLI to create Plume React Project
32 lines (31 loc) • 1.1 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const minimist_1 = __importDefault(require("minimist"));
const path_1 = __importDefault(require("path"));
/**
* Handle cli config reader
*/
class Config {
initialize() {
const parsedArgs = minimist_1.default(process.argv.slice(2), { boolean: 'verbose' });
this.configValue = {
template: 'front',
projectName: 'my-project',
verbose: false,
targetDirectory: process.cwd(),
templateDirectory: path_1.default.resolve(__dirname, '../templates'),
...parsedArgs,
};
}
get() {
if (this.configValue) {
return this.configValue;
}
throw new Error('Config.initialize() must be called before configuration is used');
}
static get [Symbol.for("___CTOR_NAME___")]() { return "Config"; }
}
exports.default = Config;