@nx/angular 0.0.0-pr-32490-e4fdfa9 → 0.0.0-pr-32868-a65a4a2
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 +1 -1
- package/migrations.json +328 -13
- package/package.json +9 -9
- package/spec/src/migrations/update-21-5-0/remove-default-karma-configuration-files.spec.d.ts +2 -0
- package/spec/src/migrations/update-21-5-0/remove-default-karma-configuration-files.spec.d.ts.map +1 -0
- package/spec/src/migrations/update-21-5-0/update-angular-cli.spec.d.ts +2 -0
- package/spec/src/migrations/update-21-5-0/update-angular-cli.spec.d.ts.map +1 -0
- package/spec/src/migrations/update-21-6-1/update-angular-cli.spec.d.ts +2 -0
- package/spec/src/migrations/update-21-6-1/update-angular-cli.spec.d.ts.map +1 -0
- package/src/generators/application/lib/normalize-options.d.ts.map +1 -1
- package/src/generators/application/lib/normalize-options.js +7 -1
- package/src/generators/convert-to-rspack/convert-to-rspack.d.ts.map +1 -1
- package/src/generators/convert-to-rspack/convert-to-rspack.js +9 -3
- package/src/generators/remote/files/standalone/src/bootstrap.server.ts__tmpl__ +6 -1
- package/src/generators/remote/lib/update-ssr-setup.d.ts.map +1 -1
- package/src/generators/remote/lib/update-ssr-setup.js +10 -1
- package/src/generators/setup-mf/lib/fix-bootstrap.js +2 -2
- package/src/generators/setup-ssr/files/pre-v19/standalone-src/__main__ +6 -1
- package/src/generators/setup-ssr/files/v19/application-builder/standalone-src/__main__ +6 -1
- package/src/generators/setup-ssr/files/v19/server-builder/standalone-src/__main__ +6 -1
- package/src/generators/setup-ssr/files/v20+/application-builder/standalone-src/__main__ +6 -1
- package/src/generators/setup-ssr/files/v20+/server-builder/standalone-src/__main__ +6 -1
- package/src/generators/setup-ssr/lib/generate-files.d.ts.map +1 -1
- package/src/generators/setup-ssr/lib/generate-files.js +9 -1
- package/src/generators/utils/add-jest.d.ts.map +1 -1
- package/src/generators/utils/add-jest.js +5 -1
- package/src/generators/utils/version-utils.d.ts +5 -0
- package/src/generators/utils/version-utils.d.ts.map +1 -1
- package/src/generators/utils/version-utils.js +18 -0
- package/src/migrations/update-21-5-0/remove-default-karma-configuration-files.d.ts +3 -0
- package/src/migrations/update-21-5-0/remove-default-karma-configuration-files.d.ts.map +1 -0
- package/src/migrations/update-21-5-0/remove-default-karma-configuration-files.js +53 -0
- package/src/migrations/update-21-5-0/update-angular-cli.d.ts +4 -0
- package/src/migrations/update-21-5-0/update-angular-cli.d.ts.map +1 -0
- package/src/migrations/update-21-5-0/update-angular-cli.js +23 -0
- package/src/migrations/update-21-5-0/utils/karma-config-analyzer.d.ts +28 -0
- package/src/migrations/update-21-5-0/utils/karma-config-analyzer.d.ts.map +1 -0
- package/src/migrations/update-21-5-0/utils/karma-config-analyzer.js +139 -0
- package/src/migrations/update-21-5-0/utils/karma-config-comparer.d.ts +64 -0
- package/src/migrations/update-21-5-0/utils/karma-config-comparer.d.ts.map +1 -0
- package/src/migrations/update-21-5-0/utils/karma-config-comparer.js +145 -0
- package/src/migrations/update-21-6-1/update-angular-cli.d.ts +4 -0
- package/src/migrations/update-21-6-1/update-angular-cli.d.ts.map +1 -0
- package/src/migrations/update-21-6-1/update-angular-cli.js +23 -0
- package/src/utils/backward-compatible-versions.d.ts +1 -1
- package/src/utils/backward-compatible-versions.d.ts.map +1 -1
- package/src/utils/backward-compatible-versions.js +0 -1
- package/src/utils/versions.d.ts +5 -6
- package/src/utils/versions.d.ts.map +1 -1
- package/src/utils/versions.js +6 -7
|
@@ -16,7 +16,7 @@ function generateSSRFiles(tree, options) {
|
|
|
16
16
|
// server has already been added
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
|
-
const { major: angularMajorVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
|
|
19
|
+
const { major: angularMajorVersion, version: angularVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
|
|
20
20
|
const baseFilesPath = (0, path_1.join)(__dirname, '..', 'files');
|
|
21
21
|
let pathToFiles;
|
|
22
22
|
if (angularMajorVersion >= 20) {
|
|
@@ -40,6 +40,13 @@ function generateSSRFiles(tree, options) {
|
|
|
40
40
|
const componentType = (0, artifact_types_1.getComponentType)(tree);
|
|
41
41
|
const appComponentInfo = (0, app_components_info_1.getAppComponentInfo)(tree, componentType ? `.${componentType}` : '', project);
|
|
42
42
|
const moduleTypeSeparator = (0, artifact_types_1.getModuleTypeSeparator)(tree);
|
|
43
|
+
const useBootstrapContext =
|
|
44
|
+
// https://github.com/angular/angular-cli/releases/tag/20.3.0
|
|
45
|
+
(0, semver_1.gte)(angularVersion, '20.3.0') ||
|
|
46
|
+
// https://github.com/angular/angular-cli/releases/tag/19.2.16
|
|
47
|
+
(angularMajorVersion === 19 && (0, semver_1.gte)(angularVersion, '19.2.16')) ||
|
|
48
|
+
// https://github.com/angular/angular-cli/releases/tag/18.2.21
|
|
49
|
+
(angularMajorVersion === 18 && (0, semver_1.gte)(angularVersion, '18.2.21'));
|
|
43
50
|
(0, devkit_1.generateFiles)(tree, pathToFiles, sourceRoot, {
|
|
44
51
|
...options,
|
|
45
52
|
provideServerRoutingFn: !cleanedSsrVersion || (0, semver_1.gte)(cleanedSsrVersion, '19.2.0')
|
|
@@ -48,6 +55,7 @@ function generateSSRFiles(tree, options) {
|
|
|
48
55
|
appFileName: appComponentInfo.extensionlessFileName,
|
|
49
56
|
appSymbolName: appComponentInfo.symbolName,
|
|
50
57
|
moduleTypeSeparator,
|
|
58
|
+
useBootstrapContext,
|
|
51
59
|
tpl: '',
|
|
52
60
|
});
|
|
53
61
|
if (angularMajorVersion === 19 && !options.serverRouting) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-jest.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/utils/add-jest.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAIpB,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,OAAO,CAAC;IACzB,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,wBAAsB,OAAO,CAC3B,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"add-jest.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/utils/add-jest.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAIpB,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,OAAO,CAAC;IACzB,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,wBAAsB,OAAO,CAC3B,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,IAAI,CAAC,CAsDf"}
|
|
@@ -11,7 +11,11 @@ async function addJest(tree, options) {
|
|
|
11
11
|
(0, devkit_1.addDependenciesToPackageJson)(tree, {
|
|
12
12
|
// TODO(leo): jest-preset-angular still needs this until https://github.com/thymikee/jest-preset-angular/pull/3079 is merged
|
|
13
13
|
'@angular/platform-browser-dynamic': pkgVersions.angularVersion,
|
|
14
|
-
}, {
|
|
14
|
+
}, {
|
|
15
|
+
// force jest v29.7.0, Angular doesn't support Jest v30 yet: https://github.com/angular/angular-cli/pull/30761
|
|
16
|
+
jest: '^29.7.0',
|
|
17
|
+
'jest-preset-angular': pkgVersions.jestPresetAngularVersion,
|
|
18
|
+
}, undefined, true);
|
|
15
19
|
}
|
|
16
20
|
const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/jest', versions_1.nxVersion);
|
|
17
21
|
await configurationGenerator(tree, {
|
|
@@ -13,4 +13,9 @@ export declare function getInstalledPackageVersionInfo(tree: Tree, pkgName: stri
|
|
|
13
13
|
version: string;
|
|
14
14
|
};
|
|
15
15
|
export declare function versions(tree: Tree): PackageLatestVersions | PackageCompatVersions;
|
|
16
|
+
/**
|
|
17
|
+
* Temporary helper to abstract away the version of angular-rspack to be installed
|
|
18
|
+
* until we stop supporting Angular 19.
|
|
19
|
+
*/
|
|
20
|
+
export declare function getAngularRspackVersion(tree: Tree): string | null;
|
|
16
21
|
//# sourceMappingURL=version-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version-utils.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/utils/version-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAEjD,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC3B,MAAM,0CAA0C,CAAC;AAIlD,wBAAgB,gCAAgC,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAK1E;AAED,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAgB7D;AAED,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAElE;AAED,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,IAAI;;;EAOxD;AAED,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,MAAM,GACd,MAAM,GAAG,IAAI,CAKf;AAED,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM;;;EAIzE;AAED,wBAAgB,QAAQ,CACtB,IAAI,EAAE,IAAI,GACT,qBAAqB,GAAG,qBAAqB,CAU/C"}
|
|
1
|
+
{"version":3,"file":"version-utils.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/utils/version-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAEjD,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC3B,MAAM,0CAA0C,CAAC;AAIlD,wBAAgB,gCAAgC,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAK1E;AAED,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAgB7D;AAED,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAElE;AAED,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,IAAI;;;EAOxD;AAED,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,MAAM,GACd,MAAM,GAAG,IAAI,CAKf;AAED,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM;;;EAIzE;AAED,wBAAgB,QAAQ,CACtB,IAAI,EAAE,IAAI,GACT,qBAAqB,GAAG,qBAAqB,CAU/C;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAcjE"}
|
|
@@ -7,6 +7,7 @@ exports.getInstalledAngularVersionInfo = getInstalledAngularVersionInfo;
|
|
|
7
7
|
exports.getInstalledPackageVersion = getInstalledPackageVersion;
|
|
8
8
|
exports.getInstalledPackageVersionInfo = getInstalledPackageVersionInfo;
|
|
9
9
|
exports.versions = versions;
|
|
10
|
+
exports.getAngularRspackVersion = getAngularRspackVersion;
|
|
10
11
|
const tslib_1 = require("tslib");
|
|
11
12
|
const devkit_1 = require("@nx/devkit");
|
|
12
13
|
const semver_1 = require("semver");
|
|
@@ -57,3 +58,20 @@ function versions(tree) {
|
|
|
57
58
|
return latestVersions;
|
|
58
59
|
}
|
|
59
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Temporary helper to abstract away the version of angular-rspack to be installed
|
|
63
|
+
* until we stop supporting Angular 19.
|
|
64
|
+
*/
|
|
65
|
+
function getAngularRspackVersion(tree) {
|
|
66
|
+
const majorAngularVersion = getInstalledAngularMajorVersion(tree);
|
|
67
|
+
if (majorAngularVersion === 19) {
|
|
68
|
+
return backward_compatible_versions_1.backwardCompatibleVersions.angularV19.angularRspackVersion;
|
|
69
|
+
}
|
|
70
|
+
if (majorAngularVersion >= 20) {
|
|
71
|
+
// Starting with Angular 20, we can use an Angular Rspack version that is
|
|
72
|
+
// aligned with the Nx version
|
|
73
|
+
return latestVersions.nxVersion;
|
|
74
|
+
}
|
|
75
|
+
// Lower versions of Angular are not supported
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove-default-karma-configuration-files.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/migrations/update-21-5-0/remove-default-karma-configuration-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAQpB,yBAA+B,IAAI,EAAE,IAAI,iBA4DxC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = default_1;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const targets_1 = require("../../utils/targets");
|
|
6
|
+
const karma_config_analyzer_1 = require("./utils/karma-config-analyzer");
|
|
7
|
+
const karma_config_comparer_1 = require("./utils/karma-config-comparer");
|
|
8
|
+
async function default_1(tree) {
|
|
9
|
+
const removableKarmaConfigs = new Map();
|
|
10
|
+
const projects = (0, devkit_1.getProjects)(tree);
|
|
11
|
+
for (const [projectName, project] of projects) {
|
|
12
|
+
for (const [, target] of (0, targets_1.allProjectTargets)(project)) {
|
|
13
|
+
let needDevkitPlugin = false;
|
|
14
|
+
switch (target.executor) {
|
|
15
|
+
case '@angular-devkit/build-angular:karma':
|
|
16
|
+
needDevkitPlugin = true;
|
|
17
|
+
break;
|
|
18
|
+
case '@angular/build:karma':
|
|
19
|
+
break;
|
|
20
|
+
default:
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
for (const [, options] of (0, targets_1.allTargetOptions)(target)) {
|
|
24
|
+
const karmaConfig = options['karmaConfig'];
|
|
25
|
+
if (typeof karmaConfig !== 'string') {
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
let isRemovable = removableKarmaConfigs.get(karmaConfig);
|
|
29
|
+
if (isRemovable === undefined && tree.exists(karmaConfig)) {
|
|
30
|
+
const content = tree.read(karmaConfig, 'utf-8');
|
|
31
|
+
const analysis = (0, karma_config_analyzer_1.analyzeKarmaConfig)(content);
|
|
32
|
+
if (analysis.hasUnsupportedValues) {
|
|
33
|
+
// Cannot safely determine if the file is removable.
|
|
34
|
+
isRemovable = false;
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
const diff = await (0, karma_config_comparer_1.compareKarmaConfigToDefault)(analysis, projectName, karmaConfig, needDevkitPlugin);
|
|
38
|
+
isRemovable = !(0, karma_config_comparer_1.hasDifferences)(diff) && diff.isReliable;
|
|
39
|
+
}
|
|
40
|
+
removableKarmaConfigs.set(karmaConfig, isRemovable);
|
|
41
|
+
if (isRemovable) {
|
|
42
|
+
tree.delete(karmaConfig);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (isRemovable) {
|
|
46
|
+
delete options['karmaConfig'];
|
|
47
|
+
(0, devkit_1.updateProjectConfiguration)(tree, projectName, project);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
53
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-angular-cli.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/migrations/update-21-5-0/update-angular-cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,IAAI,EAAc,MAAM,YAAY,CAAC;AAE3D,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAE3C,yBAA+B,IAAI,EAAE,IAAI,iBAkBxC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.angularCliVersion = void 0;
|
|
4
|
+
exports.default = default_1;
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
exports.angularCliVersion = '~20.2.0';
|
|
7
|
+
async function default_1(tree) {
|
|
8
|
+
let shouldFormat = false;
|
|
9
|
+
(0, devkit_1.updateJson)(tree, 'package.json', (json) => {
|
|
10
|
+
if (json.devDependencies?.['@angular/cli']) {
|
|
11
|
+
json.devDependencies['@angular/cli'] = exports.angularCliVersion;
|
|
12
|
+
shouldFormat = true;
|
|
13
|
+
}
|
|
14
|
+
else if (json.dependencies?.['@angular/cli']) {
|
|
15
|
+
json.dependencies['@angular/cli'] = exports.angularCliVersion;
|
|
16
|
+
shouldFormat = true;
|
|
17
|
+
}
|
|
18
|
+
return json;
|
|
19
|
+
});
|
|
20
|
+
if (shouldFormat) {
|
|
21
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
export interface RequireInfo {
|
|
9
|
+
module: string;
|
|
10
|
+
export?: string;
|
|
11
|
+
isCall?: boolean;
|
|
12
|
+
arguments?: KarmaConfigValue[];
|
|
13
|
+
}
|
|
14
|
+
export type KarmaConfigValue = string | boolean | number | KarmaConfigValue[] | {
|
|
15
|
+
[key: string]: KarmaConfigValue;
|
|
16
|
+
} | RequireInfo | undefined;
|
|
17
|
+
export interface KarmaConfigAnalysis {
|
|
18
|
+
settings: Map<string, KarmaConfigValue>;
|
|
19
|
+
hasUnsupportedValues: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Analyzes the content of a Karma configuration file to extract its settings.
|
|
23
|
+
*
|
|
24
|
+
* @param content The string content of the `karma.conf.js` file.
|
|
25
|
+
* @returns An object containing the configuration settings and a flag indicating if unsupported values were found.
|
|
26
|
+
*/
|
|
27
|
+
export declare function analyzeKarmaConfig(content: string): KarmaConfigAnalysis;
|
|
28
|
+
//# sourceMappingURL=karma-config-analyzer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"karma-config-analyzer.d.ts","sourceRoot":"","sources":["../../../../../../../packages/angular/src/migrations/update-21-5-0/utils/karma-config-analyzer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAqBH,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,gBAAgB,EAAE,CAAC;CAChC;AAED,MAAM,MAAM,gBAAgB,GACxB,MAAM,GACN,OAAO,GACP,MAAM,GACN,gBAAgB,EAAE,GAClB;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,CAAA;CAAE,GACnC,WAAW,GACX,SAAS,CAAC;AAEd,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IACxC,oBAAoB,EAAE,OAAO,CAAC;CAC/B;AAID;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,mBAAmB,CA+HvE"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.analyzeKarmaConfig = analyzeKarmaConfig;
|
|
11
|
+
/**
|
|
12
|
+
* Adapts the private utility from Angular CLI to be used in the migration.
|
|
13
|
+
*/
|
|
14
|
+
const ensure_typescript_1 = require("@nx/js/src/utils/typescript/ensure-typescript");
|
|
15
|
+
let ts;
|
|
16
|
+
/**
|
|
17
|
+
* Analyzes the content of a Karma configuration file to extract its settings.
|
|
18
|
+
*
|
|
19
|
+
* @param content The string content of the `karma.conf.js` file.
|
|
20
|
+
* @returns An object containing the configuration settings and a flag indicating if unsupported values were found.
|
|
21
|
+
*/
|
|
22
|
+
function analyzeKarmaConfig(content) {
|
|
23
|
+
if (!ts) {
|
|
24
|
+
ts = (0, ensure_typescript_1.ensureTypescript)();
|
|
25
|
+
}
|
|
26
|
+
const sourceFile = ts.createSourceFile('karma.conf.js', content, ts.ScriptTarget.Latest, true);
|
|
27
|
+
const settings = new Map();
|
|
28
|
+
let hasUnsupportedValues = false;
|
|
29
|
+
function visit(node) {
|
|
30
|
+
// The Karma configuration is defined within a `config.set({ ... })` call.
|
|
31
|
+
if (ts.isCallExpression(node) &&
|
|
32
|
+
ts.isPropertyAccessExpression(node.expression) &&
|
|
33
|
+
node.expression.expression.getText(sourceFile) === 'config' &&
|
|
34
|
+
node.expression.name.text === 'set' &&
|
|
35
|
+
node.arguments.length === 1 &&
|
|
36
|
+
ts.isObjectLiteralExpression(node.arguments[0])) {
|
|
37
|
+
// We found `config.set`, now we extract the properties from the object literal.
|
|
38
|
+
for (const prop of node.arguments[0].properties) {
|
|
39
|
+
if (isSupportedPropertyAssignment(prop)) {
|
|
40
|
+
const key = prop.name.text;
|
|
41
|
+
const value = extractValue(prop.initializer);
|
|
42
|
+
settings.set(key, value);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
hasUnsupportedValues = true;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
ts.forEachChild(node, visit);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function extractValue(node) {
|
|
54
|
+
switch (node.kind) {
|
|
55
|
+
case ts.SyntaxKind.StringLiteral:
|
|
56
|
+
return node.text;
|
|
57
|
+
case ts.SyntaxKind.NumericLiteral:
|
|
58
|
+
return Number(node.text);
|
|
59
|
+
case ts.SyntaxKind.TrueKeyword:
|
|
60
|
+
return true;
|
|
61
|
+
case ts.SyntaxKind.FalseKeyword:
|
|
62
|
+
return false;
|
|
63
|
+
case ts.SyntaxKind.Identifier: {
|
|
64
|
+
const identifier = node.text;
|
|
65
|
+
if (identifier === '__dirname' || identifier === '__filename') {
|
|
66
|
+
return identifier;
|
|
67
|
+
}
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
case ts.SyntaxKind.CallExpression: {
|
|
71
|
+
const callExpr = node;
|
|
72
|
+
// Handle require('...')
|
|
73
|
+
if (ts.isIdentifier(callExpr.expression) &&
|
|
74
|
+
callExpr.expression.text === 'require' &&
|
|
75
|
+
callExpr.arguments.length === 1 &&
|
|
76
|
+
ts.isStringLiteral(callExpr.arguments[0])) {
|
|
77
|
+
return { module: callExpr.arguments[0].text };
|
|
78
|
+
}
|
|
79
|
+
// Handle calls on a require, e.g. require('path').join()
|
|
80
|
+
const calleeValue = extractValue(callExpr.expression);
|
|
81
|
+
if (isRequireInfo(calleeValue)) {
|
|
82
|
+
return {
|
|
83
|
+
...calleeValue,
|
|
84
|
+
isCall: true,
|
|
85
|
+
arguments: callExpr.arguments.map(extractValue),
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
case ts.SyntaxKind.PropertyAccessExpression: {
|
|
91
|
+
const propAccessExpr = node;
|
|
92
|
+
// Handle config constants like `config.LOG_INFO`
|
|
93
|
+
if (ts.isIdentifier(propAccessExpr.expression) &&
|
|
94
|
+
propAccessExpr.expression.text === 'config') {
|
|
95
|
+
return `config.${propAccessExpr.name.text}`;
|
|
96
|
+
}
|
|
97
|
+
const value = extractValue(propAccessExpr.expression);
|
|
98
|
+
if (isRequireInfo(value)) {
|
|
99
|
+
const currentExport = value.export
|
|
100
|
+
? `${value.export}.${propAccessExpr.name.text}`
|
|
101
|
+
: propAccessExpr.name.text;
|
|
102
|
+
return { ...value, export: currentExport };
|
|
103
|
+
}
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
case ts.SyntaxKind.ArrayLiteralExpression:
|
|
107
|
+
return node.elements.map(extractValue);
|
|
108
|
+
case ts.SyntaxKind.ObjectLiteralExpression: {
|
|
109
|
+
const obj = {};
|
|
110
|
+
for (const prop of node.properties) {
|
|
111
|
+
if (isSupportedPropertyAssignment(prop)) {
|
|
112
|
+
// Recursively extract values for nested objects.
|
|
113
|
+
obj[prop.name.text] = extractValue(prop.initializer);
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
hasUnsupportedValues = true;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return obj;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
// For complex expressions (like variables) that we don't need to resolve,
|
|
123
|
+
// we mark the analysis as potentially incomplete.
|
|
124
|
+
hasUnsupportedValues = true;
|
|
125
|
+
return undefined;
|
|
126
|
+
}
|
|
127
|
+
visit(sourceFile);
|
|
128
|
+
return { settings, hasUnsupportedValues };
|
|
129
|
+
}
|
|
130
|
+
function isRequireInfo(value) {
|
|
131
|
+
return (typeof value === 'object' &&
|
|
132
|
+
value !== null &&
|
|
133
|
+
!Array.isArray(value) &&
|
|
134
|
+
'module' in value);
|
|
135
|
+
}
|
|
136
|
+
function isSupportedPropertyAssignment(prop) {
|
|
137
|
+
return (ts.isPropertyAssignment(prop) &&
|
|
138
|
+
(ts.isIdentifier(prop.name) || ts.isStringLiteral(prop.name)));
|
|
139
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
import { type KarmaConfigAnalysis, type KarmaConfigValue } from './karma-config-analyzer';
|
|
9
|
+
/**
|
|
10
|
+
* Represents the difference between two Karma configurations.
|
|
11
|
+
*/
|
|
12
|
+
export interface KarmaConfigDiff {
|
|
13
|
+
/** A map of settings that were added in the project's configuration. */
|
|
14
|
+
added: Map<string, KarmaConfigValue>;
|
|
15
|
+
/** A map of settings that were removed from the project's configuration. */
|
|
16
|
+
removed: Map<string, KarmaConfigValue>;
|
|
17
|
+
/** A map of settings that were modified between the two configurations. */
|
|
18
|
+
modified: Map<string, {
|
|
19
|
+
projectValue: KarmaConfigValue;
|
|
20
|
+
defaultValue: KarmaConfigValue;
|
|
21
|
+
}>;
|
|
22
|
+
/** A boolean indicating if the comparison is reliable (i.e., no unsupported values were found). */
|
|
23
|
+
isReliable: boolean;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Generates the default Karma configuration file content as a string.
|
|
27
|
+
* @param relativePathToWorkspaceRoot The relative path from the Karma config file to the workspace root.
|
|
28
|
+
* @param projectName The name of the project.
|
|
29
|
+
* @param needDevkitPlugin A boolean indicating if the devkit plugin is needed.
|
|
30
|
+
* @returns The content of the default `karma.conf.js` file.
|
|
31
|
+
*/
|
|
32
|
+
export declare function generateDefaultKarmaConfig(relativePathToWorkspaceRoot: string, projectName: string, needDevkitPlugin: boolean): Promise<string>;
|
|
33
|
+
/**
|
|
34
|
+
* Compares two Karma configuration analyses and returns the difference.
|
|
35
|
+
* @param projectAnalysis The analysis of the project's configuration.
|
|
36
|
+
* @param defaultAnalysis The analysis of the default configuration to compare against.
|
|
37
|
+
* @returns A diff object representing the changes between the two configurations.
|
|
38
|
+
*/
|
|
39
|
+
export declare function compareKarmaConfigs(projectAnalysis: KarmaConfigAnalysis, defaultAnalysis: KarmaConfigAnalysis): KarmaConfigDiff;
|
|
40
|
+
/**
|
|
41
|
+
* Checks if there are any differences in the provided Karma configuration diff.
|
|
42
|
+
* @param diff The Karma configuration diff object to check.
|
|
43
|
+
* @returns True if there are any differences; false otherwise.
|
|
44
|
+
*/
|
|
45
|
+
export declare function hasDifferences(diff: KarmaConfigDiff): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Compares a project's Karma configuration with the default configuration.
|
|
48
|
+
* @param projectConfigContent The content of the project's `karma.conf.js` file.
|
|
49
|
+
* @param projectRoot The root directory of the project.
|
|
50
|
+
* @param needDevkitPlugin A boolean indicating if the devkit plugin is needed for the default config.
|
|
51
|
+
* @param karmaConfigPath The path to the Karma configuration file, used to resolve relative paths.
|
|
52
|
+
* @returns A diff object representing the changes.
|
|
53
|
+
*/
|
|
54
|
+
export declare function compareKarmaConfigToDefault(projectConfigContent: string, projectName: string, karmaConfigPath: string, needDevkitPlugin: boolean): Promise<KarmaConfigDiff>;
|
|
55
|
+
/**
|
|
56
|
+
* Compares a project's Karma configuration with the default configuration.
|
|
57
|
+
* @param projectAnalysis The analysis of the project's configuration.
|
|
58
|
+
* @param projectRoot The root directory of the project.
|
|
59
|
+
* @param needDevkitPlugin A boolean indicating if the devkit plugin is needed for the default config.
|
|
60
|
+
* @param karmaConfigPath The path to the Karma configuration file, used to resolve relative paths.
|
|
61
|
+
* @returns A diff object representing the changes.
|
|
62
|
+
*/
|
|
63
|
+
export declare function compareKarmaConfigToDefault(projectAnalysis: KarmaConfigAnalysis, projectName: string, karmaConfigPath: string, needDevkitPlugin: boolean): Promise<KarmaConfigDiff>;
|
|
64
|
+
//# sourceMappingURL=karma-config-comparer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"karma-config-comparer.d.ts","sourceRoot":"","sources":["../../../../../../../packages/angular/src/migrations/update-21-5-0/utils/karma-config-comparer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AASH,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACtB,MAAM,yBAAyB,CAAC;AAEjC;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,wEAAwE;IACxE,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAErC,4EAA4E;IAC5E,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAEvC,2EAA2E;IAC3E,QAAQ,EAAE,GAAG,CACX,MAAM,EACN;QAAE,YAAY,EAAE,gBAAgB,CAAC;QAAC,YAAY,EAAE,gBAAgB,CAAA;KAAE,CACnE,CAAC;IAEF,mGAAmG;IACnG,UAAU,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;GAMG;AACH,wBAAsB,0BAA0B,CAC9C,2BAA2B,EAAE,MAAM,EACnC,WAAW,EAAE,MAAM,EACnB,gBAAgB,EAAE,OAAO,GACxB,OAAO,CAAC,MAAM,CAAC,CAgBjB;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,eAAe,EAAE,mBAAmB,EACpC,eAAe,EAAE,mBAAmB,GACnC,eAAe,CAoCjB;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAE7D;AAED;;;;;;;GAOG;AACH,wBAAsB,2BAA2B,CAC/C,oBAAoB,EAAE,MAAM,EAC5B,WAAW,EAAE,MAAM,EACnB,eAAe,EAAE,MAAM,EACvB,gBAAgB,EAAE,OAAO,GACxB,OAAO,CAAC,eAAe,CAAC,CAAC;AAE5B;;;;;;;GAOG;AACH,wBAAsB,2BAA2B,CAC/C,eAAe,EAAE,mBAAmB,EACpC,WAAW,EAAE,MAAM,EACnB,eAAe,EAAE,MAAM,EACvB,gBAAgB,EAAE,OAAO,GACxB,OAAO,CAAC,eAAe,CAAC,CAAC"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.generateDefaultKarmaConfig = generateDefaultKarmaConfig;
|
|
11
|
+
exports.compareKarmaConfigs = compareKarmaConfigs;
|
|
12
|
+
exports.hasDifferences = hasDifferences;
|
|
13
|
+
exports.compareKarmaConfigToDefault = compareKarmaConfigToDefault;
|
|
14
|
+
/**
|
|
15
|
+
* Adapts the private utility from Angular CLI to be used in the migration.
|
|
16
|
+
*/
|
|
17
|
+
const promises_1 = require("node:fs/promises");
|
|
18
|
+
const node_path_1 = require("node:path");
|
|
19
|
+
const node_util_1 = require("node:util");
|
|
20
|
+
const karma_config_analyzer_1 = require("./karma-config-analyzer");
|
|
21
|
+
/**
|
|
22
|
+
* Generates the default Karma configuration file content as a string.
|
|
23
|
+
* @param relativePathToWorkspaceRoot The relative path from the Karma config file to the workspace root.
|
|
24
|
+
* @param projectName The name of the project.
|
|
25
|
+
* @param needDevkitPlugin A boolean indicating if the devkit plugin is needed.
|
|
26
|
+
* @returns The content of the default `karma.conf.js` file.
|
|
27
|
+
*/
|
|
28
|
+
async function generateDefaultKarmaConfig(relativePathToWorkspaceRoot, projectName, needDevkitPlugin) {
|
|
29
|
+
let template = await getKarmaConfigTemplate();
|
|
30
|
+
// TODO: Replace this with the actual schematic templating logic.
|
|
31
|
+
template = template
|
|
32
|
+
.replace(/<%= relativePathToWorkspaceRoot %>/g, (0, node_path_1.normalize)(relativePathToWorkspaceRoot).replace(/\\/g, '/'))
|
|
33
|
+
.replace(/<%= folderName %>/g, projectName);
|
|
34
|
+
const devkitPluginRegex = /<% if \(needDevkitPlugin\) { %>(.*?)<% } %>/gs;
|
|
35
|
+
const replacement = needDevkitPlugin ? '$1' : '';
|
|
36
|
+
template = template.replace(devkitPluginRegex, replacement);
|
|
37
|
+
return template;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Compares two Karma configuration analyses and returns the difference.
|
|
41
|
+
* @param projectAnalysis The analysis of the project's configuration.
|
|
42
|
+
* @param defaultAnalysis The analysis of the default configuration to compare against.
|
|
43
|
+
* @returns A diff object representing the changes between the two configurations.
|
|
44
|
+
*/
|
|
45
|
+
function compareKarmaConfigs(projectAnalysis, defaultAnalysis) {
|
|
46
|
+
const added = new Map();
|
|
47
|
+
const removed = new Map();
|
|
48
|
+
const modified = new Map();
|
|
49
|
+
const allKeys = new Set([
|
|
50
|
+
...projectAnalysis.settings.keys(),
|
|
51
|
+
...defaultAnalysis.settings.keys(),
|
|
52
|
+
]);
|
|
53
|
+
for (const key of allKeys) {
|
|
54
|
+
const projectValue = projectAnalysis.settings.get(key);
|
|
55
|
+
const defaultValue = defaultAnalysis.settings.get(key);
|
|
56
|
+
if (projectValue !== undefined && defaultValue === undefined) {
|
|
57
|
+
added.set(key, projectValue);
|
|
58
|
+
}
|
|
59
|
+
else if (projectValue === undefined && defaultValue !== undefined) {
|
|
60
|
+
removed.set(key, defaultValue);
|
|
61
|
+
}
|
|
62
|
+
else if (projectValue !== undefined && defaultValue !== undefined) {
|
|
63
|
+
if (!(0, node_util_1.isDeepStrictEqual)(projectValue, defaultValue)) {
|
|
64
|
+
modified.set(key, { projectValue, defaultValue });
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
added,
|
|
70
|
+
removed,
|
|
71
|
+
modified,
|
|
72
|
+
isReliable: !projectAnalysis.hasUnsupportedValues &&
|
|
73
|
+
!defaultAnalysis.hasUnsupportedValues,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Checks if there are any differences in the provided Karma configuration diff.
|
|
78
|
+
* @param diff The Karma configuration diff object to check.
|
|
79
|
+
* @returns True if there are any differences; false otherwise.
|
|
80
|
+
*/
|
|
81
|
+
function hasDifferences(diff) {
|
|
82
|
+
return diff.added.size > 0 || diff.removed.size > 0 || diff.modified.size > 0;
|
|
83
|
+
}
|
|
84
|
+
async function compareKarmaConfigToDefault(projectConfigOrAnalysis, projectName, karmaConfigPath, needDevkitPlugin) {
|
|
85
|
+
const projectAnalysis = typeof projectConfigOrAnalysis === 'string'
|
|
86
|
+
? (0, karma_config_analyzer_1.analyzeKarmaConfig)(projectConfigOrAnalysis)
|
|
87
|
+
: projectConfigOrAnalysis;
|
|
88
|
+
const defaultContent = await generateDefaultKarmaConfig(relativePathToWorkspaceRoot((0, node_path_1.dirname)(karmaConfigPath)), projectName, needDevkitPlugin);
|
|
89
|
+
const defaultAnalysis = (0, karma_config_analyzer_1.analyzeKarmaConfig)(defaultContent);
|
|
90
|
+
return compareKarmaConfigs(projectAnalysis, defaultAnalysis);
|
|
91
|
+
}
|
|
92
|
+
function relativePathToWorkspaceRoot(projectRoot) {
|
|
93
|
+
if (!projectRoot) {
|
|
94
|
+
return '.';
|
|
95
|
+
}
|
|
96
|
+
return (0, node_path_1.relative)((0, node_path_1.join)('/', projectRoot), '/') || '.';
|
|
97
|
+
}
|
|
98
|
+
const karmaConfigTemplateFallback = `// Karma configuration file, see link for more information
|
|
99
|
+
// https://karma-runner.github.io/1.0/config/configuration-file.html
|
|
100
|
+
|
|
101
|
+
module.exports = function (config) {
|
|
102
|
+
config.set({
|
|
103
|
+
basePath: '',
|
|
104
|
+
frameworks: ['jasmine'<% if (needDevkitPlugin) { %>, '@angular-devkit/build-angular'<% } %>],
|
|
105
|
+
plugins: [
|
|
106
|
+
require('karma-jasmine'),
|
|
107
|
+
require('karma-chrome-launcher'),
|
|
108
|
+
require('karma-jasmine-html-reporter'),
|
|
109
|
+
require('karma-coverage'),<% if (needDevkitPlugin) { %>
|
|
110
|
+
require('@angular-devkit/build-angular/plugins/karma')<% } %>
|
|
111
|
+
],
|
|
112
|
+
client: {
|
|
113
|
+
jasmine: {
|
|
114
|
+
// you can add configuration options for Jasmine here
|
|
115
|
+
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
|
|
116
|
+
// for example, you can disable the random execution with \`random: false\`
|
|
117
|
+
// or set a specific seed with \`seed: 4321\`
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
jasmineHtmlReporter: {
|
|
121
|
+
suppressAll: true // removes the duplicated traces
|
|
122
|
+
},
|
|
123
|
+
coverageReporter: {
|
|
124
|
+
dir: require('path').join(__dirname, '<%= relativePathToWorkspaceRoot %>/coverage/<%= folderName %>'),
|
|
125
|
+
subdir: '.',
|
|
126
|
+
reporters: [
|
|
127
|
+
{ type: 'html' },
|
|
128
|
+
{ type: 'text-summary' }
|
|
129
|
+
]
|
|
130
|
+
},
|
|
131
|
+
reporters: ['progress', 'kjhtml'],
|
|
132
|
+
browsers: ['Chrome'],
|
|
133
|
+
restartOnFileChange: true
|
|
134
|
+
});
|
|
135
|
+
};
|
|
136
|
+
`;
|
|
137
|
+
async function getKarmaConfigTemplate() {
|
|
138
|
+
try {
|
|
139
|
+
const templatePath = require.resolve('@schematics/angular/config/files/karma.conf.js.template');
|
|
140
|
+
return await (0, promises_1.readFile)(templatePath, 'utf-8');
|
|
141
|
+
}
|
|
142
|
+
catch (e) {
|
|
143
|
+
return karmaConfigTemplateFallback;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-angular-cli.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/migrations/update-21-6-1/update-angular-cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,IAAI,EAAc,MAAM,YAAY,CAAC;AAE3D,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAE3C,yBAA+B,IAAI,EAAE,IAAI,iBAkBxC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.angularCliVersion = void 0;
|
|
4
|
+
exports.default = default_1;
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
exports.angularCliVersion = '~20.3.0';
|
|
7
|
+
async function default_1(tree) {
|
|
8
|
+
let shouldFormat = false;
|
|
9
|
+
(0, devkit_1.updateJson)(tree, 'package.json', (json) => {
|
|
10
|
+
if (json.devDependencies?.['@angular/cli']) {
|
|
11
|
+
json.devDependencies['@angular/cli'] = exports.angularCliVersion;
|
|
12
|
+
shouldFormat = true;
|
|
13
|
+
}
|
|
14
|
+
else if (json.dependencies?.['@angular/cli']) {
|
|
15
|
+
json.dependencies['@angular/cli'] = exports.angularCliVersion;
|
|
16
|
+
shouldFormat = true;
|
|
17
|
+
}
|
|
18
|
+
return json;
|
|
19
|
+
});
|
|
20
|
+
if (shouldFormat) {
|
|
21
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -5,7 +5,7 @@ type CompatPackageVersionNames = LatestPackageVersionNames;
|
|
|
5
5
|
export type PackageVersionNames = LatestPackageVersionNames | CompatPackageVersionNames;
|
|
6
6
|
export type VersionMap = {
|
|
7
7
|
angularV18: Record<CompatPackageVersionNames, string>;
|
|
8
|
-
angularV19: Record<CompatPackageVersionNames, string>;
|
|
8
|
+
angularV19: Record<CompatPackageVersionNames | 'angularRspackVersion', string>;
|
|
9
9
|
};
|
|
10
10
|
export type PackageLatestVersions = Record<LatestPackageVersionNames, string>;
|
|
11
11
|
export type PackageCompatVersions = VersionMap[SupportedVersions];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backward-compatible-versions.d.ts","sourceRoot":"","sources":["../../../../../packages/angular/src/utils/backward-compatible-versions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc,MAAM,YAAY,CAAC;AAE7C,KAAK,iBAAiB,GAAG,YAAY,GAAG,YAAY,CAAC;AAErD,KAAK,yBAAyB,GAAG,OAAO,CACtC,MAAM,OAAO,cAAc,EAC3B,WAAW,CACZ,CAAC;AACF,KAAK,yBAAyB,GAAG,yBAAyB,CAAC;AAE3D,MAAM,MAAM,mBAAmB,GAC3B,yBAAyB,GACzB,yBAAyB,CAAC;AAE9B,MAAM,MAAM,UAAU,GAAG;IACvB,UAAU,EAAE,MAAM,CAAC,yBAAyB,EAAE,MAAM,CAAC,CAAC;IACtD,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"backward-compatible-versions.d.ts","sourceRoot":"","sources":["../../../../../packages/angular/src/utils/backward-compatible-versions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc,MAAM,YAAY,CAAC;AAE7C,KAAK,iBAAiB,GAAG,YAAY,GAAG,YAAY,CAAC;AAErD,KAAK,yBAAyB,GAAG,OAAO,CACtC,MAAM,OAAO,cAAc,EAC3B,WAAW,CACZ,CAAC;AACF,KAAK,yBAAyB,GAAG,yBAAyB,CAAC;AAE3D,MAAM,MAAM,mBAAmB,GAC3B,yBAAyB,GACzB,yBAAyB,CAAC;AAE9B,MAAM,MAAM,UAAU,GAAG;IACvB,UAAU,EAAE,MAAM,CAAC,yBAAyB,EAAE,MAAM,CAAC,CAAC;IACtD,UAAU,EAAE,MAAM,CAChB,yBAAyB,GAAG,sBAAsB,EAClD,MAAM,CACP,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,yBAAyB,EAAE,MAAM,CAAC,CAAC;AAC9E,MAAM,MAAM,qBAAqB,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC;AAElE,eAAO,MAAM,0BAA0B,EAAE,UA8DxC,CAAC"}
|