1 | #!/usr/bin/env node
|
2 | "use strict";
|
3 | Object.defineProperty(exports, "__esModule", { value: true });
|
4 | const program = require("commander");
|
5 | const path = require("path");
|
6 | const updateNotifier = require("update-notifier");
|
7 | const readPkgUp = require("read-pkg-up");
|
8 | const public_api_1 = require("../public_api");
|
9 | const DEFAULT_PROJECT_PATH = path.resolve(process.cwd(), 'ng-package.json');
|
10 | function parseProjectPath(parsed) {
|
11 | return parsed || DEFAULT_PROJECT_PATH;
|
12 | }
|
13 | program
|
14 | .name('ng-packagr')
|
15 | .option('-V, --version', 'Prints version info')
|
16 | .option('-w, --watch', 'Watch for file changes')
|
17 | .option('-p, --project [path]', "Path to the 'ng-package.json' or 'package.json' file.", parseProjectPath, DEFAULT_PROJECT_PATH)
|
18 | .option('-c, --config [config]', 'Path to a tsconfig file.', (value) => value ? path.resolve(value) : undefined);
|
19 | const dir = path.dirname(module.filename);
|
20 | const pkg = readPkgUp.sync({ cwd: dir }).pkg;
|
21 | updateNotifier({ pkg }).notify();
|
22 | program.on('option:version', () => {
|
23 | public_api_1.version(pkg);
|
24 | process.exit(0);
|
25 | });
|
26 | program.parse(process.argv);
|
27 | const { config, project, watch } = program.opts();
|
28 | public_api_1.execute(public_api_1.build, { config, project, watch: !!watch }).catch(() => process.exit(111));
|
29 |
|
\ | No newline at end of file |