@lidhium/cli
Version:
micro-frontend cli packed with webpack
35 lines (34 loc) • 1.86 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");
return;
}
if (!configFile.apps[appName]) {
console.error(`App ${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#commands`)}`));
return;
}
const { port } = configFile.apps[appName];
console.log(`Starting app ${appName}`);
(0, child_process_1.execSync)(`webpack serve --config ./apps/${appName}/webpack.config.js --port ${port}`, { stdio: "inherit" });
});