@lidhium/cli
Version:
micro-frontend cli packed with webpack
38 lines (37 loc) • 2.21 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const common_1 = require("../utils/common");
const chalk_1 = __importDefault(require("chalk"));
const config_1 = require("../config");
const child_process_1 = require("child_process");
exports.default = () => (appName) => __awaiter(void 0, void 0, void 0, function* () {
(0, common_1.printLibraryHeader)();
const configFile = (0, common_1.getConfigFile)();
if (!configFile) {
console.error("lidhium.config.json not found");
console.log(chalk_1.default.green(`For more details visit ${chalk_1.default.magenta(`${config_1.config.docs.webUrl}/docs/getting-started#build-app`)}`));
return;
}
if (!configFile.apps[appName]) {
console.error(chalk_1.default.red(`App ${chalk_1.default.magenta(appName)} not exists`));
console.log(chalk_1.default.green(`For more details visit ${chalk_1.default.magenta(`${config_1.config.docs.webUrl}/docs/getting-started#build-app`)}`));
return;
}
console.log(chalk_1.default.green(`building app ${chalk_1.default.magenta(appName)}`));
(0, child_process_1.execSync)(`webpack --config ./apps/${appName}/webpack.config.js`, {
stdio: "inherit",
});
console.log(chalk_1.default.green(`App ${chalk_1.default.magenta(appName)} build successfully in ${chalk_1.default.magenta(`/dist`)} folder`));
});