UNPKG

ng-packagr

Version:

Compile and package Angular libraries in Angular Package Format (APF)

55 lines (54 loc) • 1.92 kB
#!/usr/bin/env node "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const node_path_1 = require("node:path"); const node_util_1 = require("node:util"); 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'); const HELP = `ng-packagr [options] Options: -v, --version Prints version info -w, --watch Watch for file changes --poll Enable and define the file watching poll time period in milliseconds -p, --project Path to the 'ng-package.json' or 'package.json' file. (default: ${DEFAULT_PROJECT_PATH}) -c, --config Path to a tsconfig file. -h, --help Show this help message `; function parseCliArgs() { return (0, node_util_1.parseArgs)({ options: { version: { type: 'boolean', short: 'v' }, watch: { type: 'boolean', short: 'w' }, poll: { type: 'string' }, project: { type: 'string', short: 'p' }, config: { type: 'string', short: 'c' }, help: { type: 'boolean', short: 'h' }, }, }).values; } let values; try { values = parseCliArgs(); } catch (err) { (0, log_1.error)(err.message); (0, log_1.msg)(HELP); process.exit(1); } if (values.help) { (0, log_1.msg)(HELP); } else if (values.version) { void (0, public_api_1.version)().then(() => process.exit(0)); } else { const config = values.config ? (0, node_path_1.resolve)(values.config) : undefined; const project = values.project || DEFAULT_PROJECT_PATH; const poll = values.poll !== undefined ? Number(values.poll) : undefined; (0, public_api_1.execute)(public_api_1.build, { config, project, watch: !!values.watch, poll }).catch(err => { (0, log_1.error)(err.message); process.exit(1); }); } //# sourceMappingURL=main.js.map