1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.enableSourceAnalysis = void 0;
|
4 | const tslib_1 = require("tslib");
|
5 | const devkit_1 = require("@nrwl/devkit");
|
6 | function enableSourceAnalysis(tree) {
|
7 | var _a;
|
8 | return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
9 | const config = (0, devkit_1.readWorkspaceConfiguration)(tree);
|
10 | if (config.extends === 'nx/presets/core.json' ||
|
11 | config.extends === 'nx/presets/npm.json') {
|
12 | const explicitlyDisabled = config.pluginsConfig &&
|
13 | config.pluginsConfig['@nrwl/js'] &&
|
14 | config.pluginsConfig['@nrwl/js'].analyzeSourceFiles === false;
|
15 | if (!explicitlyDisabled) {
|
16 | config.pluginsConfig || (config.pluginsConfig = {});
|
17 | (_a = config.pluginsConfig)['@nrwl/js'] || (_a['@nrwl/js'] = {});
|
18 | config.pluginsConfig['@nrwl/js'].analyzeSourceFiles = true;
|
19 | }
|
20 | }
|
21 | (0, devkit_1.updateWorkspaceConfiguration)(tree, config);
|
22 | yield (0, devkit_1.formatFiles)(tree);
|
23 | });
|
24 | }
|
25 | exports.enableSourceAnalysis = enableSourceAnalysis;
|
26 | exports.default = enableSourceAnalysis;
|
27 |
|
\ | No newline at end of file |