@nx/angular 20.8.0-canary.20250408-32b48a3 → 20.8.0-canary.20250412-07ad2d7
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 +9 -9
- package/src/generators/add-linting/add-linting.js +1 -1
- package/src/generators/add-linting/schema.d.ts +1 -0
- package/src/generators/application/application.js +14 -1
- package/src/generators/application/lib/add-e2e.js +2 -2
- package/src/generators/application/lib/add-linting.js +1 -0
- package/src/generators/application/lib/add-unit-test-runner.js +2 -0
- package/src/generators/application/lib/normalize-options.d.ts +1 -1
- package/src/generators/application/lib/normalize-options.js +8 -1
- package/src/generators/application/schema.d.ts +2 -1
- package/src/generators/application/schema.json +1 -1
- package/src/generators/component-test/component-test.js +1 -1
- package/src/generators/convert-to-rspack/convert-to-rspack.js +2 -1
- package/src/generators/library/lib/add-project.js +3 -1
- package/src/generators/ng-add/migrators/projects/e2e.migrator.js +2 -2
- package/src/generators/utils/add-jest.d.ts +1 -0
- package/src/generators/utils/add-jest.js +2 -2
- package/src/generators/utils/add-vitest.d.ts +1 -0
- package/src/generators/utils/add-vitest.js +1 -1
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nx/angular",
|
3
|
-
"version": "20.8.0-canary.
|
3
|
+
"version": "20.8.0-canary.20250412-07ad2d7",
|
4
4
|
"private": false,
|
5
5
|
"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, Tailwind CSS, 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.",
|
6
6
|
"repository": {
|
@@ -72,14 +72,14 @@
|
|
72
72
|
"semver": "^7.5.3",
|
73
73
|
"tslib": "^2.3.0",
|
74
74
|
"webpack-merge": "^5.8.0",
|
75
|
-
"@nx/devkit": "20.8.0-canary.
|
76
|
-
"@nx/js": "20.8.0-canary.
|
77
|
-
"@nx/eslint": "20.8.0-canary.
|
78
|
-
"@nx/webpack": "20.8.0-canary.
|
79
|
-
"@nx/rspack": "20.8.0-canary.
|
80
|
-
"@nx/module-federation": "20.8.0-canary.
|
81
|
-
"@nx/web": "20.8.0-canary.
|
82
|
-
"@nx/workspace": "20.8.0-canary.
|
75
|
+
"@nx/devkit": "20.8.0-canary.20250412-07ad2d7",
|
76
|
+
"@nx/js": "20.8.0-canary.20250412-07ad2d7",
|
77
|
+
"@nx/eslint": "20.8.0-canary.20250412-07ad2d7",
|
78
|
+
"@nx/webpack": "20.8.0-canary.20250412-07ad2d7",
|
79
|
+
"@nx/rspack": "20.8.0-canary.20250412-07ad2d7",
|
80
|
+
"@nx/module-federation": "20.8.0-canary.20250412-07ad2d7",
|
81
|
+
"@nx/web": "20.8.0-canary.20250412-07ad2d7",
|
82
|
+
"@nx/workspace": "20.8.0-canary.20250412-07ad2d7",
|
83
83
|
"piscina": "^4.4.0"
|
84
84
|
},
|
85
85
|
"peerDependencies": {
|
@@ -22,7 +22,7 @@ async function addLintingGenerator(tree, options) {
|
|
22
22
|
setParserOptionsProject: options.setParserOptionsProject,
|
23
23
|
skipFormat: true,
|
24
24
|
rootProject: rootProject,
|
25
|
-
addPlugin: false,
|
25
|
+
addPlugin: options.addPlugin ?? false,
|
26
26
|
addExplicitTargets: true,
|
27
27
|
skipPackageJson: options.skipPackageJson,
|
28
28
|
});
|
@@ -6,13 +6,18 @@ const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-projec
|
|
6
6
|
const js_1 = require("@nx/js");
|
7
7
|
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
8
8
|
const init_1 = require("../init/init");
|
9
|
+
const convert_to_rspack_1 = require("../convert-to-rspack/convert-to-rspack");
|
9
10
|
const setup_ssr_1 = require("../setup-ssr/setup-ssr");
|
10
11
|
const setup_tailwind_1 = require("../setup-tailwind/setup-tailwind");
|
11
12
|
const ensure_angular_dependencies_1 = require("../utils/ensure-angular-dependencies");
|
12
13
|
const lib_1 = require("./lib");
|
13
14
|
async function applicationGenerator(tree, schema) {
|
14
15
|
(0, ts_solution_setup_1.assertNotUsingTsSolutionSetup)(tree, 'angular', 'application');
|
15
|
-
const
|
16
|
+
const isRspack = schema.bundler === 'rspack';
|
17
|
+
if (isRspack) {
|
18
|
+
schema.bundler = 'webpack';
|
19
|
+
}
|
20
|
+
const options = await (0, lib_1.normalizeOptions)(tree, schema, isRspack);
|
16
21
|
const rootOffset = (0, devkit_1.offsetFromRoot)(options.appProjectRoot);
|
17
22
|
await (0, js_1.initGenerator)(tree, {
|
18
23
|
...options,
|
@@ -23,6 +28,7 @@ async function applicationGenerator(tree, schema) {
|
|
23
28
|
await (0, init_1.angularInitGenerator)(tree, {
|
24
29
|
...options,
|
25
30
|
skipFormat: true,
|
31
|
+
addPlugin: options.addPlugin,
|
26
32
|
});
|
27
33
|
if (!options.skipPackageJson) {
|
28
34
|
(0, ensure_angular_dependencies_1.ensureAngularDependencies)(tree);
|
@@ -64,6 +70,13 @@ async function applicationGenerator(tree, schema) {
|
|
64
70
|
serverRouting: options.serverRouting,
|
65
71
|
});
|
66
72
|
}
|
73
|
+
if (isRspack) {
|
74
|
+
await (0, convert_to_rspack_1.convertToRspack)(tree, {
|
75
|
+
project: options.name,
|
76
|
+
skipInstall: options.skipPackageJson,
|
77
|
+
skipFormat: true,
|
78
|
+
});
|
79
|
+
}
|
67
80
|
if (!options.skipFormat) {
|
68
81
|
await (0, devkit_1.formatFiles)(tree);
|
69
82
|
}
|
@@ -7,8 +7,8 @@ const target_defaults_utils_1 = require("@nx/devkit/src/generators/target-defaul
|
|
7
7
|
async function addE2e(tree, options) {
|
8
8
|
// since e2e are separate projects, default to adding plugins
|
9
9
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
10
|
-
const addPlugin =
|
11
|
-
|
10
|
+
const addPlugin = nxJson['useInferencePlugins'] !== false &&
|
11
|
+
process.env.NX_ADD_PLUGINS !== 'false';
|
12
12
|
const e2eWebServerInfo = getAngularE2EWebServerInfo(tree, options.name, options.port);
|
13
13
|
if (options.e2eTestRunner === 'cypress') {
|
14
14
|
const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/cypress', versions_1.nxVersion);
|
@@ -12,6 +12,7 @@ async function addUnitTestRunner(host, options) {
|
|
12
12
|
projectRoot: options.appProjectRoot,
|
13
13
|
skipPackageJson: options.skipPackageJson,
|
14
14
|
strict: options.strict,
|
15
|
+
addPlugin: options.addPlugin,
|
15
16
|
});
|
16
17
|
break;
|
17
18
|
case test_runners_1.UnitTestRunner.Vitest:
|
@@ -20,6 +21,7 @@ async function addUnitTestRunner(host, options) {
|
|
20
21
|
projectRoot: options.appProjectRoot,
|
21
22
|
skipPackageJson: options.skipPackageJson,
|
22
23
|
strict: options.strict,
|
24
|
+
addPlugin: options.addPlugin,
|
23
25
|
});
|
24
26
|
break;
|
25
27
|
}
|
@@ -1,4 +1,4 @@
|
|
1
1
|
import { type Tree } from '@nx/devkit';
|
2
2
|
import type { Schema } from '../schema';
|
3
3
|
import type { NormalizedSchema } from './normalized-schema';
|
4
|
-
export declare function normalizeOptions(host: Tree, options: Partial<Schema
|
4
|
+
export declare function normalizeOptions(host: Tree, options: Partial<Schema>, isRspack?: boolean): Promise<NormalizedSchema>;
|
@@ -5,7 +5,12 @@ const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
|
6
6
|
const eslint_1 = require("@nx/eslint");
|
7
7
|
const test_runners_1 = require("../../../utils/test-runners");
|
8
|
-
|
8
|
+
function arePluginsExplicitlyDisabled(host) {
|
9
|
+
const { useInferencePlugins } = (0, devkit_1.readNxJson)(host);
|
10
|
+
const addPluginEnvVar = process.env.NX_ADD_PLUGINS;
|
11
|
+
return useInferencePlugins === false || addPluginEnvVar === 'false';
|
12
|
+
}
|
13
|
+
async function normalizeOptions(host, options, isRspack) {
|
9
14
|
await (0, project_name_and_root_utils_1.ensureRootProjectName)(options, 'application');
|
10
15
|
const { projectName: appProjectName, projectRoot: appProjectRoot } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
|
11
16
|
name: options.name,
|
@@ -20,8 +25,10 @@ async function normalizeOptions(host, options) {
|
|
20
25
|
? options.tags.split(',').map((s) => s.trim())
|
21
26
|
: [];
|
22
27
|
const bundler = options.bundler ?? 'esbuild';
|
28
|
+
const addPlugin = options.addPlugin ?? (!arePluginsExplicitlyDisabled(host) && isRspack);
|
23
29
|
// Set defaults and then overwrite with user options
|
24
30
|
return {
|
31
|
+
addPlugin,
|
25
32
|
style: 'css',
|
26
33
|
routing: true,
|
27
34
|
inlineStyle: false,
|
@@ -27,8 +27,9 @@ export interface Schema {
|
|
27
27
|
standalone?: boolean;
|
28
28
|
rootProject?: boolean;
|
29
29
|
minimal?: boolean;
|
30
|
-
bundler?: 'webpack' | 'esbuild';
|
30
|
+
bundler?: 'webpack' | 'esbuild' | 'rspack';
|
31
31
|
ssr?: boolean;
|
32
32
|
serverRouting?: boolean;
|
33
33
|
nxCloudToken?: string;
|
34
|
+
addPlugin?: boolean;
|
34
35
|
}
|
@@ -171,7 +171,7 @@
|
|
171
171
|
"bundler": {
|
172
172
|
"description": "Bundler to use to build the application.",
|
173
173
|
"type": "string",
|
174
|
-
"enum": ["esbuild", "webpack"],
|
174
|
+
"enum": ["esbuild", "rspack", "webpack"],
|
175
175
|
"default": "esbuild",
|
176
176
|
"x-prompt": "Which bundler do you want to use to build the application?",
|
177
177
|
"x-priority": "important"
|
@@ -6,7 +6,7 @@ const versions_1 = require("../../utils/versions");
|
|
6
6
|
const storybook_inputs_1 = require("../utils/storybook-ast/storybook-inputs");
|
7
7
|
async function componentTestGenerator(tree, options) {
|
8
8
|
(0, devkit_1.ensurePackage)('@nx/cypress', versions_1.nxVersion);
|
9
|
-
const { assertMinimumCypressVersion } = require('@nx/cypress/src/utils/
|
9
|
+
const { assertMinimumCypressVersion } = require('@nx/cypress/src/utils/versions');
|
10
10
|
assertMinimumCypressVersion(10);
|
11
11
|
const { root } = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
12
12
|
const componentDirPath = (0, devkit_1.joinPathFragments)(root, options.componentDir);
|
@@ -282,8 +282,8 @@ async function convertToRspack(tree, schema) {
|
|
282
282
|
handleDevServerTargetOptions(tree, configuration, configurationOptions[configurationName].devServer, project.root);
|
283
283
|
}
|
284
284
|
}
|
285
|
+
serveTargetNames.push(targetName);
|
285
286
|
}
|
286
|
-
serveTargetNames.push(targetName);
|
287
287
|
}
|
288
288
|
const customWebpackConfigInfo = customWebpackConfigPath
|
289
289
|
? await (0, get_custom_webpack_config_1.getCustomWebpackConfig)(tree, project.root, customWebpackConfigPath)
|
@@ -307,6 +307,7 @@ async function convertToRspack(tree, schema) {
|
|
307
307
|
if (!schema.skipInstall) {
|
308
308
|
const installTask = (0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
|
309
309
|
'@nx/angular-rspack': versions_1.angularRspackVersion,
|
310
|
+
'ts-node': versions_1.tsNodeVersion,
|
310
311
|
});
|
311
312
|
tasks.push(installTask);
|
312
313
|
}
|
@@ -4,6 +4,7 @@ exports.addProject = addProject;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
5
5
|
const target_defaults_utils_1 = require("@nx/devkit/src/generators/target-defaults-utils");
|
6
6
|
const add_release_config_1 = require("@nx/js/src/generators/library/utils/add-release-config");
|
7
|
+
const use_legacy_versioning_1 = require("nx/src/command-line/release/config/use-legacy-versioning");
|
7
8
|
async function addProject(tree, libraryOptions) {
|
8
9
|
const project = {
|
9
10
|
name: libraryOptions.name,
|
@@ -36,7 +37,8 @@ async function addProject(tree, libraryOptions) {
|
|
36
37
|
defaultConfiguration: 'production',
|
37
38
|
};
|
38
39
|
if (libraryOptions.publishable) {
|
39
|
-
|
40
|
+
const nxJson = (0, devkit_1.readJson)(tree, 'nx.json');
|
41
|
+
await (0, add_release_config_1.addReleaseConfigForNonTsSolution)((0, use_legacy_versioning_1.shouldUseLegacyVersioning)(nxJson.release), tree, libraryOptions.name, project);
|
40
42
|
}
|
41
43
|
}
|
42
44
|
(0, devkit_1.addProjectConfiguration)(tree, libraryOptions.name, project);
|
@@ -173,8 +173,8 @@ class E2eMigrator extends project_migrator_1.ProjectMigrator {
|
|
173
173
|
}
|
174
174
|
else if (this.isCypressE2eProject()) {
|
175
175
|
(0, devkit_1.ensurePackage)('@nx/cypress', versions_1.nxVersion);
|
176
|
-
const {
|
177
|
-
this.cypressInstalledVersion =
|
176
|
+
const { getInstalledCypressMajorVersion, } = require('@nx/cypress/src/utils/versions');
|
177
|
+
this.cypressInstalledVersion = getInstalledCypressMajorVersion(this.tree);
|
178
178
|
this.project = {
|
179
179
|
...this.project,
|
180
180
|
name,
|
@@ -16,8 +16,8 @@ async function addJest(tree, options) {
|
|
16
16
|
skipSerializers: false,
|
17
17
|
skipPackageJson: options.skipPackageJson,
|
18
18
|
skipFormat: true,
|
19
|
-
addPlugin: false,
|
20
|
-
addExplicitTargets:
|
19
|
+
addPlugin: options.addPlugin ?? false,
|
20
|
+
addExplicitTargets: !options.addPlugin,
|
21
21
|
});
|
22
22
|
const setupFile = (0, devkit_1.joinPathFragments)(options.projectRoot, 'src', 'test-setup.ts');
|
23
23
|
if (options.strict && tree.exists(setupFile)) {
|