@omni-door/tpl-ssr-react
Version:
The ssr-react project template
73 lines (72 loc) • 2.12 kB
JavaScript
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var utils_1 = require("@omni-door/utils");
var path_1 = require("path");
var init_1 = __importDefault(require("./init"));
var new_1 = __importDefault(require("./new"));
var args = process.argv.slice(2);
if (args.length > 0) {
if (args[0] === 'new' && args[1]) {
// new template
var options = {
ts: true,
test: false,
componentName: 'Omni',
stylesheet: '',
newPath: process.cwd(),
type: 'fc'
};
for (var i = 1; i < args.length; i++) {
var item = args[i];
var _a = item.split('='), k = _a[0], val = _a[1];
options[k] = val === 'true'
? true
: val === 'false'
? false
: val;
}
try {
new_1.default(options);
}
catch (err) {
utils_1.logErr(err);
process.exit(1);
}
}
else if (args[0] === 'init') {
var options = {
strategy: 'stable',
projectName: path_1.parse(process.cwd()).name,
initPath: process.cwd(),
ts: true,
test: false,
eslint: true,
prettier: true,
commitlint: false,
style: 'all',
stylelint: true,
install: true,
pkgtool: 'pnpm'
};
for (var i = 0; i < args.length; i++) {
var item = args[i];
var _b = item.split('='), k = _b[0], val = _b[1];
options[k] = val === 'true'
? true
: val === 'false'
? false
: val;
}
options['style'] = 'all';
try {
init_1.default(options);
}
catch (err) {
utils_1.logErr(err);
process.exit(1);
}
}
}
;