UNPKG

1.24 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.forEachExecutorOptions = void 0;
4const devkit_1 = require("@nrwl/devkit");
5/**
6 * Calls a function for each different options that an executor is configured with
7 */
8function forEachExecutorOptions(tree,
9/**
10 * Name of the executor to update options for
11 */
12executorName,
13/**
14 * Callback that is called for each options configured for a builder
15 */
16callback) {
17 for (const [projectName, project] of (0, devkit_1.getProjects)(tree)) {
18 for (const [targetName, target] of Object.entries(project.targets || {})) {
19 if (executorName !== target.executor) {
20 continue;
21 }
22 if (target.options) {
23 callback(target.options, projectName, targetName);
24 }
25 if (!target.configurations) {
26 continue;
27 }
28 Object.entries(target.configurations).forEach(([configName, options]) => {
29 callback(options, projectName, targetName, configName);
30 });
31 }
32 }
33}
34exports.forEachExecutorOptions = forEachExecutorOptions;
35// TODO: add a method for updating options
36//# sourceMappingURL=executor-options-utils.js.map
\No newline at end of file