@nx/angular 23.2.0-beta.6 → 23.2.0-beta.8
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/dist/src/generators/add-linting/add-linting.js +29 -18
- package/dist/src/generators/add-linting/schema.d.ts +3 -0
- package/dist/src/generators/add-linting/schema.json +7 -2
- package/dist/src/generators/application/lib/add-e2e.js +1 -1
- package/dist/src/generators/application/lib/add-linting.js +1 -0
- 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 +2 -2
- package/dist/src/generators/application/schema.json +2 -3
- package/dist/src/generators/convert-to-rspack/convert-to-rspack.js +1 -5
- package/dist/src/generators/host/host.js +5 -0
- package/dist/src/generators/host/schema.d.ts +2 -2
- package/dist/src/generators/host/schema.json +2 -3
- package/dist/src/generators/library/lib/normalize-options.js +4 -2
- package/dist/src/generators/library/lib/normalized-schema.d.ts +2 -2
- package/dist/src/generators/library/lib/set-generator-defaults.js +5 -1
- package/dist/src/generators/library/library.js +1 -0
- package/dist/src/generators/library/schema.d.ts +2 -2
- package/dist/src/generators/library/schema.json +2 -3
- 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/remote/schema.d.ts +2 -2
- package/dist/src/generators/remote/schema.json +2 -3
- package/dist/src/generators/storybook-configuration/schema.d.ts +2 -2
- package/dist/src/generators/storybook-configuration/schema.json +1 -2
- 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 +1 -2
- package/dist/src/utils/assert-cypress-component-testing-support.js +11 -7
- package/generators.json +1 -1
- package/package.json +13 -13
|
@@ -3,35 +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
|
-
enableTypedLinting: (0,
|
|
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
|
-
(0,
|
|
34
|
-
|
|
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, {
|
|
35
46
|
files: ['*.ts'],
|
|
36
47
|
rules: {
|
|
37
48
|
'@angular-eslint/directive-selector': [
|
|
@@ -52,7 +63,7 @@ async function addLintingGenerator(tree, options) {
|
|
|
52
63
|
],
|
|
53
64
|
},
|
|
54
65
|
});
|
|
55
|
-
(0,
|
|
66
|
+
(0, internal_3.addOverrideToLintConfig)(tree, options.projectRoot, {
|
|
56
67
|
files: ['*.html'],
|
|
57
68
|
rules: {},
|
|
58
69
|
});
|
|
@@ -62,18 +73,18 @@ async function addLintingGenerator(tree, options) {
|
|
|
62
73
|
// an existing `parserOptions.project`. Detect it first so we can carry it
|
|
63
74
|
// over. (Flat configs keep typed linting via `lintProjectGenerator`, so
|
|
64
75
|
// this is only needed on the legacy stack.)
|
|
65
|
-
const eslintFile = (0,
|
|
76
|
+
const eslintFile = (0, internal_3.findEslintFile)(tree, options.projectRoot);
|
|
66
77
|
const eslintFileContent = eslintFile
|
|
67
78
|
? tree.read((0, devkit_1.joinPathFragments)(options.projectRoot, eslintFile), 'utf8')
|
|
68
79
|
: null;
|
|
69
80
|
const typedLinting = eslintFileContent
|
|
70
|
-
? (0,
|
|
81
|
+
? (0, internal_3.inspectTypedLinting)(eslintFileContent)
|
|
71
82
|
: null;
|
|
72
83
|
// Only a `project` needs carrying over. A config running the project
|
|
73
84
|
// service needs no glob and typescript-eslint rejects one next to it.
|
|
74
85
|
const carryOverProject = !!typedLinting?.project && !typedLinting.projectService;
|
|
75
|
-
(0,
|
|
76
|
-
...(rootProject ? [
|
|
86
|
+
(0, internal_3.replaceOverridesInLintConfig)(tree, options.projectRoot, [
|
|
87
|
+
...(rootProject ? [internal_3.typeScriptOverride, internal_3.javaScriptOverride] : []),
|
|
77
88
|
{
|
|
78
89
|
files: ['*.ts'],
|
|
79
90
|
// Legacy `.eslintrc` is JSON, which can't express the `__dirname`
|
|
@@ -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,6 +28,11 @@
|
|
|
28
28
|
"description": "The path to the root of the selected project.",
|
|
29
29
|
"x-priority": "important"
|
|
30
30
|
},
|
|
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
|
+
},
|
|
31
36
|
"enableTypedLinting": {
|
|
32
37
|
"type": "boolean",
|
|
33
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.",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addE2e = addE2e;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
4
5
|
const internal_1 = require("@nx/devkit/internal");
|
|
5
6
|
const internal_2 = require("@nx/eslint/internal");
|
|
6
|
-
const devkit_1 = require("@nx/devkit");
|
|
7
7
|
const versions_1 = require("../../../utils/versions");
|
|
8
8
|
async function addE2e(tree, options) {
|
|
9
9
|
// since e2e are separate projects, default to adding plugins
|
|
@@ -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,7 +14,7 @@ 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;
|
|
@@ -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",
|
|
@@ -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);
|
|
@@ -6,6 +6,7 @@ const internal_1 = require("@nx/devkit/internal");
|
|
|
6
6
|
const internal_2 = require("@nx/eslint/internal");
|
|
7
7
|
const devkit_1 = require("@nx/devkit");
|
|
8
8
|
const js_1 = require("@nx/js");
|
|
9
|
+
const internal_3 = require("@nx/js/internal");
|
|
9
10
|
const assert_supported_angular_version_1 = require("../../utils/assert-supported-angular-version");
|
|
10
11
|
const test_runners_1 = require("../../utils/test-runners");
|
|
11
12
|
const application_1 = tslib_1.__importDefault(require("../application/application"));
|
|
@@ -29,6 +30,10 @@ async function host(tree, schema) {
|
|
|
29
30
|
schema.zoneless ??= angularMajorVersion >= 21 ? true : false;
|
|
30
31
|
const { typescriptConfiguration = true, ...options } = schema;
|
|
31
32
|
options.standalone = options.standalone ?? true;
|
|
33
|
+
// Resolved before delegating so the host and every generated remote share one
|
|
34
|
+
// answer. `applicationGenerator` returns a new object rather than mutating
|
|
35
|
+
// this one, so resolving there would ask again for each remote.
|
|
36
|
+
options.linter = await (0, internal_3.normalizeLinterOption)(tree, options.linter);
|
|
32
37
|
const projects = (0, devkit_1.getProjects)(tree);
|
|
33
38
|
const remotesToGenerate = [];
|
|
34
39
|
const remotesToIntegrate = [];
|
|
@@ -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
|
|
|
@@ -20,7 +20,7 @@ export interface Schema {
|
|
|
20
20
|
style?: Styles;
|
|
21
21
|
skipTests?: boolean;
|
|
22
22
|
tags?: string;
|
|
23
|
-
linter?:
|
|
23
|
+
linter?: LinterType;
|
|
24
24
|
unitTestRunner?: Exclude<UnitTestRunner, UnitTestRunner.VitestAngular>;
|
|
25
25
|
e2eTestRunner?: E2eTestRunner;
|
|
26
26
|
backendProject?: string;
|
|
@@ -139,10 +139,9 @@
|
|
|
139
139
|
"description": "Add tags to the application (used for linting)."
|
|
140
140
|
},
|
|
141
141
|
"linter": {
|
|
142
|
-
"description": "The tool to use for running lint checks.",
|
|
142
|
+
"description": "The tool to use for running lint checks. Defaults to the linter the workspace already uses.",
|
|
143
143
|
"type": "string",
|
|
144
|
-
"enum": ["eslint", "none"]
|
|
145
|
-
"default": "eslint"
|
|
144
|
+
"enum": ["eslint", "oxlint", "none"]
|
|
146
145
|
},
|
|
147
146
|
"backendProject": {
|
|
148
147
|
"type": "string",
|
|
@@ -6,12 +6,14 @@ const internal_1 = require("@nx/devkit/internal");
|
|
|
6
6
|
const test_runners_1 = require("../../../utils/test-runners");
|
|
7
7
|
const artifact_types_1 = require("../../utils/artifact-types");
|
|
8
8
|
const version_utils_1 = require("../../utils/version-utils");
|
|
9
|
+
const internal_2 = require("@nx/js/internal");
|
|
9
10
|
async function normalizeOptions(host, schema) {
|
|
10
11
|
schema.standalone = schema.standalone ?? true;
|
|
11
12
|
// Create a schema with populated default values
|
|
13
|
+
// No `linter` default here: it would mask the resolution below, which is what
|
|
14
|
+
// detects the workspace's linter and prompts when there is nothing to detect.
|
|
12
15
|
const options = {
|
|
13
16
|
buildable: false,
|
|
14
|
-
linter: 'eslint',
|
|
15
17
|
publishable: false,
|
|
16
18
|
skipFormat: false,
|
|
17
19
|
// Publishable libs cannot use `full` yet, so if its false then use the passed value or default to `full`
|
|
@@ -45,7 +47,7 @@ async function normalizeOptions(host, schema) {
|
|
|
45
47
|
const ngCliSchematicLibRoot = projectName;
|
|
46
48
|
const allNormalizedOptions = {
|
|
47
49
|
...options,
|
|
48
|
-
linter: options.linter
|
|
50
|
+
linter: await (0, internal_2.normalizeLinterOption)(host, options.linter),
|
|
49
51
|
unitTestRunner,
|
|
50
52
|
prefix: options.prefix ?? 'lib',
|
|
51
53
|
name: projectName,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UnitTestRunner } from '../../../utils/test-runners';
|
|
2
|
-
import type {
|
|
2
|
+
import type { LinterType } from '@nx/js';
|
|
3
3
|
export interface NormalizedSchema {
|
|
4
4
|
libraryOptions: {
|
|
5
5
|
directory: string;
|
|
@@ -28,7 +28,7 @@ export interface NormalizedSchema {
|
|
|
28
28
|
skipPostInstall?: boolean;
|
|
29
29
|
skipTsConfig?: boolean;
|
|
30
30
|
standalone?: boolean;
|
|
31
|
-
linter:
|
|
31
|
+
linter: LinterType;
|
|
32
32
|
unitTestRunner: UnitTestRunner;
|
|
33
33
|
prefix: string;
|
|
34
34
|
fileName: string;
|
|
@@ -6,7 +6,11 @@ function setGeneratorDefaults(tree, options) {
|
|
|
6
6
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
7
7
|
nxJson.generators = nxJson.generators ?? {};
|
|
8
8
|
nxJson.generators['@nx/angular:library'] = {
|
|
9
|
-
|
|
9
|
+
// Pinning `none` would freeze the answer detection exists to give, so a
|
|
10
|
+
// workspace that adopts a linter later would keep getting none.
|
|
11
|
+
linter: options.libraryOptions.linter === 'none'
|
|
12
|
+
? undefined
|
|
13
|
+
: options.libraryOptions.linter,
|
|
10
14
|
unitTestRunner: options.libraryOptions.unitTestRunner,
|
|
11
15
|
strict: !options.libraryOptions.strict ? false : undefined,
|
|
12
16
|
...(nxJson.generators['@nx/angular:library'] || {}),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { LinterType } from '@nx/js';
|
|
2
2
|
import type { UnitTestRunner } from '../../utils/test-runners';
|
|
3
3
|
|
|
4
4
|
export interface Schema {
|
|
@@ -19,7 +19,7 @@ export interface Schema {
|
|
|
19
19
|
parent?: string;
|
|
20
20
|
tags?: string;
|
|
21
21
|
strict?: boolean;
|
|
22
|
-
linter?:
|
|
22
|
+
linter?: LinterType;
|
|
23
23
|
unitTestRunner?: UnitTestRunner;
|
|
24
24
|
compilationMode?: 'full' | 'partial';
|
|
25
25
|
enableTypedLinting?: boolean;
|
|
@@ -97,10 +97,9 @@
|
|
|
97
97
|
"default": true
|
|
98
98
|
},
|
|
99
99
|
"linter": {
|
|
100
|
-
"description": "The tool to use for running lint checks.",
|
|
100
|
+
"description": "The tool to use for running lint checks. Defaults to the linter the workspace already uses.",
|
|
101
101
|
"type": "string",
|
|
102
|
-
"enum": ["eslint", "none"]
|
|
103
|
-
"default": "eslint"
|
|
102
|
+
"enum": ["eslint", "oxlint", "none"]
|
|
104
103
|
},
|
|
105
104
|
"compilationMode": {
|
|
106
105
|
"description": "Specifies the compilation mode to use. If not specified, it will default to `partial` for publishable libraries and to `full` for buildable libraries. The `full` value can not be used for publishable libraries.",
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LibMigrator = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const devkit_2 = require("@nx/devkit");
|
|
6
5
|
const utilities_1 = require("../../utilities");
|
|
7
6
|
const builders_1 = require("../builders");
|
|
8
7
|
const project_migrator_1 = require("./project.migrator");
|
|
@@ -46,7 +45,7 @@ class LibMigrator extends project_migrator_1.ProjectMigrator {
|
|
|
46
45
|
!Object.keys(this.projectConfig.targets).length) {
|
|
47
46
|
this.logger.warn('The project does not have any targets configured. This might not be an issue. Skipping updating targets.');
|
|
48
47
|
}
|
|
49
|
-
(0,
|
|
48
|
+
(0, devkit_1.updateProjectConfiguration)(this.tree, this.project.name, {
|
|
50
49
|
...this.projectConfig,
|
|
51
50
|
});
|
|
52
51
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LinterType } from '@nx/js';
|
|
2
2
|
import { E2eTestRunner, UnitTestRunner } from '../../utils/test-runners';
|
|
3
3
|
import type { Styles } from '../utils/types';
|
|
4
4
|
|
|
@@ -11,6 +11,6 @@ export interface GeneratorOptions {
|
|
|
11
11
|
skipInstall?: boolean;
|
|
12
12
|
skipPostInstall?: boolean;
|
|
13
13
|
style?: Styles;
|
|
14
|
-
linter?:
|
|
14
|
+
linter?: LinterType;
|
|
15
15
|
skipPackageJson?: boolean;
|
|
16
16
|
}
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
"default": false,
|
|
18
18
|
"x-priority": "internal"
|
|
19
19
|
},
|
|
20
|
-
|
|
21
20
|
"unitTestRunner": {
|
|
22
21
|
"type": "string",
|
|
23
22
|
"enum": ["karma", "jest", "none"],
|
|
@@ -39,8 +38,7 @@
|
|
|
39
38
|
"linter": {
|
|
40
39
|
"description": "The tool to use for running lint checks. NOTE: only used if running the generator in an Nx workspace.",
|
|
41
40
|
"type": "string",
|
|
42
|
-
"enum": ["eslint", "none"]
|
|
43
|
-
"default": "eslint"
|
|
41
|
+
"enum": ["eslint", "oxlint", "none"]
|
|
44
42
|
},
|
|
45
43
|
"style": {
|
|
46
44
|
"description": "The file extension to be used for style files. NOTE: only used if running the generator in an Nx workspace.",
|
|
@@ -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
|
|
|
@@ -18,7 +18,7 @@ export interface Schema {
|
|
|
18
18
|
style?: Styles;
|
|
19
19
|
skipTests?: boolean;
|
|
20
20
|
tags?: string;
|
|
21
|
-
linter?:
|
|
21
|
+
linter?: LinterType;
|
|
22
22
|
unitTestRunner?: Exclude<UnitTestRunner, UnitTestRunner.VitestAngular>;
|
|
23
23
|
e2eTestRunner?: E2eTestRunner;
|
|
24
24
|
backendProject?: string;
|
|
@@ -129,10 +129,9 @@
|
|
|
129
129
|
"description": "Add tags to the application (used for linting)."
|
|
130
130
|
},
|
|
131
131
|
"linter": {
|
|
132
|
-
"description": "The tool to use for running lint checks.",
|
|
132
|
+
"description": "The tool to use for running lint checks. Defaults to the linter the workspace already uses.",
|
|
133
133
|
"type": "string",
|
|
134
|
-
"enum": ["eslint", "none"]
|
|
135
|
-
"default": "eslint"
|
|
134
|
+
"enum": ["eslint", "oxlint", "none"]
|
|
136
135
|
},
|
|
137
136
|
"backendProject": {
|
|
138
137
|
"type": "string",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { LinterType } from '@nx/js';
|
|
2
2
|
|
|
3
3
|
export interface StorybookConfigurationOptions {
|
|
4
4
|
configureStaticServe?: boolean;
|
|
5
5
|
generateStories: boolean;
|
|
6
|
-
linter:
|
|
6
|
+
linter: LinterType;
|
|
7
7
|
project: string;
|
|
8
8
|
tsConfiguration?: boolean;
|
|
9
9
|
skipFormat?: boolean;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = migrateMfImportsToNewPackage;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const devkit_2 = require("@nx/devkit");
|
|
6
5
|
const tsquery_1 = require("@phenomnomnominal/tsquery");
|
|
7
6
|
const MF_IMPORT_TO_UPDATE = 'ModuleFederationConfig';
|
|
8
7
|
const MF_CONFIG_IMPORT_SELECTOR = `ImportDeclaration:has(StringLiteral[value=@nx/webpack]):has(Identifier[name=ModuleFederationConfig])`;
|
|
@@ -23,7 +22,7 @@ async function migrateMfImportsToNewPackage(tree) {
|
|
|
23
22
|
}
|
|
24
23
|
}
|
|
25
24
|
for (const root of rootsToCheck) {
|
|
26
|
-
(0,
|
|
25
|
+
(0, devkit_1.visitNotIgnoredFiles)(tree, root, (filePath) => {
|
|
27
26
|
if (!filePath.endsWith('.ts') && !filePath.endsWith('.js')) {
|
|
28
27
|
return;
|
|
29
28
|
}
|
|
@@ -57,5 +56,5 @@ async function migrateMfImportsToNewPackage(tree) {
|
|
|
57
56
|
tree.write(filePath, contents);
|
|
58
57
|
});
|
|
59
58
|
}
|
|
60
|
-
await (0,
|
|
59
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
61
60
|
}
|
|
@@ -4,7 +4,6 @@ exports.default = default_1;
|
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const internal_1 = require("@nx/js/internal");
|
|
6
6
|
const internal_2 = require("@nx/devkit/internal");
|
|
7
|
-
const internal_3 = require("@nx/devkit/internal");
|
|
8
7
|
const version_utils_1 = require("../../generators/utils/version-utils");
|
|
9
8
|
const file_change_recorder_1 = require("../../utils/file-change-recorder");
|
|
10
9
|
const projects_1 = require("../utils/projects");
|
|
@@ -27,7 +26,7 @@ async function default_1(tree) {
|
|
|
27
26
|
const tsqueryModule = require('@phenomnomnominal/tsquery');
|
|
28
27
|
tsqueryAst = tsqueryModule.ast;
|
|
29
28
|
tsqueryQuery = tsqueryModule.query;
|
|
30
|
-
const cachedFileMap = (0,
|
|
29
|
+
const cachedFileMap = (0, internal_2.readFileMapCache)().fileMap.projectFileMap;
|
|
31
30
|
const filesWithNxAngularImports = [];
|
|
32
31
|
for (const graphNode of projects) {
|
|
33
32
|
const files = filterFilesWithNxAngularDep(cachedFileMap[graphNode.name] || []);
|
|
@@ -4,6 +4,7 @@ exports.assertCypressComponentTestingSupport = assertCypressComponentTestingSupp
|
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const internal_1 = require("@nx/devkit/internal");
|
|
6
6
|
const semver_1 = require("semver");
|
|
7
|
+
const minCypressVersion = '15.20.1';
|
|
7
8
|
/**
|
|
8
9
|
* Asserts the workspace's Cypress version can run Component Testing against its
|
|
9
10
|
* Angular version. Must be called after `@nx/cypress` has been ensured.
|
|
@@ -16,12 +17,15 @@ function assertCypressComponentTestingSupport(tree) {
|
|
|
16
17
|
const { cypressVersion, } = require('@nx/cypress/internal');
|
|
17
18
|
// When Cypress is not installed, the generators install `cypressVersion`
|
|
18
19
|
const declaredCypressVersion = (0, devkit_1.getDependencyVersionFromPackageJson)(tree, 'cypress') ?? cypressVersion;
|
|
19
|
-
//
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
`See https://github.com/cypress-io/cypress/issues/34461.`);
|
|
20
|
+
// Gate only ranges capped below the floor. `^15.17.0` installs 15.20.1+, so
|
|
21
|
+
// comparing its lower bound would reject workspaces that work. Dist tags
|
|
22
|
+
// (`latest`, `next`) aren't ranges and aren't gated.
|
|
23
|
+
if (!(0, semver_1.validRange)(declaredCypressVersion) ||
|
|
24
|
+
!(0, semver_1.subset)(declaredCypressVersion, `<${minCypressVersion}`)) {
|
|
25
|
+
return;
|
|
26
26
|
}
|
|
27
|
+
throw new Error(`Cypress Component Testing with Angular 22.1 and higher requires Cypress ${minCypressVersion} or higher. ` +
|
|
28
|
+
`Found Cypress ${declaredCypressVersion}. Earlier Cypress versions can't load Angular's Babel 8 dependencies. ` +
|
|
29
|
+
`Please upgrade Cypress. ` +
|
|
30
|
+
`See https://github.com/cypress-io/cypress/issues/34461.`);
|
|
27
31
|
}
|
package/generators.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"add-linting": {
|
|
7
7
|
"factory": "./dist/src/generators/add-linting/add-linting",
|
|
8
8
|
"schema": "./dist/src/generators/add-linting/schema.json",
|
|
9
|
-
"description": "Adds linting configuration to an Angular project.",
|
|
9
|
+
"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.",
|
|
10
10
|
"hidden": true
|
|
11
11
|
},
|
|
12
12
|
"application": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/angular",
|
|
3
|
-
"version": "23.2.0-beta.
|
|
3
|
+
"version": "23.2.0-beta.8",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"description": "The Nx Plugin for Angular contains executors, generators, and utilities for managing Angular applications and libraries within an Nx workspace. It provides: \n\n- Integration with libraries such as Storybook, Jest, ESLint, Playwright and Cypress. \n\n- Generators to help scaffold code quickly (like: Micro Frontends, Libraries, both internal to your codebase and publishable to npm) \n\n- Single Component Application Modules (SCAMs) \n\n- NgRx helpers. \n\n- Utilities for automatic workspace refactoring.",
|
|
@@ -73,21 +73,21 @@
|
|
|
73
73
|
"dependencies": {
|
|
74
74
|
"@phenomnomnominal/tsquery": "~6.2.0",
|
|
75
75
|
"@typescript-eslint/type-utils": "^8.0.0",
|
|
76
|
-
"enquirer": "~2.3.6",
|
|
77
76
|
"jsonc-parser": "^3.2.0",
|
|
78
77
|
"magic-string": "~0.30.2",
|
|
79
78
|
"picocolors": "^1.1.0",
|
|
80
79
|
"picomatch": "4.0.4",
|
|
81
80
|
"semver": "^7.6.3",
|
|
82
81
|
"tslib": "^2.3.0",
|
|
83
|
-
"@nx/
|
|
84
|
-
"@nx/
|
|
85
|
-
"@nx/
|
|
86
|
-
"@nx/js": "23.2.0-beta.
|
|
82
|
+
"@nx/devkit": "23.2.0-beta.8",
|
|
83
|
+
"@nx/eslint": "23.2.0-beta.8",
|
|
84
|
+
"@nx/web": "23.2.0-beta.8",
|
|
85
|
+
"@nx/js": "23.2.0-beta.8"
|
|
87
86
|
},
|
|
88
87
|
"devDependencies": {
|
|
89
|
-
"@nx/
|
|
90
|
-
"nx": "23.2.0-beta.
|
|
88
|
+
"@nx/storybook": "23.2.0-beta.8",
|
|
89
|
+
"@nx/vitest": "23.2.0-beta.8",
|
|
90
|
+
"nx": "23.2.0-beta.8"
|
|
91
91
|
},
|
|
92
92
|
"peerDependencies": {
|
|
93
93
|
"@angular/build": ">= 20.0.0 < 23.0.0",
|
|
@@ -98,11 +98,11 @@
|
|
|
98
98
|
"ng-packagr": ">= 20.0.0 < 23.0.0",
|
|
99
99
|
"rxjs": "^6.5.3 || ^7.5.0",
|
|
100
100
|
"webpack-merge": "^5.8.0",
|
|
101
|
-
"@nx/
|
|
102
|
-
"@nx/
|
|
103
|
-
"@nx/rspack": "23.2.0-beta.
|
|
104
|
-
"@nx/webpack": "23.2.0-beta.
|
|
105
|
-
"@nx/
|
|
101
|
+
"@nx/cypress": "23.2.0-beta.8",
|
|
102
|
+
"@nx/module-federation": "23.2.0-beta.8",
|
|
103
|
+
"@nx/rspack": "23.2.0-beta.8",
|
|
104
|
+
"@nx/webpack": "23.2.0-beta.8",
|
|
105
|
+
"@nx/playwright": "23.2.0-beta.8"
|
|
106
106
|
},
|
|
107
107
|
"peerDependenciesMeta": {
|
|
108
108
|
"@angular/build": {
|