@nx/angular 21.0.0-canary.20250206-8bd0bcd → 21.0.0-canary.20250418-8619c1d
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/fesm2022/nx-angular.mjs +0 -352
- package/fesm2022/nx-angular.mjs.map +1 -1
- package/generators.json +7 -2
- package/index.d.ts +1 -1
- package/migrations.json +199 -69
- package/ng-package.json +1 -1
- package/package.json +11 -14
- package/src/builders/dev-server/dev-server.impl.js +2 -3
- package/src/builders/dev-server/lib/normalize-options.js +1 -0
- package/src/builders/dev-server/schema.d.ts +4 -0
- package/src/builders/dev-server/schema.json +9 -4
- package/src/builders/webpack-browser/schema.d.ts +1 -4
- package/src/builders/webpack-browser/schema.json +5 -0
- package/src/builders/webpack-browser/webpack-browser.impl.js +5 -5
- package/src/executors/delegate-build/delegate-build.impl.d.ts +1 -3
- package/src/executors/delegate-build/delegate-build.impl.js +0 -3
- package/src/executors/module-federation-dev-server/schema.d.ts +3 -0
- package/src/executors/module-federation-dev-server/schema.json +1 -1
- package/src/executors/package/package.impl.js +1 -4
- package/src/generators/add-linting/add-linting.js +1 -16
- package/src/generators/add-linting/lib/create-eslint-configuration.d.ts +2 -2
- package/src/generators/add-linting/lib/create-eslint-configuration.js +2 -2
- package/src/generators/add-linting/schema.d.ts +1 -0
- package/src/generators/application/application.js +20 -1
- package/src/generators/application/files/rspack-ssr/server.ts__tmpl__ +72 -0
- package/src/generators/application/lib/add-e2e.js +2 -9
- package/src/generators/application/lib/add-linting.js +1 -0
- package/src/generators/application/lib/add-serve-static-target.js +1 -0
- package/src/generators/application/lib/add-unit-test-runner.js +2 -0
- package/src/generators/application/lib/create-project.js +1 -0
- package/src/generators/application/lib/normalize-options.d.ts +1 -1
- package/src/generators/application/lib/normalize-options.js +9 -2
- package/src/generators/application/schema.d.ts +2 -2
- package/src/generators/application/schema.json +1 -7
- package/src/generators/component-test/component-test.js +1 -1
- package/src/generators/convert-to-rspack/convert-to-rspack.d.ts +4 -0
- package/src/generators/convert-to-rspack/convert-to-rspack.js +314 -0
- package/src/generators/convert-to-rspack/lib/create-config.d.ts +2 -0
- package/src/generators/convert-to-rspack/lib/create-config.js +48 -0
- package/src/generators/convert-to-rspack/lib/get-custom-webpack-config.d.ts +6 -0
- package/src/generators/convert-to-rspack/lib/get-custom-webpack-config.js +75 -0
- package/src/generators/convert-to-rspack/lib/update-tsconfig.d.ts +2 -0
- package/src/generators/convert-to-rspack/lib/update-tsconfig.js +26 -0
- package/src/generators/convert-to-rspack/lib/validate-supported-executor.d.ts +2 -0
- package/src/generators/convert-to-rspack/lib/validate-supported-executor.js +14 -0
- package/src/generators/convert-to-rspack/schema.d.ts +5 -0
- package/src/generators/convert-to-rspack/schema.json +30 -0
- package/src/generators/host/host.js +1 -1
- package/src/generators/host/schema.d.ts +0 -1
- package/src/generators/host/schema.json +0 -6
- package/src/generators/library/lib/add-project.d.ts +1 -1
- package/src/generators/library/lib/add-project.js +7 -1
- package/src/generators/library/lib/normalize-options.js +1 -1
- package/src/generators/library/lib/normalized-schema.d.ts +0 -1
- package/src/generators/library/library.js +5 -1
- package/src/generators/library/schema.d.ts +0 -1
- package/src/generators/library/schema.json +0 -6
- package/src/generators/move/move.d.ts +3 -0
- package/src/generators/move/move.js +3 -0
- package/src/generators/ng-add/migrators/projects/e2e.migrator.js +2 -2
- package/src/generators/ngrx/ngrx.d.ts +3 -0
- package/src/generators/ngrx/ngrx.js +3 -0
- package/src/generators/ngrx/schema.json +1 -1
- package/src/generators/ngrx-feature-store/schema.d.ts +1 -1
- package/src/generators/remote/remote.js +1 -1
- package/src/generators/remote/schema.d.ts +0 -1
- package/src/generators/remote/schema.json +0 -6
- package/src/generators/setup-mf/lib/setup-serve-target.js +1 -0
- package/src/generators/setup-ssr/files/v19+/application-builder/ngmodule-src/app/__rootModuleFileName__ +2 -2
- package/src/generators/setup-ssr/files/v19+/application-builder/server/__serverFileName__ +1 -1
- package/src/generators/setup-ssr/files/v19+/application-builder/standalone-src/app/app.config.server.ts__tpl__ +2 -2
- package/src/generators/setup-ssr/files/v19+/application-builder-common-engine/server/__serverFileName__ +2 -0
- package/src/generators/setup-ssr/lib/generate-files.js +12 -1
- package/src/generators/setup-ssr/lib/update-project-config.js +1 -0
- package/src/generators/stories/stories.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/src/generators/utils/ensure-angular-dependencies.js +0 -1
- package/src/migrations/update-16-2-0/switch-data-persistence-operators-imports-to-ngrx-router-store.js +4 -4
- package/src/migrations/update-19-6-0/turn-off-dts-by-default.js +2 -2
- package/src/migrations/{update-16-1-0 → update-20-5-0}/update-angular-cli.d.ts +1 -1
- package/src/migrations/{update-16-1-0 → update-20-5-0}/update-angular-cli.js +1 -1
- package/src/migrations/{update-16-1-0/remove-ngcc-invocation.d.ts → update-21-0-0/change-data-persistence-operators-imports-to-ngrx-router-store-data-persistence.d.ts} +1 -1
- package/src/migrations/update-21-0-0/change-data-persistence-operators-imports-to-ngrx-router-store-data-persistence.js +122 -0
- package/src/migrations/update-21-0-0/set-continuous-option.d.ts +3 -0
- package/src/migrations/update-21-0-0/set-continuous-option.js +29 -0
- package/src/plugins/plugin.js +2 -0
- package/src/utils/backward-compatible-versions.js +2 -0
- package/src/utils/nx-devkit/ast-utils.d.ts +0 -8
- package/src/utils/nx-devkit/ast-utils.js +7 -12
- package/src/utils/versions.d.ts +7 -6
- package/src/utils/versions.js +8 -7
- package/fesm2022/nx-angular-testing.mjs +0 -45
- package/fesm2022/nx-angular-testing.mjs.map +0 -1
- package/src/migrations/update-16-0-0/remove-karma-defaults.d.ts +0 -2
- package/src/migrations/update-16-0-0/remove-karma-defaults.js +0 -52
- package/src/migrations/update-16-0-0/remove-library-generator-simple-module-name-option.d.ts +0 -2
- package/src/migrations/update-16-0-0/remove-library-generator-simple-module-name-option.js +0 -40
- package/src/migrations/update-16-0-0/remove-protractor-defaults.d.ts +0 -2
- package/src/migrations/update-16-0-0/remove-protractor-defaults.js +0 -52
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +0 -2
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +0 -9
- package/src/migrations/update-16-1-0/extract-standalone-config-from-bootstrap.d.ts +0 -2
- package/src/migrations/update-16-1-0/extract-standalone-config-from-bootstrap.js +0 -127
- package/src/migrations/update-16-1-0/remove-ngcc-invocation.js +0 -22
- package/src/migrations/update-16-1-0/remove-render-module-platform-server-exports.d.ts +0 -2
- package/src/migrations/update-16-1-0/remove-render-module-platform-server-exports.js +0 -62
- package/src/migrations/update-16-1-0/update-server-executor-config.d.ts +0 -2
- package/src/migrations/update-16-1-0/update-server-executor-config.js +0 -26
- package/src/runtime/nx/data-persistence.d.ts +0 -276
- package/testing/index.d.ts +0 -1
- package/testing/ng-package.json +0 -6
- package/testing/src/testing-utils.d.ts +0 -33
@@ -0,0 +1,75 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.getCustomWebpackConfig = getCustomWebpackConfig;
|
4
|
+
exports.convertWebpackConfigToUseNxModuleFederationPlugin = convertWebpackConfigToUseNxModuleFederationPlugin;
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
6
|
+
const config_utils_1 = require("@nx/devkit/src/utils/config-utils");
|
7
|
+
const path_1 = require("path");
|
8
|
+
const tsquery_1 = require("@phenomnomnominal/tsquery");
|
9
|
+
const FILE_EXTENSION_REGEX = /\.[^.]+$/;
|
10
|
+
async function getCustomWebpackConfig(tree, projectRoot, pathToCustomWebpackConfig) {
|
11
|
+
const webpackConfigContents = tree.read(pathToCustomWebpackConfig, 'utf-8');
|
12
|
+
if (webpackConfigContents.includes('@nx/module-federation/angular') &&
|
13
|
+
webpackConfigContents.includes('withModuleFederation')) {
|
14
|
+
tree.write(pathToCustomWebpackConfig, convertWebpackConfigToUseNxModuleFederationPlugin(webpackConfigContents));
|
15
|
+
return {
|
16
|
+
isWebpackConfigFunction: false,
|
17
|
+
normalizedPathToCustomWebpackConfig: `./${(0, path_1.relative)(projectRoot, pathToCustomWebpackConfig).replace(FILE_EXTENSION_REGEX, '')}`,
|
18
|
+
};
|
19
|
+
}
|
20
|
+
const configFile = await (0, config_utils_1.loadConfigFile)((0, path_1.join)(tree.root, pathToCustomWebpackConfig));
|
21
|
+
const webpackConfig = 'default' in configFile ? configFile.default : configFile;
|
22
|
+
return {
|
23
|
+
isWebpackConfigFunction: typeof webpackConfig === 'function',
|
24
|
+
normalizedPathToCustomWebpackConfig: `./${(0, path_1.relative)(projectRoot, pathToCustomWebpackConfig).replace(FILE_EXTENSION_REGEX, '')}`,
|
25
|
+
};
|
26
|
+
}
|
27
|
+
function convertWebpackConfigToUseNxModuleFederationPlugin(webpackConfigContents) {
|
28
|
+
let newWebpackConfigContents = webpackConfigContents;
|
29
|
+
let ast = tsquery_1.tsquery.ast(webpackConfigContents);
|
30
|
+
const withModuleFederationImportNodes = (0, tsquery_1.tsquery)(ast, 'ImportDeclaration:has(StringLiteral[value=@nx/module-federation/angular])');
|
31
|
+
if (withModuleFederationImportNodes.length > 0) {
|
32
|
+
const withModuleFederationImportNode = withModuleFederationImportNodes[0];
|
33
|
+
newWebpackConfigContents = `${webpackConfigContents.slice(0, withModuleFederationImportNode.getStart())}import { NxModuleFederationPlugin } from '@nx/module-federation/rspack';${webpackConfigContents.slice(withModuleFederationImportNode.getEnd())}`;
|
34
|
+
ast = tsquery_1.tsquery.ast(newWebpackConfigContents);
|
35
|
+
const exportedWithModuleFederationNodes = (0, tsquery_1.tsquery)(ast, 'ExportAssignment:has(CallExpression > Identifier[name=withModuleFederation])');
|
36
|
+
if (exportedWithModuleFederationNodes.length > 0) {
|
37
|
+
const exportedWithModuleFederationNode = exportedWithModuleFederationNodes[0];
|
38
|
+
newWebpackConfigContents = `${newWebpackConfigContents.slice(0, exportedWithModuleFederationNode.getStart())}${newWebpackConfigContents.slice(exportedWithModuleFederationNode.getEnd())}
|
39
|
+
export default {
|
40
|
+
plugins: [
|
41
|
+
new NxModuleFederationPlugin(config, {
|
42
|
+
dts: false,
|
43
|
+
}),
|
44
|
+
]
|
45
|
+
}
|
46
|
+
`;
|
47
|
+
}
|
48
|
+
else {
|
49
|
+
devkit_1.logger.warn("Could not find 'export default withModuleFederation' in the webpack config file. Skipping conversion.");
|
50
|
+
}
|
51
|
+
}
|
52
|
+
const withModuleFederationRequireNodes = (0, tsquery_1.tsquery)(ast, 'VariableStatement:has(CallExpression > Identifier[name=withModuleFederation], StringLiteral[value=@nx/module-federation/angular])');
|
53
|
+
if (withModuleFederationRequireNodes.length > 0) {
|
54
|
+
const withModuleFederationRequireNode = withModuleFederationRequireNodes[0];
|
55
|
+
newWebpackConfigContents = `${webpackConfigContents.slice(0, withModuleFederationRequireNode.getStart())}const { NxModuleFederationPlugin } = require('@nx/module-federation/rspack');${webpackConfigContents.slice(withModuleFederationRequireNode.getEnd())}`;
|
56
|
+
ast = tsquery_1.tsquery.ast(newWebpackConfigContents);
|
57
|
+
const exportedWithModuleFederationNodes = (0, tsquery_1.tsquery)(ast, 'ExpressionStatement:has(BinaryExpression > PropertyAccessExpression:has(Identifier[name=module], Identifier[name=exports]), CallExpression:has(Identifier[name=withModuleFederation]))');
|
58
|
+
if (exportedWithModuleFederationNodes.length > 0) {
|
59
|
+
const exportedWithModuleFederationNode = exportedWithModuleFederationNodes[0];
|
60
|
+
newWebpackConfigContents = `${newWebpackConfigContents.slice(0, exportedWithModuleFederationNode.getStart())}${newWebpackConfigContents.slice(exportedWithModuleFederationNode.getEnd())}
|
61
|
+
module.exports = {
|
62
|
+
plugins: [
|
63
|
+
new NxModuleFederationPlugin({ config }, {
|
64
|
+
dts: false,
|
65
|
+
}),
|
66
|
+
]
|
67
|
+
}
|
68
|
+
`;
|
69
|
+
}
|
70
|
+
else {
|
71
|
+
devkit_1.logger.warn("Could not find 'module.exports = withModuleFederation' in the webpack config file. Skipping conversion.");
|
72
|
+
}
|
73
|
+
}
|
74
|
+
return newWebpackConfigContents;
|
75
|
+
}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.updateTsconfig = updateTsconfig;
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
5
|
+
const js_1 = require("@nx/js");
|
6
|
+
function updateTsconfig(tree, projectRoot) {
|
7
|
+
const tsconfigPath = (0, devkit_1.joinPathFragments)(projectRoot, 'tsconfig.json');
|
8
|
+
const tsconfig = (0, devkit_1.readJson)(tree, tsconfigPath);
|
9
|
+
tsconfig['ts-node'] ??= {};
|
10
|
+
tsconfig['ts-node'].compilerOptions ??= {};
|
11
|
+
tsconfig['ts-node'].compilerOptions.module = 'CommonJS';
|
12
|
+
tsconfig['ts-node'].compilerOptions.moduleResolution = 'Node10';
|
13
|
+
if (tsconfig.compilerOptions?.customConditions) {
|
14
|
+
tsconfig['ts-node'].compilerOptions.customConditions = null;
|
15
|
+
}
|
16
|
+
else {
|
17
|
+
const rootTsconfigFile = (0, js_1.getRootTsConfigFileName)(tree);
|
18
|
+
if (rootTsconfigFile) {
|
19
|
+
const rootTsconfigJson = (0, devkit_1.readJson)(tree, rootTsconfigFile);
|
20
|
+
if (rootTsconfigJson.compilerOptions?.customConditions) {
|
21
|
+
tsconfig['ts-node'].compilerOptions.customConditions = null;
|
22
|
+
}
|
23
|
+
}
|
24
|
+
}
|
25
|
+
(0, devkit_1.writeJson)(tree, tsconfigPath, tsconfig);
|
26
|
+
}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.validateSupportedBuildExecutor = validateSupportedBuildExecutor;
|
4
|
+
const SUPPORTED_BUILD_EXECUTORS = [
|
5
|
+
'@angular-devkit/build-angular:browser',
|
6
|
+
'@nx/angular:webpack-browser',
|
7
|
+
];
|
8
|
+
function validateSupportedBuildExecutor(targets) {
|
9
|
+
const executorsUsedByProject = targets.map((target) => target.executor);
|
10
|
+
if (!executorsUsedByProject.some((executor) => SUPPORTED_BUILD_EXECUTORS.includes(executor))) {
|
11
|
+
throw new Error('The project does not use a supported build executor. Please use one of the following executors: ' +
|
12
|
+
SUPPORTED_BUILD_EXECUTORS.join(', '));
|
13
|
+
}
|
14
|
+
}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
{
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
3
|
+
"$id": "GeneratorNxApp",
|
4
|
+
"title": "Creates an Angular application.",
|
5
|
+
"description": "Creates an Angular application.",
|
6
|
+
"type": "object",
|
7
|
+
"cli": "nx",
|
8
|
+
"properties": {
|
9
|
+
"project": {
|
10
|
+
"type": "string",
|
11
|
+
"aliases": ["name", "projectName"],
|
12
|
+
"description": "Project for which to convert to rspack.",
|
13
|
+
"$default": {
|
14
|
+
"$source": "argv",
|
15
|
+
"index": 0
|
16
|
+
},
|
17
|
+
"x-priority": "important"
|
18
|
+
},
|
19
|
+
"skipFormat": {
|
20
|
+
"description": "Skip formatting files.",
|
21
|
+
"type": "boolean",
|
22
|
+
"default": false
|
23
|
+
},
|
24
|
+
"skipInstall": {
|
25
|
+
"description": "Skip installing dependencies.",
|
26
|
+
"type": "boolean",
|
27
|
+
"default": false
|
28
|
+
}
|
29
|
+
}
|
30
|
+
}
|
@@ -39,7 +39,7 @@ async function host(tree, schema) {
|
|
39
39
|
}
|
40
40
|
});
|
41
41
|
}
|
42
|
-
await (0, project_name_and_root_utils_1.
|
42
|
+
await (0, project_name_and_root_utils_1.ensureRootProjectName)(options, 'application');
|
43
43
|
const { projectName: hostProjectName, projectRoot: appRoot } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(tree, {
|
44
44
|
name: options.name,
|
45
45
|
projectType: 'application',
|
@@ -144,12 +144,6 @@
|
|
144
144
|
"description": "Create an application with stricter type checking and build optimization options.",
|
145
145
|
"default": true
|
146
146
|
},
|
147
|
-
"standaloneConfig": {
|
148
|
-
"description": "Split the project configuration into `<projectRoot>/project.json` rather than including it inside `workspace.json`.",
|
149
|
-
"type": "boolean",
|
150
|
-
"default": true,
|
151
|
-
"x-deprecated": "Nx only supports standaloneConfig"
|
152
|
-
},
|
153
147
|
"setParserOptionsProject": {
|
154
148
|
"type": "boolean",
|
155
149
|
"description": "Whether or not to configure the ESLint `parserOptions.project` option. We do not do this by default for lint performance reasons.",
|
@@ -1,4 +1,4 @@
|
|
1
1
|
import type { Tree } from '@nx/devkit';
|
2
2
|
import type { AngularProjectConfiguration } from '../../../utils/types';
|
3
3
|
import type { NormalizedSchema } from './normalized-schema';
|
4
|
-
export declare function addProject(tree: Tree, libraryOptions: NormalizedSchema['libraryOptions']): AngularProjectConfiguration
|
4
|
+
export declare function addProject(tree: Tree, libraryOptions: NormalizedSchema['libraryOptions']): Promise<AngularProjectConfiguration>;
|
@@ -3,7 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
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");
|
8
|
+
async function addProject(tree, libraryOptions) {
|
7
9
|
const project = {
|
8
10
|
name: libraryOptions.name,
|
9
11
|
root: libraryOptions.projectRoot,
|
@@ -34,6 +36,10 @@ function addProject(tree, libraryOptions) {
|
|
34
36
|
},
|
35
37
|
defaultConfiguration: 'production',
|
36
38
|
};
|
39
|
+
if (libraryOptions.publishable) {
|
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);
|
42
|
+
}
|
37
43
|
}
|
38
44
|
(0, devkit_1.addProjectConfiguration)(tree, libraryOptions.name, project);
|
39
45
|
return project;
|
@@ -22,7 +22,7 @@ async function normalizeOptions(host, schema) {
|
|
22
22
|
skipModule: schema.skipModule || schema.standalone,
|
23
23
|
...schema,
|
24
24
|
};
|
25
|
-
await (0, project_name_and_root_utils_1.
|
25
|
+
await (0, project_name_and_root_utils_1.ensureRootProjectName)(options, 'library');
|
26
26
|
const { projectName, names: projectNames, projectRoot, importPath, } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
|
27
27
|
name: options.name,
|
28
28
|
projectType: 'library',
|
@@ -25,6 +25,7 @@ const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-projec
|
|
25
25
|
const test_runners_1 = require("../../utils/test-runners");
|
26
26
|
const add_vitest_1 = require("../utils/add-vitest");
|
27
27
|
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
28
|
+
const add_release_config_1 = require("@nx/js/src/generators/library/utils/add-release-config");
|
28
29
|
async function libraryGenerator(tree, schema) {
|
29
30
|
(0, ts_solution_setup_1.assertNotUsingTsSolutionSetup)(tree, 'angular', 'library');
|
30
31
|
// Do some validation checks
|
@@ -49,7 +50,7 @@ async function libraryGenerator(tree, schema) {
|
|
49
50
|
if (!libraryOptions.skipPackageJson) {
|
50
51
|
(0, ensure_angular_dependencies_1.ensureAngularDependencies)(tree);
|
51
52
|
}
|
52
|
-
const project = (0, add_project_1.addProject)(tree, libraryOptions);
|
53
|
+
const project = await (0, add_project_1.addProject)(tree, libraryOptions);
|
53
54
|
(0, create_files_1.createFiles)(tree, options, project);
|
54
55
|
(0, update_tsconfig_1.updateTsConfig)(tree, libraryOptions);
|
55
56
|
await addUnitTestRunner(tree, libraryOptions);
|
@@ -76,6 +77,9 @@ async function libraryGenerator(tree, schema) {
|
|
76
77
|
'ng-packagr': pkgVersions.ngPackagrVersion,
|
77
78
|
}, undefined, true);
|
78
79
|
(0, dependencies_1.addBuildableLibrariesPostCssDependencies)(tree);
|
80
|
+
if (libraryOptions.publishable) {
|
81
|
+
await (0, add_release_config_1.releaseTasks)(tree);
|
82
|
+
}
|
79
83
|
}
|
80
84
|
(0, js_1.addTsConfigPath)(tree, libraryOptions.importPath, [
|
81
85
|
(0, devkit_1.joinPathFragments)(libraryOptions.projectRoot, './src', 'index.ts'),
|
@@ -108,12 +108,6 @@
|
|
108
108
|
"enum": ["eslint", "none"],
|
109
109
|
"default": "eslint"
|
110
110
|
},
|
111
|
-
"standaloneConfig": {
|
112
|
-
"description": "Split the project configuration into `<projectRoot>/project.json` rather than including it inside `workspace.json`.",
|
113
|
-
"type": "boolean",
|
114
|
-
"default": true,
|
115
|
-
"x-deprecated": "Nx only supports standaloneConfig"
|
116
|
-
},
|
117
111
|
"compilationMode": {
|
118
112
|
"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.",
|
119
113
|
"type": "string",
|
@@ -1,3 +1,6 @@
|
|
1
1
|
import type { Tree } from '@nx/devkit';
|
2
2
|
import type { Schema } from './schema';
|
3
|
+
/**
|
4
|
+
* @deprecated Use the `@nx/workspace:move` generator instead. It will be removed in Nx v22.
|
5
|
+
*/
|
3
6
|
export declare function angularMoveGenerator(tree: Tree, schema: Schema): Promise<void>;
|
@@ -2,6 +2,9 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.angularMoveGenerator = angularMoveGenerator;
|
4
4
|
const move_1 = require("@nx/workspace/src/generators/move/move");
|
5
|
+
/**
|
6
|
+
* @deprecated Use the `@nx/workspace:move` generator instead. It will be removed in Nx v22.
|
7
|
+
*/
|
5
8
|
async function angularMoveGenerator(tree, schema) {
|
6
9
|
process.env.NX_ANGULAR_MOVE_INVOKED = 'true';
|
7
10
|
await (0, move_1.moveGenerator)(tree, schema);
|
@@ -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,
|
@@ -1,4 +1,7 @@
|
|
1
1
|
import type { GeneratorCallback, Tree } from '@nx/devkit';
|
2
2
|
import type { NgRxGeneratorOptions } from './schema';
|
3
|
+
/**
|
4
|
+
* @deprecated Use the 'ngrx-root-store' and 'ngrx-feature-store' generators instead. It will be removed in Nx v22.
|
5
|
+
*/
|
3
6
|
export declare function ngrxGenerator(tree: Tree, schema: NgRxGeneratorOptions): Promise<GeneratorCallback>;
|
4
7
|
export default ngrxGenerator;
|
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ngrxGenerator = ngrxGenerator;
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
5
5
|
const lib_1 = require("./lib");
|
6
|
+
/**
|
7
|
+
* @deprecated Use the 'ngrx-root-store' and 'ngrx-feature-store' generators instead. It will be removed in Nx v22.
|
8
|
+
*/
|
6
9
|
async function ngrxGenerator(tree, schema) {
|
7
10
|
(0, lib_1.validateOptions)(tree, schema);
|
8
11
|
const options = (0, lib_1.normalizeOptions)(tree, schema);
|
@@ -3,7 +3,7 @@
|
|
3
3
|
"$id": "NxNgrxGenerator",
|
4
4
|
"title": "Add NgRx support to an application or library.",
|
5
5
|
"description": "Adds NgRx support to an application or library.",
|
6
|
-
"x-deprecated": "
|
6
|
+
"x-deprecated": "Use the 'ngrx-root-store' and 'ngrx-feature-store' generators instead. It will be removed in Nx v22.",
|
7
7
|
"cli": "nx",
|
8
8
|
"type": "object",
|
9
9
|
"examples": [
|
@@ -18,7 +18,7 @@ async function remote(tree, schema) {
|
|
18
18
|
if (options.host && !projects.has(options.host)) {
|
19
19
|
throw new Error(`The name of the application to be used as the host app does not exist. (${options.host})`);
|
20
20
|
}
|
21
|
-
await (0, project_name_and_root_utils_1.
|
21
|
+
await (0, project_name_and_root_utils_1.ensureRootProjectName)(options, 'application');
|
22
22
|
const { projectName: remoteProjectName } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(tree, {
|
23
23
|
name: options.name,
|
24
24
|
projectType: 'application',
|
@@ -138,12 +138,6 @@
|
|
138
138
|
"description": "Create an application with stricter type checking and build optimization options.",
|
139
139
|
"default": true
|
140
140
|
},
|
141
|
-
"standaloneConfig": {
|
142
|
-
"description": "Split the project configuration into `<projectRoot>/project.json` rather than including it inside `workspace.json`.",
|
143
|
-
"type": "boolean",
|
144
|
-
"default": true,
|
145
|
-
"x-deprecated": "Nx only supports standaloneConfig"
|
146
|
-
},
|
147
141
|
"setParserOptionsProject": {
|
148
142
|
"type": "boolean",
|
149
143
|
"description": "Whether or not to configure the ESLint `parserOptions.project` option. We do not do this by default for lint performance reasons.",
|
@@ -1,13 +1,13 @@
|
|
1
1
|
import { NgModule } from '@angular/core';
|
2
2
|
import { ServerModule } from '@angular/platform-server';<% if(serverRouting) { %>
|
3
|
-
import {
|
3
|
+
import { <%= provideServerRoutingFn %> } from '@angular/ssr';<% } %>
|
4
4
|
import { AppComponent } from './app.component';
|
5
5
|
import { AppModule } from './app.module';<% if(serverRouting) { %>
|
6
6
|
import { serverRoutes } from './app.routes.server';<% } %>
|
7
7
|
|
8
8
|
@NgModule({
|
9
9
|
imports: [AppModule, ServerModule],<% if(serverRouting) { %>
|
10
|
-
providers: [
|
10
|
+
providers: [<%= provideServerRoutingFn %>(serverRoutes)],<% } %>
|
11
11
|
bootstrap: [AppComponent],
|
12
12
|
})
|
13
13
|
export class <%= rootModuleClassName %> {}
|
@@ -61,6 +61,6 @@ if (isMainModule(import.meta.url)) {
|
|
61
61
|
}
|
62
62
|
|
63
63
|
/**
|
64
|
-
*
|
64
|
+
* Request handler used by the Angular CLI (for dev-server and during build) or Firebase Cloud Functions.
|
65
65
|
*/
|
66
66
|
export const reqHandler = createNodeRequestHandler(app);
|
@@ -1,13 +1,13 @@
|
|
1
1
|
import { mergeApplicationConfig, ApplicationConfig } from '@angular/core';
|
2
2
|
import { provideServerRendering } from '@angular/platform-server';<% if(serverRouting) { %>
|
3
|
-
import {
|
3
|
+
import { <%= provideServerRoutingFn %> } from '@angular/ssr';<% } %>
|
4
4
|
import { appConfig } from './app.config';<% if(serverRouting) { %>
|
5
5
|
import { serverRoutes } from './app.routes.server';<% } %>
|
6
6
|
|
7
7
|
const serverConfig: ApplicationConfig = {
|
8
8
|
providers: [
|
9
9
|
provideServerRendering()<% if(serverRouting) { %>,
|
10
|
-
|
10
|
+
<%= provideServerRoutingFn %>(serverRoutes)<% } %>
|
11
11
|
]
|
12
12
|
};
|
13
13
|
|
@@ -4,6 +4,7 @@ exports.generateSSRFiles = generateSSRFiles;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
5
5
|
const path_1 = require("path");
|
6
6
|
const version_utils_1 = require("../../utils/version-utils");
|
7
|
+
const semver_1 = require("semver");
|
7
8
|
function generateSSRFiles(tree, options) {
|
8
9
|
const project = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
9
10
|
if (project.targets.server ||
|
@@ -24,7 +25,17 @@ function generateSSRFiles(tree, options) {
|
|
24
25
|
pathToFiles = (0, path_1.join)(baseFilesPath, 'pre-v19', options.standalone ? 'standalone-src' : 'ngmodule-src');
|
25
26
|
}
|
26
27
|
const sourceRoot = project.sourceRoot ?? (0, devkit_1.joinPathFragments)(project.root, 'src');
|
27
|
-
(0,
|
28
|
+
const ssrVersion = (0, version_utils_1.getInstalledPackageVersion)(tree, '@angular/ssr');
|
29
|
+
const cleanedSsrVersion = ssrVersion
|
30
|
+
? (0, semver_1.clean)(ssrVersion) ?? (0, semver_1.coerce)(ssrVersion).version
|
31
|
+
: null;
|
32
|
+
(0, devkit_1.generateFiles)(tree, pathToFiles, sourceRoot, {
|
33
|
+
...options,
|
34
|
+
provideServerRoutingFn: !cleanedSsrVersion || (0, semver_1.gte)(cleanedSsrVersion, '19.2.0')
|
35
|
+
? 'provideServerRouting'
|
36
|
+
: 'provideServerRoutesConfig',
|
37
|
+
tpl: '',
|
38
|
+
});
|
28
39
|
if (angularMajorVersion >= 19 && !options.serverRouting) {
|
29
40
|
tree.delete((0, devkit_1.joinPathFragments)(sourceRoot, 'app/app.routes.server.ts'));
|
30
41
|
}
|
@@ -76,6 +76,7 @@ function updateProjectConfigForBrowserBuilder(tree, options) {
|
|
76
76
|
defaultConfiguration: 'production',
|
77
77
|
};
|
78
78
|
projectConfig.targets['serve-ssr'] = {
|
79
|
+
continuous: true,
|
79
80
|
executor: '@angular-devkit/build-angular:ssr-dev-server',
|
80
81
|
configurations: {
|
81
82
|
development: {
|
@@ -7,7 +7,7 @@ const component_story_1 = tslib_1.__importDefault(require("../component-story/co
|
|
7
7
|
const component_info_1 = require("../utils/storybook-ast/component-info");
|
8
8
|
const entry_point_1 = require("../utils/storybook-ast/entry-point");
|
9
9
|
const module_info_1 = require("../utils/storybook-ast/module-info");
|
10
|
-
const
|
10
|
+
const picomatch = require("picomatch");
|
11
11
|
const versions_1 = require("../../utils/versions");
|
12
12
|
async function angularStoriesGenerator(tree, options) {
|
13
13
|
const entryPoints = (0, entry_point_1.getProjectEntryPoints)(tree, options.name);
|
@@ -17,7 +17,7 @@ async function angularStoriesGenerator(tree, options) {
|
|
17
17
|
componentsInfo.push(...(0, component_info_1.getComponentsInfo)(tree, entryPoint, moduleFilePaths, options.name), ...(0, component_info_1.getStandaloneComponentsInfo)(tree, entryPoint));
|
18
18
|
}
|
19
19
|
const componentInfos = componentsInfo.filter((f) => !options.ignorePaths?.some((pattern) => {
|
20
|
-
const shouldIgnorePath = (
|
20
|
+
const shouldIgnorePath = picomatch(pattern)((0, devkit_1.joinPathFragments)(f.moduleFolderPath, f.path, `${f.componentFileName}.ts`));
|
21
21
|
return shouldIgnorePath;
|
22
22
|
}));
|
23
23
|
for (const info of componentInfos) {
|
@@ -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)) {
|
@@ -19,7 +19,6 @@ function ensureAngularDependencies(tree) {
|
|
19
19
|
const rxjsVersion = (0, version_utils_1.getInstalledPackageVersion)(tree, 'rxjs') ?? pkgVersions.rxjsVersion;
|
20
20
|
const tsLibVersion = (0, version_utils_1.getInstalledPackageVersion)(tree, 'tslib') ?? pkgVersions.tsLibVersion;
|
21
21
|
const zoneJsVersion = (0, version_utils_1.getInstalledPackageVersion)(tree, 'zone.js') ?? pkgVersions.zoneJsVersion;
|
22
|
-
dependencies['@angular/animations'] = angularVersion;
|
23
22
|
dependencies['@angular/common'] = angularVersion;
|
24
23
|
dependencies['@angular/compiler'] = angularVersion;
|
25
24
|
dependencies['@angular/core'] = angularVersion;
|
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = default_1;
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
5
5
|
const ensure_typescript_1 = require("@nx/js/src/utils/typescript/ensure-typescript");
|
6
|
+
const project_graph_1 = require("nx/src/config/project-graph");
|
7
|
+
const nx_deps_cache_1 = require("nx/src/project-graph/nx-deps-cache");
|
8
|
+
const version_utils_1 = require("../../generators/utils/version-utils");
|
6
9
|
const file_change_recorder_1 = require("../../utils/file-change-recorder");
|
7
|
-
const versions_1 = require("../../utils/versions");
|
8
10
|
const projects_1 = require("../utils/projects");
|
9
|
-
const nx_deps_cache_1 = require("nx/src/project-graph/nx-deps-cache");
|
10
|
-
const project_graph_1 = require("nx/src/config/project-graph");
|
11
11
|
let tsquery;
|
12
12
|
const angularPluginTargetNames = ['npm:@nx/angular', 'npm:@nrwl/angular'];
|
13
13
|
const dataPersistenceOperators = [
|
@@ -109,7 +109,7 @@ function addNgrxRouterStoreIfNotInstalled(tree) {
|
|
109
109
|
devDependencies?.['@ngrx/router-store']) {
|
110
110
|
return;
|
111
111
|
}
|
112
|
-
(0, devkit_1.addDependenciesToPackageJson)(tree, { '@ngrx/router-store':
|
112
|
+
(0, devkit_1.addDependenciesToPackageJson)(tree, { '@ngrx/router-store': (0, version_utils_1.versions)(tree).ngrxVersion }, {});
|
113
113
|
}
|
114
114
|
function filterFilesWithNxAngularDep(files) {
|
115
115
|
const filteredFiles = [];
|
@@ -2,12 +2,12 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.default = default_1;
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
5
|
-
const
|
5
|
+
const picomatch = require("picomatch");
|
6
6
|
const tsquery_1 = require("@phenomnomnominal/tsquery");
|
7
7
|
async function default_1(tree) {
|
8
8
|
(0, devkit_1.visitNotIgnoredFiles)(tree, '', (path) => {
|
9
9
|
const webpackConfigGlob = '**/webpack*.config*.{js,ts,mjs,cjs}';
|
10
|
-
const result = (
|
10
|
+
const result = picomatch(webpackConfigGlob)(path);
|
11
11
|
if (!result) {
|
12
12
|
return;
|
13
13
|
}
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.angularCliVersion = void 0;
|
4
4
|
exports.default = default_1;
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
6
|
-
exports.angularCliVersion = '~
|
6
|
+
exports.angularCliVersion = '~19.2.0';
|
7
7
|
async function default_1(tree) {
|
8
8
|
let shouldFormat = false;
|
9
9
|
(0, devkit_1.updateJson)(tree, 'package.json', (json) => {
|