UNPKG

1.29 kBJavaScriptView Raw
1#!/usr/bin/env node
2"use strict";
3Object.defineProperty(exports, "__esModule", { value: true });
4const program = require("commander");
5const path = require("path");
6const updateNotifier = require("update-notifier");
7const readPkgUp = require("read-pkg-up");
8const public_api_1 = require("../public_api");
9const DEFAULT_PROJECT_PATH = path.resolve(process.cwd(), 'ng-package.json');
10function parseProjectPath(parsed) {
11 return parsed || DEFAULT_PROJECT_PATH;
12}
13program
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);
19const dir = path.dirname(module.filename);
20const pkg = readPkgUp.sync({ cwd: dir }).pkg;
21updateNotifier({ pkg }).notify();
22program.on('option:version', () => {
23 public_api_1.version(pkg);
24 process.exit(0);
25});
26program.parse(process.argv);
27const { config, project, watch } = program.opts();
28public_api_1.execute(public_api_1.build, { config, project, watch: !!watch }).catch(() => process.exit(111));
29//# sourceMappingURL=main.js.map
\No newline at end of file