ng-packagr
Version:
Compile and package Angular libraries in Angular Package Format (APF)
31 lines • 1.47 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const commander_1 = require("commander");
const node_path_1 = require("node:path");
const log_1 = require("../lib/utils/log");
const public_api_1 = require("../public_api");
const DEFAULT_PROJECT_PATH = (0, node_path_1.resolve)(process.cwd(), 'ng-package.json');
function parseProjectPath(parsed) {
return parsed || DEFAULT_PROJECT_PATH;
}
commander_1.program
.name('ng-packagr')
.storeOptionsAsProperties(false)
.option('-v, --version', 'Prints version info')
.option('-w, --watch', 'Watch for file changes')
.option('--poll <interval>', 'Enable and define the file watching poll time period in milliseconds', x => +x)
.option('-p, --project <path>', "Path to the 'ng-package.json' or 'package.json' file.", parseProjectPath, DEFAULT_PROJECT_PATH)
.option('-c, --config <config>', 'Path to a tsconfig file.', (value) => value ? (0, node_path_1.resolve)(value) : undefined);
commander_1.program.on('option:version', () => {
void (0, public_api_1.version)().then(() => process.exit(0));
});
commander_1.program.parse(process.argv);
const { config, project, watch, version, poll } = commander_1.program.opts();
if (!version) {
(0, public_api_1.execute)(public_api_1.build, { config, project, watch: !!watch, poll }).catch(err => {
(0, log_1.error)(err.message);
process.exit(1);
});
}
//# sourceMappingURL=main.js.map