@nx/angular 23.2.0-beta.1 → 23.2.0-beta.11
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/README.md +2 -2
- package/dist/src/builders/dev-server/dev-server.impl.js +6 -8
- package/dist/src/builders/webpack-browser/webpack-browser.impl.js +5 -6
- package/dist/src/executors/application/application.impl.js +1 -1
- package/dist/src/executors/browser-esbuild/browser-esbuild.impl.js +1 -1
- package/dist/src/executors/extract-i18n/extract-i18n.impl.js +3 -3
- package/dist/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +1 -1
- package/dist/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js +2 -3
- package/dist/src/executors/package/schema.d.ts +1 -2
- package/dist/src/executors/unit-test/unit-test.impl.js +1 -1
- package/dist/src/generators/add-linting/add-linting.js +44 -22
- package/dist/src/generators/add-linting/schema.d.ts +7 -0
- package/dist/src/generators/add-linting/schema.json +15 -4
- package/dist/src/generators/application/lib/add-e2e.js +3 -2
- package/dist/src/generators/application/lib/add-linting.js +3 -1
- package/dist/src/generators/application/lib/create-files.js +3 -3
- package/dist/src/generators/application/lib/normalize-options.js +5 -1
- package/dist/src/generators/application/lib/normalized-schema.d.ts +2 -2
- package/dist/src/generators/application/lib/set-generator-defaults.js +3 -1
- package/dist/src/generators/application/schema.d.ts +7 -2
- package/dist/src/generators/application/schema.json +15 -5
- package/dist/src/generators/component-test/component-test.js +2 -0
- package/dist/src/generators/convert-to-rspack/convert-to-rspack.js +1 -5
- package/dist/src/generators/cypress-component-configuration/cypress-component-configuration.js +2 -0
- package/dist/src/generators/host/host.js +7 -1
- package/dist/src/generators/host/schema.d.ts +6 -2
- package/dist/src/generators/host/schema.json +10 -5
- package/dist/src/generators/library/lib/create-files.js +3 -0
- package/dist/src/generators/library/lib/normalize-options.js +4 -2
- package/dist/src/generators/library/lib/normalized-schema.d.ts +6 -2
- package/dist/src/generators/library/lib/set-generator-defaults.js +5 -1
- package/dist/src/generators/library/library.js +5 -3
- package/dist/src/generators/library/schema.d.ts +6 -2
- package/dist/src/generators/library/schema.json +10 -5
- package/dist/src/generators/ng-add/migrators/projects/lib.migrator.js +1 -2
- package/dist/src/generators/ng-add/schema.d.ts +2 -2
- package/dist/src/generators/ng-add/schema.json +1 -3
- package/dist/src/generators/ng-add/utilities/format-files-task.js +2 -2
- package/dist/src/generators/ng-add/utilities/projects.js +2 -2
- package/dist/src/generators/ng-add/utilities/workspace.js +3 -4
- package/dist/src/generators/remote/remote.js +4 -3
- package/dist/src/generators/remote/schema.d.ts +6 -2
- package/dist/src/generators/remote/schema.json +10 -5
- package/dist/src/generators/scam-to-standalone/lib/get-component-data-from-ast.d.ts +1 -1
- package/dist/src/generators/scam-to-standalone/lib/get-target-project.d.ts +1 -1
- package/dist/src/generators/scam-to-standalone/lib/replace-module-usages-with-component.d.ts +1 -1
- package/dist/src/generators/setup-mf/lib/generate-config.js +2 -1
- package/dist/src/generators/setup-mf/schema.d.ts +4 -0
- package/dist/src/generators/setup-mf/schema.json +8 -2
- package/dist/src/generators/storybook-configuration/schema.d.ts +2 -2
- package/dist/src/generators/storybook-configuration/schema.json +1 -2
- package/dist/src/generators/utils/add-vitest.js +1 -2
- package/dist/src/generators/utils/tsconfig-utils.js +2 -7
- package/dist/src/migrations/update-20-2-0/migrate-mf-imports-to-new-package.js +2 -3
- package/dist/src/migrations/update-21-0-0/change-data-persistence-operators-imports-to-ngrx-router-store-data-persistence.js +3 -4
- package/dist/src/plugins/plugin.js +2 -4
- package/dist/src/utils/assert-cypress-component-testing-support.d.ts +6 -0
- package/dist/src/utils/assert-cypress-component-testing-support.js +31 -0
- package/dist/src/utils/versions.d.ts +4 -4
- package/dist/src/utils/versions.js +4 -4
- package/generators.json +1 -1
- package/migrations.json +161 -0
- package/package.json +19 -12
package/README.md
CHANGED
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
|
|
8
8
|
<div style="text-align: center;">
|
|
9
9
|
|
|
10
|
-
[]()
|
|
10
|
+
[](<>)
|
|
11
11
|
[](https://www.npmjs.com/package/nx)
|
|
12
|
-
[]()
|
|
12
|
+
[](<>)
|
|
13
13
|
[](http://commitizen.github.io/cz-cli/)
|
|
14
14
|
[](https://go.nx.dev/community)
|
|
15
15
|
[](https://nx.dev/docs/features/ci-features/sandboxing)
|
|
@@ -4,17 +4,15 @@ exports.executeDevServerBuilder = executeDevServerBuilder;
|
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const js_1 = require("@nx/js");
|
|
6
6
|
const fs_1 = require("fs");
|
|
7
|
-
const configuration_1 = require("nx/src/config/configuration");
|
|
8
|
-
const operators_1 = require("nx/src/project-graph/operators");
|
|
9
|
-
const project_graph_1 = require("nx/src/project-graph/project-graph");
|
|
10
7
|
const path_1 = require("path");
|
|
11
8
|
const rxjs_1 = require("rxjs");
|
|
12
|
-
const
|
|
9
|
+
const operators_1 = require("rxjs/operators");
|
|
13
10
|
const builder_package_1 = require("../../executors/utilities/builder-package");
|
|
14
11
|
const esbuild_extensions_1 = require("../../executors/utilities/esbuild-extensions");
|
|
15
12
|
const patch_builder_context_1 = require("../../executors/utilities/patch-builder-context");
|
|
16
13
|
const buildable_libs_1 = require("../utilities/buildable-libs");
|
|
17
14
|
const lib_1 = require("./lib");
|
|
15
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
18
16
|
function executeDevServerBuilder(rawOptions, context) {
|
|
19
17
|
(0, lib_1.validateOptions)(rawOptions);
|
|
20
18
|
process.env.NX_TSCONFIG_PATH = (0, js_1.getRootTsConfigPath)();
|
|
@@ -26,10 +24,10 @@ function executeDevServerBuilder(rawOptions, context) {
|
|
|
26
24
|
projectName: context.target.project,
|
|
27
25
|
projectsConfigurations: (0, devkit_1.readProjectsConfigurationFromProjectGraph)(projectGraph),
|
|
28
26
|
root: context.workspaceRoot,
|
|
29
|
-
nxJsonConfiguration: (0,
|
|
27
|
+
nxJsonConfiguration: (0, internal_1.readNxJsonFromDisk)(devkit_1.workspaceRoot),
|
|
30
28
|
isVerbose: false,
|
|
31
29
|
});
|
|
32
|
-
const browserTargetProjectConfiguration = (0,
|
|
30
|
+
const browserTargetProjectConfiguration = (0, internal_1.readCachedProjectConfiguration)(parsedBuildTarget.project);
|
|
33
31
|
const buildTarget = browserTargetProjectConfiguration.targets[parsedBuildTarget.target];
|
|
34
32
|
const buildTargetOptions = {
|
|
35
33
|
...buildTarget.options,
|
|
@@ -106,12 +104,12 @@ function executeDevServerBuilder(rawOptions, context) {
|
|
|
106
104
|
(0, rxjs_1.from)((0, esbuild_extensions_1.loadPlugins)(buildTargetOptions.plugins, buildTargetOptions.tsConfig)),
|
|
107
105
|
(0, rxjs_1.from)((0, esbuild_extensions_1.loadMiddleware)(options.esbuildMiddleware, buildTargetOptions.tsConfig)),
|
|
108
106
|
(0, rxjs_1.from)(loadIndexHtmlFileTransformer(pathToIndexFileTransformer, buildTargetOptions.tsConfig, context, isUsingWebpackBuilder)),
|
|
109
|
-
]).pipe((0,
|
|
107
|
+
]).pipe((0, operators_1.switchMap)(([{ executeDevServerBuilder }, plugins, middleware, indexHtmlTransformer,]) => executeDevServerBuilder(delegateBuilderOptions, context, {
|
|
110
108
|
webpackConfiguration: isUsingWebpackBuilder
|
|
111
109
|
? async (baseWebpackConfig) => {
|
|
112
110
|
if (!buildLibsFromSource) {
|
|
113
111
|
const workspaceDependencies = dependencies
|
|
114
|
-
.filter((dep) => !(0,
|
|
112
|
+
.filter((dep) => !(0, internal_1.isNpmProject)(dep.node))
|
|
115
113
|
.map((dep) => dep.node.name);
|
|
116
114
|
// default for `nx run-many` is --all projects
|
|
117
115
|
// by passing an empty string for --projects, run-many will default to
|
|
@@ -3,13 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.executeWebpackBrowserBuilder = executeWebpackBrowserBuilder;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const fs_1 = require("fs");
|
|
6
|
-
const operators_1 = require("nx/src/project-graph/operators");
|
|
7
|
-
const utils_1 = require("nx/src/tasks-runner/utils");
|
|
8
6
|
const path_1 = require("path");
|
|
9
7
|
const rxjs_1 = require("rxjs");
|
|
10
|
-
const
|
|
8
|
+
const operators_1 = require("rxjs/operators");
|
|
11
9
|
const builder_package_1 = require("../../executors/utilities/builder-package");
|
|
12
10
|
const buildable_libs_1 = require("../utilities/buildable-libs");
|
|
11
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
13
12
|
// This is required to ensure that the webpack version used by the Module Federation is the same as the one used by the builders.
|
|
14
13
|
const Module = require('module');
|
|
15
14
|
const originalResolveFilename = Module._resolveFilename;
|
|
@@ -34,7 +33,7 @@ function shouldSkipInitialTargetRun(projectGraph, project, target) {
|
|
|
34
33
|
allTargetNames.add(targetName);
|
|
35
34
|
}
|
|
36
35
|
}
|
|
37
|
-
const projectDependencyConfigs = (0,
|
|
36
|
+
const projectDependencyConfigs = (0, internal_1.getDependencyConfigs)({ project, target }, {}, projectGraph, Array.from(allTargetNames));
|
|
38
37
|
// if the task runner already ran the target, skip the initial run
|
|
39
38
|
return projectDependencyConfigs.some((d) => d.target === target && d.projects === 'dependencies');
|
|
40
39
|
}
|
|
@@ -69,11 +68,11 @@ function executeWebpackBrowserBuilder(options, context) {
|
|
|
69
68
|
import('@angular-devkit/build-angular'),
|
|
70
69
|
import('@nx/webpack/internal'),
|
|
71
70
|
import('../utilities/webpack.js'),
|
|
72
|
-
])).pipe((0,
|
|
71
|
+
])).pipe((0, operators_1.switchMap)(([{ executeBrowserBuilder }, { WebpackNxBuildCoordinationPlugin }, { mergeCustomWebpackConfig, resolveIndexHtmlTransformer },]) => executeBrowserBuilder(delegateBuilderOptions, context, {
|
|
73
72
|
webpackConfiguration: (baseWebpackConfig) => {
|
|
74
73
|
if (!buildLibsFromSource && delegateBuilderOptions.watch) {
|
|
75
74
|
const workspaceDependencies = dependencies
|
|
76
|
-
.filter((dep) => !(0,
|
|
75
|
+
.filter((dep) => !(0, internal_1.isNpmProject)(dep.node))
|
|
77
76
|
.map((dep) => dep.node.name);
|
|
78
77
|
// default for `nx run-many` is --all projects
|
|
79
78
|
// by passing an empty string for --projects, run-many will default to
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = applicationExecutor;
|
|
4
|
-
const ngcli_adapter_1 = require("nx/src/adapter/ngcli-adapter");
|
|
5
4
|
const buildable_libs_1 = require("../utilities/buildable-libs");
|
|
6
5
|
const builder_package_1 = require("../utilities/builder-package");
|
|
7
6
|
const esbuild_extensions_1 = require("../utilities/esbuild-extensions");
|
|
8
7
|
const normalize_options_1 = require("./utils/normalize-options");
|
|
9
8
|
const validate_options_1 = require("./utils/validate-options");
|
|
9
|
+
const ngcli_adapter_1 = require("@nx/devkit/ngcli-adapter");
|
|
10
10
|
async function* applicationExecutor(options, context) {
|
|
11
11
|
(0, validate_options_1.validateOptions)(options);
|
|
12
12
|
const { buildLibsFromSource = true, plugins: pluginPaths, indexHtmlTransformer: indexHtmlTransformerPath, ...delegateExecutorOptions } = (0, normalize_options_1.normalizeOptions)(options);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = esbuildExecutor;
|
|
4
|
-
const ngcli_adapter_1 = require("nx/src/adapter/ngcli-adapter");
|
|
5
4
|
const buildable_libs_1 = require("../utilities/buildable-libs");
|
|
6
5
|
const esbuild_extensions_1 = require("../utilities/esbuild-extensions");
|
|
6
|
+
const ngcli_adapter_1 = require("@nx/devkit/ngcli-adapter");
|
|
7
7
|
async function* esbuildExecutor(options, context) {
|
|
8
8
|
options.buildLibsFromSource ??= true;
|
|
9
9
|
const { buildLibsFromSource, plugins: pluginPaths, ...delegateExecutorOptions } = options;
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = extractI18nExecutor;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const ngcli_adapter_1 = require("nx/src/adapter/ngcli-adapter");
|
|
6
|
-
const project_graph_1 = require("nx/src/project-graph/project-graph");
|
|
7
5
|
const builder_package_1 = require("../utilities/builder-package");
|
|
8
6
|
const patch_builder_context_1 = require("../utilities/patch-builder-context");
|
|
7
|
+
const ngcli_adapter_1 = require("@nx/devkit/ngcli-adapter");
|
|
8
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
9
9
|
async function* extractI18nExecutor(options, context) {
|
|
10
10
|
const parsedBuildTarget = (0, devkit_1.parseTargetString)(options.buildTarget, context);
|
|
11
|
-
const buildTargetProjectConfiguration = (0,
|
|
11
|
+
const buildTargetProjectConfiguration = (0, internal_1.readCachedProjectConfiguration)(parsedBuildTarget.project);
|
|
12
12
|
const buildTarget = buildTargetProjectConfiguration.targets[parsedBuildTarget.target];
|
|
13
13
|
const isUsingEsbuildBuilder = [
|
|
14
14
|
'@angular/build:application',
|
package/dist/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js
CHANGED
|
@@ -6,12 +6,12 @@ const devkit_1 = require("@nx/devkit");
|
|
|
6
6
|
const builder_package_1 = require("../utilities/builder-package");
|
|
7
7
|
const lib_1 = require("./lib");
|
|
8
8
|
const internal_2 = require("@nx/web/internal");
|
|
9
|
-
const ngcli_adapter_1 = require("nx/src/adapter/ngcli-adapter");
|
|
10
9
|
const dev_server_impl_1 = require("../../builders/dev-server/dev-server.impl");
|
|
11
10
|
const module_federation_1 = require("../../builders/utilities/module-federation");
|
|
12
11
|
const path_1 = require("path");
|
|
13
12
|
const fs_1 = require("fs");
|
|
14
13
|
const module_federation_deprecation_1 = require("../../utils/module-federation-deprecation");
|
|
14
|
+
const ngcli_adapter_1 = require("@nx/devkit/ngcli-adapter");
|
|
15
15
|
// This is required to ensure that the webpack version used by the Module Federation is the same as the one used by the builders.
|
|
16
16
|
const Module = require('module');
|
|
17
17
|
const originalResolveFilename = Module._resolveFilename;
|
package/dist/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js
CHANGED
|
@@ -5,14 +5,13 @@ const devkit_1 = require("@nx/devkit");
|
|
|
5
5
|
const internal_1 = require("@nx/devkit/internal");
|
|
6
6
|
const internal_2 = require("@nx/web/internal");
|
|
7
7
|
const fs_1 = require("fs");
|
|
8
|
-
const ngcli_adapter_1 = require("nx/src/adapter/ngcli-adapter");
|
|
9
|
-
const project_graph_1 = require("nx/src/project-graph/project-graph");
|
|
10
8
|
const path_1 = require("path");
|
|
11
9
|
const module_federation_1 = require("../../builders/utilities/module-federation");
|
|
12
10
|
const builder_package_1 = require("../utilities/builder-package");
|
|
13
11
|
const normalize_options_1 = require("./lib/normalize-options");
|
|
14
12
|
const start_dev_remotes_1 = require("./lib/start-dev-remotes");
|
|
15
13
|
const module_federation_deprecation_1 = require("../../utils/module-federation-deprecation");
|
|
14
|
+
const ngcli_adapter_1 = require("@nx/devkit/ngcli-adapter");
|
|
16
15
|
// This is required to ensure that the webpack version used by the Module Federation is the same as the one used by the builders.
|
|
17
16
|
const Module = require('module');
|
|
18
17
|
const originalResolveFilename = Module._resolveFilename;
|
|
@@ -44,7 +43,7 @@ async function* moduleFederationSsrDevServerExecutor(schema, context) {
|
|
|
44
43
|
if (options.isInitialHost === false) {
|
|
45
44
|
return yield* currIter;
|
|
46
45
|
}
|
|
47
|
-
const { projects: workspaceProjects } = (0,
|
|
46
|
+
const { projects: workspaceProjects } = (0, devkit_1.readProjectsConfigurationFromProjectGraph)(context.projectGraph);
|
|
48
47
|
const project = workspaceProjects[context.projectName];
|
|
49
48
|
let pathToManifestFile;
|
|
50
49
|
if (options.pathToManifestFile) {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { NgPackagrBuilderOptions } from '@angular-devkit/build-angular';
|
|
2
2
|
|
|
3
|
-
export interface BuildAngularLibraryExecutorOptions
|
|
4
|
-
extends NgPackagrBuilderOptions {
|
|
3
|
+
export interface BuildAngularLibraryExecutorOptions extends NgPackagrBuilderOptions {
|
|
5
4
|
project?: string;
|
|
6
5
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = unitTestExecutor;
|
|
4
|
-
const ngcli_adapter_1 = require("nx/
|
|
4
|
+
const ngcli_adapter_1 = require("@nx/devkit/ngcli-adapter");
|
|
5
5
|
const targets_1 = require("../../utils/targets");
|
|
6
6
|
const semver_1 = require("semver");
|
|
7
7
|
const angular_version_utils_1 = require("../utilities/angular-version-utils");
|
|
@@ -3,40 +3,46 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.addLintingGenerator = addLintingGenerator;
|
|
4
4
|
const internal_1 = require("@nx/devkit/internal");
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
const
|
|
6
|
+
const internal_2 = require("@nx/js/internal");
|
|
7
7
|
const assert_supported_angular_version_1 = require("../../utils/assert-supported-angular-version");
|
|
8
|
-
const
|
|
8
|
+
const internal_3 = require("@nx/eslint/internal");
|
|
9
9
|
const add_angular_eslint_dependencies_1 = require("./lib/add-angular-eslint-dependencies");
|
|
10
10
|
const buildable_project_1 = require("./lib/buildable-project");
|
|
11
11
|
async function addLintingGenerator(tree, options) {
|
|
12
12
|
(0, assert_supported_angular_version_1.assertSupportedAngularVersion)(tree);
|
|
13
13
|
const tasks = [];
|
|
14
14
|
const rootProject = options.projectRoot === '.' || options.projectRoot === '';
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
// Resolved once, up front: `undefined !== 'eslint'` is true, so an unresolved
|
|
16
|
+
// linter would take the early return below and skip the angular-eslint arm.
|
|
17
|
+
// Callers that already resolved it pass it in, so this only prompts when the
|
|
18
|
+
// generator is run directly.
|
|
19
|
+
const linter = await (0, internal_2.normalizeLinterOption)(tree, options.linter);
|
|
20
|
+
tasks.push(await (0, internal_2.addLintingToProject)(tree, {
|
|
21
|
+
linter,
|
|
17
22
|
project: options.projectName,
|
|
18
23
|
tsConfigPaths: [
|
|
19
24
|
(0, devkit_1.joinPathFragments)(options.projectRoot, 'tsconfig.app.json'),
|
|
20
25
|
],
|
|
21
26
|
unitTestRunner: options.unitTestRunner,
|
|
22
|
-
|
|
23
|
-
skipFormat: true,
|
|
27
|
+
enableTypedLinting: (0, internal_3.isTypedLintingEnabled)(options),
|
|
24
28
|
rootProject: rootProject,
|
|
25
29
|
addPlugin: options.addPlugin ?? false,
|
|
26
30
|
addExplicitTargets: true,
|
|
27
31
|
skipPackageJson: options.skipPackageJson,
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
(0,
|
|
32
|
+
}));
|
|
33
|
+
// The angular-eslint presets, selector rules and dependency install below have
|
|
34
|
+
// no equivalent in other linters. Only the formatting tail is shared.
|
|
35
|
+
if (linter !== 'eslint') {
|
|
36
|
+
if (!options.skipFormat) {
|
|
37
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
38
|
+
}
|
|
39
|
+
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
40
|
+
}
|
|
41
|
+
if ((0, internal_3.isEslintConfigSupported)(tree)) {
|
|
42
|
+
if ((0, internal_3.useFlatConfig)(tree)) {
|
|
43
|
+
(0, internal_3.addPredefinedConfigToFlatLintConfig)(tree, options.projectRoot, 'flat/angular', { checkBaseConfig: true });
|
|
44
|
+
(0, internal_3.addPredefinedConfigToFlatLintConfig)(tree, options.projectRoot, 'flat/angular-template', { checkBaseConfig: true });
|
|
45
|
+
(0, internal_3.addOverrideToLintConfig)(tree, options.projectRoot, {
|
|
40
46
|
files: ['*.ts'],
|
|
41
47
|
rules: {
|
|
42
48
|
'@angular-eslint/directive-selector': [
|
|
@@ -57,17 +63,33 @@ async function addLintingGenerator(tree, options) {
|
|
|
57
63
|
],
|
|
58
64
|
},
|
|
59
65
|
});
|
|
60
|
-
(0,
|
|
66
|
+
(0, internal_3.addOverrideToLintConfig)(tree, options.projectRoot, {
|
|
61
67
|
files: ['*.html'],
|
|
62
68
|
rules: {},
|
|
63
69
|
});
|
|
64
70
|
}
|
|
65
71
|
else {
|
|
66
|
-
|
|
67
|
-
|
|
72
|
+
// Legacy `.eslintrc` overrides are fully replaced below, which would drop
|
|
73
|
+
// an existing `parserOptions.project`. Detect it first so we can carry it
|
|
74
|
+
// over. (Flat configs keep typed linting via `lintProjectGenerator`, so
|
|
75
|
+
// this is only needed on the legacy stack.)
|
|
76
|
+
const eslintFile = (0, internal_3.findEslintFile)(tree, options.projectRoot);
|
|
77
|
+
const eslintFileContent = eslintFile
|
|
78
|
+
? tree.read((0, devkit_1.joinPathFragments)(options.projectRoot, eslintFile), 'utf8')
|
|
79
|
+
: null;
|
|
80
|
+
const typedLinting = eslintFileContent
|
|
81
|
+
? (0, internal_3.inspectTypedLinting)(eslintFileContent)
|
|
82
|
+
: null;
|
|
83
|
+
// Only a `project` needs carrying over. A config running the project
|
|
84
|
+
// service needs no glob and typescript-eslint rejects one next to it.
|
|
85
|
+
const carryOverProject = !!typedLinting?.project && !typedLinting.projectService;
|
|
86
|
+
(0, internal_3.replaceOverridesInLintConfig)(tree, options.projectRoot, [
|
|
87
|
+
...(rootProject ? [internal_3.typeScriptOverride, internal_3.javaScriptOverride] : []),
|
|
68
88
|
{
|
|
69
89
|
files: ['*.ts'],
|
|
70
|
-
|
|
90
|
+
// Legacy `.eslintrc` is JSON, which can't express the `__dirname`
|
|
91
|
+
// that `tsconfigRootDir` needs, so it keeps `parserOptions.project`.
|
|
92
|
+
...(carryOverProject
|
|
71
93
|
? {
|
|
72
94
|
parserOptions: {
|
|
73
95
|
project: [`${options.projectRoot}/tsconfig.*?.json`],
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
import type { LinterType } from '@nx/js';
|
|
2
|
+
|
|
1
3
|
export interface AddLintingGeneratorSchema {
|
|
4
|
+
linter?: LinterType;
|
|
2
5
|
projectName: string;
|
|
3
6
|
projectRoot: string;
|
|
4
7
|
prefix: string;
|
|
8
|
+
enableTypedLinting?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated Use `enableTypedLinting` instead. This option will be removed in Nx v24.
|
|
11
|
+
*/
|
|
5
12
|
setParserOptionsProject?: boolean;
|
|
6
13
|
skipFormat?: boolean;
|
|
7
14
|
skipPackageJson?: boolean;
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
"$schema": "https://json-schema.org/schema",
|
|
3
3
|
"$id": "NxAngularAddLintingGenerator",
|
|
4
4
|
"title": "Add linting to an Angular project.",
|
|
5
|
-
"description": "Adds linting configuration to an Angular project.",
|
|
5
|
+
"description": "Adds linting configuration to an Angular project, using the linter the workspace already uses. Adds nothing when the workspace has no linter and none is selected.",
|
|
6
6
|
"cli": "nx",
|
|
7
7
|
"type": "object",
|
|
8
8
|
"examples": [
|
|
9
9
|
{
|
|
10
10
|
"command": "nx g @nx/angular:add-linting --prefix=cool --projectName=cool-lib --projectRoot=libs/cool-lib",
|
|
11
|
-
"description": "
|
|
11
|
+
"description": "Sets up linting for an existing project named `cool-lib` using the linter the workspace already uses. The Angular-specific rules and the [prefix](https://angular.dev/style-guide#style-02-07) `cool` apply to ESLint only"
|
|
12
12
|
}
|
|
13
13
|
],
|
|
14
14
|
"properties": {
|
|
@@ -28,11 +28,22 @@
|
|
|
28
28
|
"description": "The path to the root of the selected project.",
|
|
29
29
|
"x-priority": "important"
|
|
30
30
|
},
|
|
31
|
-
"
|
|
31
|
+
"linter": {
|
|
32
|
+
"description": "The tool to use for running lint checks. Defaults to the linter the workspace already uses.",
|
|
33
|
+
"type": "string",
|
|
34
|
+
"enum": ["eslint", "oxlint", "none"]
|
|
35
|
+
},
|
|
36
|
+
"enableTypedLinting": {
|
|
32
37
|
"type": "boolean",
|
|
33
|
-
"description": "Whether
|
|
38
|
+
"description": "Whether to enable typed linting. For flat configs, this configures the recommended `parserOptions.projectService` and `tsconfigRootDir`. For legacy `.eslintrc` configs, this configures `parserOptions.project`. We do not enable this by default for lint performance reasons.",
|
|
34
39
|
"default": false
|
|
35
40
|
},
|
|
41
|
+
"setParserOptionsProject": {
|
|
42
|
+
"type": "boolean",
|
|
43
|
+
"description": "Deprecated alias for `enableTypedLinting`.",
|
|
44
|
+
"default": false,
|
|
45
|
+
"x-deprecated": "Use `enableTypedLinting` instead. This option will be removed in Nx v24."
|
|
46
|
+
},
|
|
36
47
|
"skipFormat": {
|
|
37
48
|
"type": "boolean",
|
|
38
49
|
"description": "Skip formatting files.",
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addE2e = addE2e;
|
|
4
|
-
const internal_1 = require("@nx/devkit/internal");
|
|
5
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
6
|
+
const internal_2 = require("@nx/eslint/internal");
|
|
6
7
|
const versions_1 = require("../../../utils/versions");
|
|
7
8
|
async function addE2e(tree, options) {
|
|
8
9
|
// since e2e are separate projects, default to adding plugins
|
|
@@ -54,7 +55,7 @@ async function addE2e(tree, options) {
|
|
|
54
55
|
directory: 'src',
|
|
55
56
|
js: false,
|
|
56
57
|
linter: options.linter,
|
|
57
|
-
|
|
58
|
+
enableTypedLinting: (0, internal_2.isTypedLintingEnabled)(options),
|
|
58
59
|
webServerCommand: e2eWebServerInfo.e2eWebServerCommand,
|
|
59
60
|
webServerAddress: e2eWebServerInfo.e2eWebServerAddress,
|
|
60
61
|
rootProject: options.rootProject,
|
|
@@ -2,16 +2,18 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addLinting = addLinting;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
+
const internal_1 = require("@nx/eslint/internal");
|
|
5
6
|
const add_linting_1 = tslib_1.__importDefault(require("../../add-linting/add-linting"));
|
|
6
7
|
async function addLinting(host, options) {
|
|
7
8
|
if (options.linter === 'none') {
|
|
8
9
|
return;
|
|
9
10
|
}
|
|
10
11
|
await (0, add_linting_1.default)(host, {
|
|
12
|
+
linter: options.linter,
|
|
11
13
|
projectName: options.name,
|
|
12
14
|
projectRoot: options.appProjectRoot,
|
|
13
15
|
prefix: options.prefix,
|
|
14
|
-
|
|
16
|
+
enableTypedLinting: (0, internal_1.isTypedLintingEnabled)(options),
|
|
15
17
|
skipPackageJson: options.skipPackageJson,
|
|
16
18
|
unitTestRunner: options.unitTestRunner,
|
|
17
19
|
skipFormat: true,
|
|
@@ -3,19 +3,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createFiles = createFiles;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const js_1 = require("@nx/js");
|
|
6
|
-
const onboarding_1 = require("nx/src/nx-cloud/utilities/onboarding");
|
|
7
6
|
const test_runners_1 = require("../../../utils/test-runners");
|
|
8
7
|
const artifact_types_1 = require("../../utils/artifact-types");
|
|
9
8
|
const selector_1 = require("../../utils/selector");
|
|
10
9
|
const update_project_root_tsconfig_1 = require("../../utils/update-project-root-tsconfig");
|
|
10
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
11
11
|
async function createFiles(tree, options, rootOffset) {
|
|
12
12
|
const rootSelector = `${options.prefix}-root`;
|
|
13
13
|
(0, selector_1.validateHtmlSelector)(rootSelector);
|
|
14
14
|
const nxWelcomeSelector = `${options.prefix}-nx-welcome`;
|
|
15
15
|
(0, selector_1.validateHtmlSelector)(nxWelcomeSelector);
|
|
16
|
-
const onBoardingStatus = await (0,
|
|
16
|
+
const onBoardingStatus = await (0, internal_1.createNxCloudOnboardingURLForWelcomeApp)(tree, options.nxCloudToken);
|
|
17
17
|
const connectCloudUrl = onBoardingStatus === 'unclaimed' &&
|
|
18
|
-
(await (0,
|
|
18
|
+
(await (0, internal_1.getNxCloudAppOnBoardingUrl)(options.nxCloudToken));
|
|
19
19
|
const componentType = (0, artifact_types_1.getComponentType)(tree);
|
|
20
20
|
const componentFileSuffix = componentType ? `.${componentType}` : '';
|
|
21
21
|
const moduleTypeSeparator = (0, artifact_types_1.getModuleTypeSeparator)(tree);
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.normalizeOptions = normalizeOptions;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const internal_1 = require("@nx/devkit/internal");
|
|
6
|
+
const internal_2 = require("@nx/js/internal");
|
|
6
7
|
const test_runners_1 = require("../../../utils/test-runners");
|
|
7
8
|
const version_utils_1 = require("../../utils/version-utils");
|
|
8
9
|
function arePluginsExplicitlyDisabled(host) {
|
|
@@ -50,11 +51,14 @@ async function normalizeOptions(host, options, isRspack) {
|
|
|
50
51
|
skipTests: unitTestRunner === test_runners_1.UnitTestRunner.None,
|
|
51
52
|
skipFormat: false,
|
|
52
53
|
e2eTestRunner: test_runners_1.E2eTestRunner.Playwright,
|
|
53
|
-
linter: 'eslint',
|
|
54
54
|
strict: true,
|
|
55
55
|
standalone: true,
|
|
56
56
|
directory: appProjectRoot,
|
|
57
57
|
...options,
|
|
58
|
+
// Resolved after the spread, so the `=== 'none'` and `!== 'eslint'` guards
|
|
59
|
+
// downstream see a concrete linter. Both read `undefined` as "some linter,
|
|
60
|
+
// but not ESLint", which sets up linting and then skips its config.
|
|
61
|
+
linter: await (0, internal_2.normalizeLinterOption)(host, options.linter),
|
|
58
62
|
prefix: options.prefix || 'app',
|
|
59
63
|
name: appProjectName,
|
|
60
64
|
appProjectRoot,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { E2eTestRunner, UnitTestRunner } from '../../../utils/test-runners';
|
|
2
2
|
import type { Schema } from '../schema';
|
|
3
|
-
import {
|
|
3
|
+
import { LinterType } from '@nx/js';
|
|
4
4
|
export interface NormalizedSchema extends Schema {
|
|
5
|
-
linter:
|
|
5
|
+
linter: LinterType;
|
|
6
6
|
unitTestRunner: UnitTestRunner;
|
|
7
7
|
e2eTestRunner: E2eTestRunner;
|
|
8
8
|
prefix: string;
|
|
@@ -7,7 +7,9 @@ function setGeneratorDefaults(tree, options) {
|
|
|
7
7
|
nxJson.generators = nxJson.generators ?? {};
|
|
8
8
|
nxJson.generators['@nx/angular:application'] = {
|
|
9
9
|
e2eTestRunner: options.e2eTestRunner,
|
|
10
|
-
|
|
10
|
+
// Pinning `none` would freeze the answer detection exists to give, so a
|
|
11
|
+
// workspace that adopts a linter later would keep getting none.
|
|
12
|
+
linter: options.linter === 'none' ? undefined : options.linter,
|
|
11
13
|
style: options.style,
|
|
12
14
|
unitTestRunner: options.unitTestRunner,
|
|
13
15
|
strict: !options.strict ? false : undefined,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { LinterType } from '@nx/js';
|
|
2
2
|
import type { E2eTestRunner, UnitTestRunner } from '../../utils/test-runners';
|
|
3
3
|
import type { Styles } from '../utils/types';
|
|
4
4
|
|
|
@@ -14,12 +14,16 @@ export interface Schema {
|
|
|
14
14
|
style?: Styles;
|
|
15
15
|
skipTests?: boolean;
|
|
16
16
|
tags?: string;
|
|
17
|
-
linter?:
|
|
17
|
+
linter?: LinterType;
|
|
18
18
|
unitTestRunner?: UnitTestRunner;
|
|
19
19
|
e2eTestRunner?: E2eTestRunner;
|
|
20
20
|
backendProject?: string;
|
|
21
21
|
strict?: boolean;
|
|
22
22
|
port?: number;
|
|
23
|
+
enableTypedLinting?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* @deprecated Use `enableTypedLinting` instead. This option will be removed in Nx v24.
|
|
26
|
+
*/
|
|
23
27
|
setParserOptionsProject?: boolean;
|
|
24
28
|
skipPackageJson?: boolean;
|
|
25
29
|
standalone?: boolean;
|
|
@@ -30,4 +34,5 @@ export interface Schema {
|
|
|
30
34
|
nxCloudToken?: string;
|
|
31
35
|
addPlugin?: boolean;
|
|
32
36
|
zoneless?: boolean;
|
|
37
|
+
formatter?: 'prettier' | 'oxfmt' | 'none';
|
|
33
38
|
}
|
|
@@ -115,10 +115,9 @@
|
|
|
115
115
|
"description": "Add tags to the application (used for linting)."
|
|
116
116
|
},
|
|
117
117
|
"linter": {
|
|
118
|
-
"description": "The tool to use for running lint checks.",
|
|
118
|
+
"description": "The tool to use for running lint checks. Defaults to the linter the workspace already uses.",
|
|
119
119
|
"type": "string",
|
|
120
|
-
"enum": ["eslint", "none"]
|
|
121
|
-
"default": "eslint"
|
|
120
|
+
"enum": ["eslint", "oxlint", "none"]
|
|
122
121
|
},
|
|
123
122
|
"backendProject": {
|
|
124
123
|
"type": "string",
|
|
@@ -133,11 +132,17 @@
|
|
|
133
132
|
"type": "number",
|
|
134
133
|
"description": "The port at which the remote application should be served."
|
|
135
134
|
},
|
|
136
|
-
"
|
|
135
|
+
"enableTypedLinting": {
|
|
137
136
|
"type": "boolean",
|
|
138
|
-
"description": "Whether
|
|
137
|
+
"description": "Whether to enable typed linting. For flat configs, this configures the recommended `parserOptions.projectService` and `tsconfigRootDir`. For legacy `.eslintrc` configs, this configures `parserOptions.project`. We do not enable this by default for lint performance reasons.",
|
|
139
138
|
"default": false
|
|
140
139
|
},
|
|
140
|
+
"setParserOptionsProject": {
|
|
141
|
+
"type": "boolean",
|
|
142
|
+
"description": "Deprecated alias for `enableTypedLinting`.",
|
|
143
|
+
"default": false,
|
|
144
|
+
"x-deprecated": "Use `enableTypedLinting` instead. This option will be removed in Nx v24."
|
|
145
|
+
},
|
|
141
146
|
"standalone": {
|
|
142
147
|
"description": "Generate an application that is setup to use standalone components.",
|
|
143
148
|
"type": "boolean",
|
|
@@ -173,6 +178,11 @@
|
|
|
173
178
|
"zoneless": {
|
|
174
179
|
"description": "Generate an application that does not use `zone.js`. It defaults to `true`. _Note: this is only supported in Angular versions >= 21.0.0_",
|
|
175
180
|
"type": "boolean"
|
|
181
|
+
},
|
|
182
|
+
"formatter": {
|
|
183
|
+
"description": "The tool to use for code formatting.",
|
|
184
|
+
"type": "string",
|
|
185
|
+
"enum": ["none", "prettier", "oxfmt"]
|
|
176
186
|
}
|
|
177
187
|
},
|
|
178
188
|
"additionalProperties": false,
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.componentTestGenerator = componentTestGenerator;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const assert_cypress_component_testing_support_1 = require("../../utils/assert-cypress-component-testing-support");
|
|
5
6
|
const assert_supported_angular_version_1 = require("../../utils/assert-supported-angular-version");
|
|
6
7
|
const versions_1 = require("../../utils/versions");
|
|
7
8
|
const storybook_inputs_1 = require("../utils/storybook-ast/storybook-inputs");
|
|
@@ -9,6 +10,7 @@ const version_utils_1 = require("../utils/version-utils");
|
|
|
9
10
|
async function componentTestGenerator(tree, options) {
|
|
10
11
|
(0, assert_supported_angular_version_1.assertSupportedAngularVersion)(tree);
|
|
11
12
|
(0, devkit_1.ensurePackage)('@nx/cypress', versions_1.nxVersion);
|
|
13
|
+
(0, assert_cypress_component_testing_support_1.assertCypressComponentTestingSupport)(tree);
|
|
12
14
|
const { root } = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
13
15
|
const componentDirPath = (0, devkit_1.joinPathFragments)(root, options.componentDir);
|
|
14
16
|
const componentFilePath = (0, devkit_1.joinPathFragments)(componentDirPath, `${options.componentFileName}.ts`);
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.convertToRspack = convertToRspack;
|
|
4
4
|
const internal_1 = require("@nx/devkit/internal");
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
const enquirer_1 = require("enquirer");
|
|
7
6
|
const path_1 = require("path");
|
|
8
7
|
const posix_1 = require("path/posix");
|
|
9
8
|
const assert_supported_angular_version_1 = require("../../utils/assert-supported-angular-version");
|
|
@@ -226,13 +225,10 @@ async function getProjectToConvert(tree) {
|
|
|
226
225
|
projects.add(project);
|
|
227
226
|
});
|
|
228
227
|
}
|
|
229
|
-
|
|
230
|
-
type: 'select',
|
|
231
|
-
name: 'project',
|
|
228
|
+
return (0, internal_1.selectPrompt)({
|
|
232
229
|
message: 'Which project would you like to convert to rspack?',
|
|
233
230
|
choices: Array.from(projects),
|
|
234
231
|
});
|
|
235
|
-
return project;
|
|
236
232
|
}
|
|
237
233
|
async function convertToRspack(tree, schema) {
|
|
238
234
|
(0, assert_supported_angular_version_1.assertSupportedAngularVersion)(tree);
|
package/dist/src/generators/cypress-component-configuration/cypress-component-configuration.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.cypressComponentConfiguration = cypressComponentConfiguration;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const path_1 = require("path");
|
|
6
|
+
const assert_cypress_component_testing_support_1 = require("../../utils/assert-cypress-component-testing-support");
|
|
6
7
|
const assert_supported_angular_version_1 = require("../../utils/assert-supported-angular-version");
|
|
7
8
|
const zoneless_1 = require("../../utils/zoneless");
|
|
8
9
|
const versions_1 = require("../../utils/versions");
|
|
@@ -31,6 +32,7 @@ const esbuildExecutors = new Set([
|
|
|
31
32
|
async function cypressComponentConfiguration(tree, options) {
|
|
32
33
|
(0, assert_supported_angular_version_1.assertSupportedAngularVersion)(tree);
|
|
33
34
|
const { componentConfigurationGenerator: baseCyCTConfig } = (0, devkit_1.ensurePackage)('@nx/cypress', versions_1.nxVersion);
|
|
35
|
+
(0, assert_cypress_component_testing_support_1.assertCypressComponentTestingSupport)(tree);
|
|
34
36
|
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
35
37
|
let isZoneless;
|
|
36
38
|
if (projectConfig.projectType === 'application') {
|