@nx/workspace 16.8.0-beta.4 → 16.8.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +29 -29
- package/src/executors/counter/counter.impl.js +29 -36
- package/src/generators/ci-workflow/ci-workflow.js +22 -21
- package/src/generators/convert-to-monorepo/convert-to-monorepo.js +29 -32
- package/src/generators/convert-to-nx-project/convert-to-nx-project.js +59 -64
- package/src/generators/move/lib/create-project-configuration-in-new-destination.js +6 -5
- package/src/generators/move/lib/extract-base-configs.js +13 -16
- package/src/generators/move/lib/normalize-schema.js +9 -3
- package/src/generators/move/lib/update-eslint-config.js +1 -1
- package/src/generators/move/lib/update-imports.js +4 -5
- package/src/generators/move/move.js +28 -31
- package/src/generators/new/generate-preset.js +4 -8
- package/src/generators/new/generate-workspace-files.js +47 -41
- package/src/generators/new/new.js +24 -30
- package/src/generators/npm-package/npm-package.js +27 -27
- package/src/generators/preset/preset.js +182 -188
- package/src/generators/remove/lib/check-dependencies.js +12 -15
- package/src/generators/remove/lib/check-targets.js +31 -34
- package/src/generators/remove/lib/update-tsconfig.js +16 -19
- package/src/generators/remove/remove.js +12 -15
- package/src/generators/run-commands/run-commands.js +18 -21
- package/src/generators/utils/get-npm-package-version.js +1 -1
- package/src/generators/utils/presets.d.ts +4 -0
- package/src/generators/utils/presets.js +5 -0
- package/src/generators/workspace-generator/workspace-generator.js +3 -6
- package/src/migrations/update-12-5-0/add-target-dependencies.js +26 -28
- package/src/migrations/update-13-0-0/config-locations/config-locations.js +16 -19
- package/src/migrations/update-13-0-0/set-default-base-if-not-set.js +16 -21
- package/src/migrations/update-13-10-0/update-decorate-cli.js +1 -2
- package/src/migrations/update-13-10-0/update-tasks-runner.js +2 -3
- package/src/migrations/update-13-2-0/set-parallel-default.js +14 -18
- package/src/migrations/update-13-3-0/update-tsc-executor-location.js +17 -20
- package/src/migrations/update-13-6-0/remove-old-task-runner-options.js +1 -2
- package/src/migrations/update-13-9-0/replace-tao-with-nx.js +2 -3
- package/src/migrations/update-13-9-0/update-decorate-cli.js +1 -2
- package/src/migrations/update-14-0-0/change-npm-script-executor.js +7 -10
- package/src/migrations/update-14-0-0/change-nx-json-presets.js +13 -13
- package/src/migrations/update-14-2-0/enable-source-analysis.js +14 -18
- package/src/migrations/update-14-8-0/change-run-commands-executor.js +7 -10
- package/src/migrations/update-15-7-0/split-configuration-into-project-json-files.js +3 -6
- package/src/migrations/update-16-0-0/fix-invalid-babelrc.js +2 -3
- package/src/migrations/update-16-0-0/move-workspace-generators-to-local-plugin.js +51 -60
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +3 -6
- package/src/utilities/buildable-libs-utils.js +3 -6
- package/src/utilities/default-base.js +1 -1
- package/src/utilities/get-import-path.js +1 -1
- package/src/utilities/run-tasks-in-serial.js +3 -4
- package/src/utilities/typescript/compilation.js +14 -13
- package/src/utils/rules/format-files.js +9 -7
- package/src/utils/rules/visit-not-ignored-files.js +2 -2
- package/src/utils/testing-utils.js +7 -14
- package/src/utils/workspace.js +26 -37
|
@@ -1,28 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.runCommandsSchematic = exports.runCommandsGenerator = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
function runCommandsGenerator(host, schema) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
yield (0, devkit_1.formatFiles)(host);
|
|
25
|
-
});
|
|
5
|
+
async function runCommandsGenerator(host, schema) {
|
|
6
|
+
const project = (0, devkit_1.readProjectConfiguration)(host, schema.project);
|
|
7
|
+
project.targets = project.targets || {};
|
|
8
|
+
project.targets[schema.name] = {
|
|
9
|
+
executor: 'nx:run-commands',
|
|
10
|
+
outputs: schema.outputs
|
|
11
|
+
? schema.outputs
|
|
12
|
+
.split(',')
|
|
13
|
+
.map((s) => (0, devkit_1.joinPathFragments)('{workspaceRoot}', s.trim()))
|
|
14
|
+
: [],
|
|
15
|
+
options: {
|
|
16
|
+
command: schema.command,
|
|
17
|
+
cwd: schema.cwd,
|
|
18
|
+
envFile: schema.envFile,
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
(0, devkit_1.updateProjectConfiguration)(host, schema.project, project);
|
|
22
|
+
await (0, devkit_1.formatFiles)(host);
|
|
26
23
|
}
|
|
27
24
|
exports.runCommandsGenerator = runCommandsGenerator;
|
|
28
25
|
exports.default = runCommandsGenerator;
|
|
@@ -16,6 +16,6 @@ function getNpmPackageVersion(packageName, packageVersion) {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
catch (err) { }
|
|
19
|
-
return packageVersion
|
|
19
|
+
return packageVersion ?? null;
|
|
20
20
|
}
|
|
21
21
|
exports.getNpmPackageVersion = getNpmPackageVersion;
|
|
@@ -4,7 +4,12 @@ exports.Preset = void 0;
|
|
|
4
4
|
var Preset;
|
|
5
5
|
(function (Preset) {
|
|
6
6
|
Preset["Apps"] = "apps";
|
|
7
|
+
// TODO(v18): Remove Empty and Core presets
|
|
8
|
+
/** @deprecated Use Apps instead
|
|
9
|
+
*/
|
|
7
10
|
Preset["Empty"] = "empty";
|
|
11
|
+
/** @deprecated Use NPM instead
|
|
12
|
+
*/
|
|
8
13
|
Preset["Core"] = "core";
|
|
9
14
|
Preset["NPM"] = "npm";
|
|
10
15
|
Preset["TS"] = "ts";
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
3
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
function default_1(host, schema) {
|
|
6
|
-
|
|
7
|
-
const message = (0, devkit_1.stripIndents) `Workspace Generators are no longer supported. Instead,
|
|
4
|
+
async function default_1(host, schema) {
|
|
5
|
+
const message = (0, devkit_1.stripIndents) `Workspace Generators are no longer supported. Instead,
|
|
8
6
|
Nx now supports executing generators or executors from local plugins. To get
|
|
9
7
|
started, install @nx/plugin and run \`nx g plugin\`.
|
|
10
8
|
|
|
@@ -12,7 +10,6 @@ function default_1(host, schema) {
|
|
|
12
10
|
\`nx g generator --project {my-plugin}\` to add a new generator.
|
|
13
11
|
|
|
14
12
|
For more information, see: https://nx.dev/deprecated/workspace-generators`;
|
|
15
|
-
|
|
16
|
-
});
|
|
13
|
+
throw new Error(message);
|
|
17
14
|
}
|
|
18
15
|
exports.default = default_1;
|
|
@@ -1,38 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.setTargetDependencies = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const devkit_1 = require("@nx/devkit");
|
|
6
5
|
const output_1 = require("../../utilities/output");
|
|
7
|
-
function setTargetDependencies(host) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
(0, devkit_1.updateNxJson)(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
|
-
});
|
|
6
|
+
async function setTargetDependencies(host) {
|
|
7
|
+
const config = (0, devkit_1.readNxJson)(host);
|
|
8
|
+
const strictlyOrderedTargets = config.tasksRunnerOptions?.['default']?.options
|
|
9
|
+
?.strictlyOrderedTargets || ['build'];
|
|
10
|
+
delete config.tasksRunnerOptions?.['default']?.options
|
|
11
|
+
?.strictlyOrderedTargets;
|
|
12
|
+
config.targetDependencies = config.targetDependencies ?? {};
|
|
13
|
+
const updatedStrictlyOrderedTargets = [];
|
|
14
|
+
strictlyOrderedTargets.forEach((target) => {
|
|
15
|
+
if (!config.targetDependencies[target]) {
|
|
16
|
+
config.targetDependencies[target] = [
|
|
17
|
+
{ target, projects: 'dependencies' },
|
|
18
|
+
];
|
|
19
|
+
updatedStrictlyOrderedTargets.push(target);
|
|
33
20
|
}
|
|
34
|
-
yield (0, devkit_1.formatFiles)(host);
|
|
35
21
|
});
|
|
22
|
+
(0, devkit_1.updateNxJson)(host, config);
|
|
23
|
+
if (updatedStrictlyOrderedTargets.length > 0) {
|
|
24
|
+
output_1.output.note({
|
|
25
|
+
title: 'Target dependencies have been updated in nx.json',
|
|
26
|
+
bodyLines: [
|
|
27
|
+
`Nx has deprecated strictlyOrderedTargets in favour of targetDependencies.`,
|
|
28
|
+
`Based on your configuration the migration has configured targetDependencies for the following targets: ${updatedStrictlyOrderedTargets.join(', ')}.`,
|
|
29
|
+
`Read more here: https://nx.dev/reference/project-configuration`,
|
|
30
|
+
],
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
await (0, devkit_1.formatFiles)(host);
|
|
36
34
|
}
|
|
37
35
|
exports.setTargetDependencies = setTargetDependencies;
|
|
38
36
|
exports.default = setTargetDependencies;
|
|
@@ -1,25 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
3
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
function update(tree) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
yield (0, devkit_1.formatFiles)(tree);
|
|
22
|
-
});
|
|
4
|
+
async function update(tree) {
|
|
5
|
+
const nxJson = (0, devkit_1.readJson)(tree, 'nx.json');
|
|
6
|
+
// updateProjectConfiguration automatically saves the project opts into workspace/project.json
|
|
7
|
+
if (nxJson.projects) {
|
|
8
|
+
Object.entries(nxJson.projects).forEach(([p, nxJsonConfiguration]) => {
|
|
9
|
+
const configuration = (0, devkit_1.readProjectConfiguration)(tree, p);
|
|
10
|
+
configuration.tags ??= nxJsonConfiguration.tags;
|
|
11
|
+
configuration.implicitDependencies ??=
|
|
12
|
+
nxJsonConfiguration.implicitDependencies;
|
|
13
|
+
(0, devkit_1.updateProjectConfiguration)(tree, p, configuration);
|
|
14
|
+
});
|
|
15
|
+
delete nxJson.projects;
|
|
16
|
+
}
|
|
17
|
+
(0, devkit_1.writeJson)(tree, 'nx.json', nxJson);
|
|
18
|
+
movePropertiesAreInNewLocations(tree); // move config options to new spots.
|
|
19
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
23
20
|
}
|
|
24
21
|
exports.default = update;
|
|
25
22
|
/**
|
|
@@ -1,29 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.setDefaultBaseIfNotSet = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const devkit_1 = require("@nx/devkit");
|
|
6
5
|
const output_1 = require("../../utilities/output");
|
|
7
|
-
function setDefaultBaseIfNotSet(host) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
(0, devkit_1.updateNxJson)(host, config);
|
|
25
|
-
yield (0, devkit_1.formatFiles)(host);
|
|
26
|
-
});
|
|
6
|
+
async function setDefaultBaseIfNotSet(host) {
|
|
7
|
+
const config = (0, devkit_1.readNxJson)(host);
|
|
8
|
+
if (!config.affected?.defaultBase) {
|
|
9
|
+
config.affected ??= {};
|
|
10
|
+
config.affected.defaultBase ??= 'master';
|
|
11
|
+
output_1.output.note({
|
|
12
|
+
title: 'Default Base has been set in nx.json',
|
|
13
|
+
bodyLines: [
|
|
14
|
+
`Nx is moving to "main" as the default branch.`,
|
|
15
|
+
`To avoid your current defaults changing, defaultBase has been set to "master" in nx.json`,
|
|
16
|
+
`Read more here: https://nx.dev/using-nx/affected`,
|
|
17
|
+
],
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
(0, devkit_1.updateNxJson)(host, config);
|
|
21
|
+
await (0, devkit_1.formatFiles)(host);
|
|
27
22
|
}
|
|
28
23
|
exports.setDefaultBaseIfNotSet = setDefaultBaseIfNotSet;
|
|
29
24
|
exports.default = setDefaultBaseIfNotSet;
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.updateDecorateAngularCLI = void 0;
|
|
4
4
|
function updateDecorateAngularCLI(host) {
|
|
5
|
-
|
|
6
|
-
const decorate = (_a = host.read('decorate-angular-cli.js')) === null || _a === void 0 ? void 0 : _a.toString();
|
|
5
|
+
const decorate = host.read('decorate-angular-cli.js')?.toString();
|
|
7
6
|
if (decorate) {
|
|
8
7
|
host.write('decorate-angular-cli.js', decorate.replace('@nrwl/cli/lib/decorate-cli', 'nx/src/adapter/decorate-cli'));
|
|
9
8
|
host.write('decorate-angular-cli.js', decorate.replace('nx/src/cli/decorate-cli', 'nx/src/adapter/decorate-cli'));
|
|
@@ -3,10 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.updateTasksRunner = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
function updateTasksRunner(host) {
|
|
6
|
-
var _a;
|
|
7
6
|
const config = (0, devkit_1.readNxJson)(host);
|
|
8
|
-
if (
|
|
9
|
-
|
|
7
|
+
if (config?.tasksRunnerOptions?.['default'] &&
|
|
8
|
+
config?.tasksRunnerOptions['default'].runner ==
|
|
10
9
|
'@nrwl/workspace/tasks-runners/default') {
|
|
11
10
|
config.tasksRunnerOptions['default'].runner = 'nx/tasks-runners/default';
|
|
12
11
|
}
|
|
@@ -1,26 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.setParallelDefault = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
function setParallelDefault(host) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
defaultTaskRunnerOptions.maxParallel || 3;
|
|
15
|
-
delete defaultTaskRunnerOptions.maxParallel;
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
defaultTaskRunnerOptions.parallel = 1;
|
|
19
|
-
}
|
|
20
|
-
(0, devkit_1.updateNxJson)(host, config);
|
|
5
|
+
async function setParallelDefault(host) {
|
|
6
|
+
const config = (0, devkit_1.readNxJson)(host);
|
|
7
|
+
const defaultTaskRunnerOptions = config.tasksRunnerOptions?.['default']?.options;
|
|
8
|
+
if (defaultTaskRunnerOptions) {
|
|
9
|
+
if (defaultTaskRunnerOptions.parallel) {
|
|
10
|
+
defaultTaskRunnerOptions.parallel =
|
|
11
|
+
defaultTaskRunnerOptions.maxParallel || 3;
|
|
12
|
+
delete defaultTaskRunnerOptions.maxParallel;
|
|
21
13
|
}
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
else {
|
|
15
|
+
defaultTaskRunnerOptions.parallel = 1;
|
|
16
|
+
}
|
|
17
|
+
(0, devkit_1.updateNxJson)(host, config);
|
|
18
|
+
}
|
|
19
|
+
await (0, devkit_1.formatFiles)(host);
|
|
24
20
|
}
|
|
25
21
|
exports.setParallelDefault = setParallelDefault;
|
|
26
22
|
exports.default = setParallelDefault;
|
|
@@ -1,30 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.updateTscExecutorLocation = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const devkit_1 = require("@nx/devkit");
|
|
6
5
|
const versions_1 = require("../../utils/versions");
|
|
7
|
-
function updateTscExecutorLocation(host) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
for (const [
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
used = true;
|
|
17
|
-
}
|
|
6
|
+
async function updateTscExecutorLocation(host) {
|
|
7
|
+
const projects = (0, devkit_1.getProjects)(host);
|
|
8
|
+
let used = false;
|
|
9
|
+
for (const [project, projectConfig] of projects.entries()) {
|
|
10
|
+
for (const [target, targetConfig] of Object.entries(projectConfig.targets || {})) {
|
|
11
|
+
if (targetConfig.executor === '@nrwl/workspace:tsc') {
|
|
12
|
+
projectConfig.targets[target].executor = '@nrwl/js:tsc';
|
|
13
|
+
(0, devkit_1.updateProjectConfiguration)(host, project, projectConfig);
|
|
14
|
+
used = true;
|
|
18
15
|
}
|
|
19
16
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
17
|
+
}
|
|
18
|
+
if (used) {
|
|
19
|
+
(0, devkit_1.addDependenciesToPackageJson)(host, {}, {
|
|
20
|
+
'@nrwl/js': versions_1.nxVersion,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
await (0, devkit_1.formatFiles)(host);
|
|
24
|
+
return () => (0, devkit_1.installPackagesTask)(host);
|
|
28
25
|
}
|
|
29
26
|
exports.updateTscExecutorLocation = updateTscExecutorLocation;
|
|
30
27
|
exports.default = updateTscExecutorLocation;
|
|
@@ -3,9 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.removeOldTaskRunnerOptions = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
function removeOldTaskRunnerOptions(host) {
|
|
6
|
-
var _a, _b;
|
|
7
6
|
const nxJson = (0, devkit_1.readNxJson)(host);
|
|
8
|
-
const options =
|
|
7
|
+
const options = nxJson.tasksRunnerOptions?.['default']?.options;
|
|
9
8
|
if (options) {
|
|
10
9
|
delete options.scan;
|
|
11
10
|
delete options.analytics;
|
|
@@ -4,11 +4,10 @@ exports.replaceTaoWithNx = void 0;
|
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
function replaceTaoWithNx(host) {
|
|
6
6
|
(0, devkit_1.updateJson)(host, 'package.json', (json) => {
|
|
7
|
-
|
|
8
|
-
if ((_a = json.dependencies) === null || _a === void 0 ? void 0 : _a['@nrwl/workspace']) {
|
|
7
|
+
if (json.dependencies?.['@nrwl/workspace']) {
|
|
9
8
|
json.dependencies['nx'] = json.dependencies['@nrwl/workspace'];
|
|
10
9
|
}
|
|
11
|
-
else if (
|
|
10
|
+
else if (json.devDependencies?.['@nrwl/workspace']) {
|
|
12
11
|
json.devDependencies['nx'] = json.devDependencies['@nrwl/workspace'];
|
|
13
12
|
}
|
|
14
13
|
removeTao(json.dependencies);
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.updateDecorateAngularCLI = void 0;
|
|
4
4
|
function updateDecorateAngularCLI(host) {
|
|
5
|
-
|
|
6
|
-
const decorate = (_a = host.read('decorate-angular-cli.js')) === null || _a === void 0 ? void 0 : _a.toString();
|
|
5
|
+
const decorate = host.read('decorate-angular-cli.js')?.toString();
|
|
7
6
|
if (decorate) {
|
|
8
7
|
host.write('decorate-angular-cli.js', decorate.replace('@nrwl/cli/lib/decorate-cli', 'nx/src/cli/decorate-cli'));
|
|
9
8
|
}
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.changeNpmScriptExecutor = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const devkit_1 = require("@nx/devkit");
|
|
6
5
|
const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
|
|
7
|
-
function changeNpmScriptExecutor(tree) {
|
|
8
|
-
|
|
9
|
-
(0,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
(0, devkit_1.updateProjectConfiguration)(tree, project, projectConfig);
|
|
14
|
-
});
|
|
15
|
-
yield (0, devkit_1.formatFiles)(tree);
|
|
6
|
+
async function changeNpmScriptExecutor(tree) {
|
|
7
|
+
(0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nrwl/workspace:run-script', (currentValue, project, target) => {
|
|
8
|
+
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, project);
|
|
9
|
+
const targetConfig = projectConfig.targets[target];
|
|
10
|
+
targetConfig.executor = 'nx:run-script';
|
|
11
|
+
(0, devkit_1.updateProjectConfiguration)(tree, project, projectConfig);
|
|
16
12
|
});
|
|
13
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
17
14
|
}
|
|
18
15
|
exports.changeNpmScriptExecutor = changeNpmScriptExecutor;
|
|
19
16
|
exports.default = changeNpmScriptExecutor;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.changeNxJsonPresets = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
function changeNxJsonPresets(tree) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
5
|
+
async function changeNxJsonPresets(tree) {
|
|
6
|
+
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
7
|
+
const replacements = {
|
|
8
|
+
'@nrwl/workspace/presets/npm.json': 'nx/presets/npm.json',
|
|
9
|
+
'@nrwl/workspace/presets/core.json': 'nx/presets/core.json',
|
|
10
|
+
};
|
|
11
|
+
if (nxJson.extends && replacements[nxJson.extends]) {
|
|
12
|
+
(0, devkit_1.updateNxJson)(tree, {
|
|
13
|
+
...nxJson,
|
|
14
|
+
extends: replacements[nxJson.extends],
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
18
18
|
}
|
|
19
19
|
exports.changeNxJsonPresets = changeNxJsonPresets;
|
|
20
20
|
exports.default = changeNxJsonPresets;
|
|
@@ -1,27 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.enableSourceAnalysis = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
function enableSourceAnalysis(tree) {
|
|
7
|
-
|
|
8
|
-
(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
config.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
(_a = config.pluginsConfig)['@nrwl/js'] || (_a['@nrwl/js'] = {});
|
|
18
|
-
config.pluginsConfig['@nrwl/js'].analyzeSourceFiles = true;
|
|
19
|
-
}
|
|
5
|
+
async function enableSourceAnalysis(tree) {
|
|
6
|
+
(0, devkit_1.updateJson)(tree, 'nx.json', (config) => {
|
|
7
|
+
if (config.extends === 'nx/presets/core.json' ||
|
|
8
|
+
config.extends === 'nx/presets/npm.json') {
|
|
9
|
+
const explicitlyDisabled = config.pluginsConfig &&
|
|
10
|
+
config.pluginsConfig['@nrwl/js'] &&
|
|
11
|
+
config.pluginsConfig['@nrwl/js'].analyzeSourceFiles === false;
|
|
12
|
+
if (!explicitlyDisabled) {
|
|
13
|
+
config.pluginsConfig ||= {};
|
|
14
|
+
config.pluginsConfig['@nrwl/js'] ||= {};
|
|
15
|
+
config.pluginsConfig['@nrwl/js'].analyzeSourceFiles = true;
|
|
20
16
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
yield (0, devkit_1.formatFiles)(tree);
|
|
17
|
+
}
|
|
18
|
+
return config;
|
|
24
19
|
});
|
|
20
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
25
21
|
}
|
|
26
22
|
exports.enableSourceAnalysis = enableSourceAnalysis;
|
|
27
23
|
exports.default = enableSourceAnalysis;
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.changeRunCommandsExecutor = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const devkit_1 = require("@nx/devkit");
|
|
6
5
|
const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
|
|
7
|
-
function changeRunCommandsExecutor(tree) {
|
|
8
|
-
|
|
9
|
-
(0,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
(0, devkit_1.updateProjectConfiguration)(tree, project, projectConfig);
|
|
14
|
-
});
|
|
15
|
-
yield (0, devkit_1.formatFiles)(tree);
|
|
6
|
+
async function changeRunCommandsExecutor(tree) {
|
|
7
|
+
(0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nrwl/workspace:run-commands', (currentValue, project, target) => {
|
|
8
|
+
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, project);
|
|
9
|
+
const targetConfig = projectConfig.targets[target];
|
|
10
|
+
targetConfig.executor = 'nx:run-commands';
|
|
11
|
+
(0, devkit_1.updateProjectConfiguration)(tree, project, projectConfig);
|
|
16
12
|
});
|
|
13
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
17
14
|
}
|
|
18
15
|
exports.changeRunCommandsExecutor = changeRunCommandsExecutor;
|
|
19
16
|
exports.default = changeRunCommandsExecutor;
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.splitConfigurationIntoProjectJsonFiles = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const devkit_1 = require("@nx/devkit");
|
|
6
5
|
const convert_to_nx_project_1 = require("../../generators/convert-to-nx-project/convert-to-nx-project");
|
|
7
|
-
function splitConfigurationIntoProjectJsonFiles(tree) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
yield (0, devkit_1.formatFiles)(tree);
|
|
11
|
-
});
|
|
6
|
+
async function splitConfigurationIntoProjectJsonFiles(tree) {
|
|
7
|
+
await (0, convert_to_nx_project_1.default)(tree, { all: true });
|
|
8
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
12
9
|
}
|
|
13
10
|
exports.splitConfigurationIntoProjectJsonFiles = splitConfigurationIntoProjectJsonFiles;
|
|
14
11
|
exports.default = splitConfigurationIntoProjectJsonFiles;
|
|
@@ -5,18 +5,17 @@ function update(tree) {
|
|
|
5
5
|
const projects = (0, devkit_1.getProjects)(tree);
|
|
6
6
|
const packageJson = (0, devkit_1.readJson)(tree, 'package.json');
|
|
7
7
|
// In case user installed as prod dep.
|
|
8
|
-
const deps =
|
|
8
|
+
const deps = { ...packageJson.dependencies, ...packageJson.devDependencies };
|
|
9
9
|
// If web package is installed, skip update.
|
|
10
10
|
if (deps['@nrwl/web'] || deps['@nx/web']) {
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
13
13
|
projects.forEach((config, name) => {
|
|
14
|
-
var _a;
|
|
15
14
|
const babelRcPath = (0, devkit_1.joinPathFragments)(config.root, '.babelrc');
|
|
16
15
|
if (!tree.exists(babelRcPath))
|
|
17
16
|
return;
|
|
18
17
|
const babelRc = (0, devkit_1.readJson)(tree, babelRcPath);
|
|
19
|
-
const nrwlWebBabelPresetIdx =
|
|
18
|
+
const nrwlWebBabelPresetIdx = babelRc.presets?.findIndex((p) =>
|
|
20
19
|
// Babel preset could be specified as a string or a tuple with options.
|
|
21
20
|
// Account for rescope migration running before or after this one.
|
|
22
21
|
Array.isArray(p)
|