ng-afelio
Version:
Extended Angular CLI
24 lines (23 loc) • 1.04 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.installNpmSchematicPackage = void 0;
const child_process_1 = require("child_process");
function installNpmSchematicPackage(packageName) {
return async (host, context) => {
return new Promise((resolve) => {
context.logger.info(`📦 Installing package '${packageName}' for external schematic setup...`);
(0, child_process_1.spawn)('npm', ['install', packageName], { stdio: 'inherit' }).on('close', (code) => {
if (code === 0) {
context.logger.info(`✅ '${packageName}' package installed successfully`);
resolve();
}
else {
const errorMessage = `❌ installation of '${packageName}' package failed`;
context.logger.error(errorMessage);
throw new Error();
}
});
});
};
}
exports.installNpmSchematicPackage = installNpmSchematicPackage;