1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.setTargetDependencies = void 0;
|
4 | const tslib_1 = require("tslib");
|
5 | const devkit_1 = require("@nrwl/devkit");
|
6 | const output_1 = require("../../utilities/output");
|
7 | function setTargetDependencies(host) {
|
8 | var _a, _b, _c, _d, _e, _f, _g;
|
9 | return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
10 | const config = (0, devkit_1.readWorkspaceConfiguration)(host);
|
11 | const strictlyOrderedTargets = ((_c = (_b = (_a = config.tasksRunnerOptions) === null || _a === void 0 ? void 0 : _a['default']) === null || _b === void 0 ? void 0 : _b.options) === null || _c === void 0 ? void 0 : _c.strictlyOrderedTargets) || ['build'];
|
12 | (_f = (_e = (_d = config.tasksRunnerOptions) === null || _d === void 0 ? void 0 : _d['default']) === null || _e === void 0 ? void 0 : _e.options) === null || _f === void 0 ? true : delete _f.strictlyOrderedTargets;
|
13 | config.targetDependencies = (_g = config.targetDependencies) !== null && _g !== void 0 ? _g : {};
|
14 | const updatedStrictlyOrderedTargets = [];
|
15 | strictlyOrderedTargets.forEach((target) => {
|
16 | if (!config.targetDependencies[target]) {
|
17 | config.targetDependencies[target] = [
|
18 | { target, projects: 'dependencies' },
|
19 | ];
|
20 | updatedStrictlyOrderedTargets.push(target);
|
21 | }
|
22 | });
|
23 | (0, devkit_1.updateWorkspaceConfiguration)(host, config);
|
24 | if (updatedStrictlyOrderedTargets.length > 0) {
|
25 | output_1.output.note({
|
26 | title: 'Target dependencies have been updated in nx.json',
|
27 | bodyLines: [
|
28 | `Nx has deprecated strictlyOrderedTargets in favour of targetDependencies.`,
|
29 | `Based on your configuration the migration has configured targetDependencies for the following targets: ${updatedStrictlyOrderedTargets.join(', ')}.`,
|
30 | `Read more here: https://nx.dev/reference/project-configuration`,
|
31 | ],
|
32 | });
|
33 | }
|
34 | yield (0, devkit_1.formatFiles)(host);
|
35 | });
|
36 | }
|
37 | exports.setTargetDependencies = setTargetDependencies;
|
38 | exports.default = setTargetDependencies;
|
39 |
|
\ | No newline at end of file |