1 | "use strict";
|
---|
2 | /**
|
---|
3 | * @license
|
---|
4 | * Copyright Google LLC All Rights Reserved.
|
---|
5 | *
|
---|
6 | * Use of this source code is governed by an MIT-style license that can be
|
---|
7 | * found in the LICENSE file at https://angular.io/license
|
---|
8 | */
|
---|
9 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
10 | exports.getTargetsByBuilderName = exports.getProjectTargetOptions = exports.defaultTargetBuilders = void 0;
|
---|
11 | const schematics_1 = require("@angular-devkit/schematics");
|
---|
12 | /** Object that maps a CLI target to its default builder name. */
|
---|
13 | exports.defaultTargetBuilders = {
|
---|
14 | build: '@angular-devkit/build-angular:browser',
|
---|
15 | test: '@angular-devkit/build-angular:karma',
|
---|
16 | };
|
---|
17 | /** Resolves the architect options for the build target of the given project. */
|
---|
18 | function getProjectTargetOptions(project, buildTarget) {
|
---|
19 | var _a, _b;
|
---|
20 | const options = (_b = (_a = project.targets) === null || _a === void 0 ? void 0 : _a.get(buildTarget)) === null || _b === void 0 ? void 0 : _b.options;
|
---|
21 | if (!options) {
|
---|
22 | throw new schematics_1.SchematicsException(`Cannot determine project target configuration for: ${buildTarget}.`);
|
---|
23 | }
|
---|
24 | return options;
|
---|
25 | }
|
---|
26 | exports.getProjectTargetOptions = getProjectTargetOptions;
|
---|
27 | /** Gets all targets from the given project that match the specified builder name. */
|
---|
28 | function getTargetsByBuilderName(project, builderName) {
|
---|
29 | return Array.from(project.targets.keys())
|
---|
30 | .filter(name => { var _a; return ((_a = project.targets.get(name)) === null || _a === void 0 ? void 0 : _a.builder) === builderName; })
|
---|
31 | .map(name => project.targets.get(name));
|
---|
32 | }
|
---|
33 | exports.getTargetsByBuilderName = getTargetsByBuilderName;
|
---|
34 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvamVjdC10YXJnZXRzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vc3JjL2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