1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
10 | if (k2 === undefined) k2 = k;
|
11 | Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
12 | }) : (function(o, m, k, k2) {
|
13 | if (k2 === undefined) k2 = k;
|
14 | o[k2] = m[k];
|
15 | }));
|
16 | var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
17 | Object.defineProperty(o, "default", { enumerable: true, value: v });
|
18 | }) : function(o, v) {
|
19 | o["default"] = v;
|
20 | });
|
21 | var __importStar = (this && this.__importStar) || function (mod) {
|
22 | if (mod && mod.__esModule) return mod;
|
23 | var result = {};
|
24 | if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
25 | __setModuleDefault(result, mod);
|
26 | return result;
|
27 | };
|
28 | Object.defineProperty(exports, "__esModule", { value: true });
|
29 | exports.execute = void 0;
|
30 | const architect_1 = require("@angular-devkit/architect");
|
31 | const path_1 = require("path");
|
32 | const rxjs_1 = require("rxjs");
|
33 | const operators_1 = require("rxjs/operators");
|
34 | async function initialize(options, root) {
|
35 | const packager = (await Promise.resolve().then(() => __importStar(require('ng-packagr')))).ngPackagr();
|
36 | packager.forProject(path_1.resolve(root, options.project));
|
37 | if (options.tsConfig) {
|
38 | packager.withTsConfig(path_1.resolve(root, options.tsConfig));
|
39 | }
|
40 | return packager;
|
41 | }
|
42 |
|
43 |
|
44 |
|
45 | function execute(options, context) {
|
46 | return rxjs_1.from(initialize(options, context.workspaceRoot)).pipe(operators_1.switchMap((packager) => (options.watch ? packager.watch() : packager.build())), operators_1.mapTo({ success: true }), operators_1.catchError((err) => rxjs_1.of({ success: false, error: err.message })));
|
47 | }
|
48 | exports.execute = execute;
|
49 | exports.default = architect_1.createBuilder(execute);
|