1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | Object.defineProperty(exports, "__esModule", { value: true });
|
10 | exports.execute = void 0;
|
11 | const architect_1 = require("@angular-devkit/architect");
|
12 | const path_1 = require("path");
|
13 | const rxjs_1 = require("rxjs");
|
14 | const operators_1 = require("rxjs/operators");
|
15 | async function initialize(options, root) {
|
16 | const packager = (await Promise.resolve().then(() => require('ng-packagr'))).ngPackagr();
|
17 | packager.forProject(path_1.resolve(root, options.project));
|
18 | if (options.tsConfig) {
|
19 | packager.withTsConfig(path_1.resolve(root, options.tsConfig));
|
20 | }
|
21 | return packager;
|
22 | }
|
23 |
|
24 |
|
25 |
|
26 | function execute(options, context) {
|
27 | return rxjs_1.from(initialize(options, context.workspaceRoot)).pipe(operators_1.switchMap((packager) => (options.watch ? packager.watch() : packager.build())), operators_1.mapTo({ success: true }));
|
28 | }
|
29 | exports.execute = execute;
|
30 | exports.default = architect_1.createBuilder(execute);
|