@nx/angular 17.1.0-beta.3 → 17.1.0-rc.0
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/migrations.json +37 -37
- package/package.json +14 -14
- package/src/executors/utilities/typescript.js +1 -1
- package/src/generators/application/lib/add-unit-test-runner.js +1 -11
- package/src/generators/library/library.js +1 -10
- package/src/generators/utils/version-utils.d.ts +2 -2
- package/src/generators/utils/version-utils.js +1 -1
- package/src/migrations/update-17-1-0/update-angular-cli.d.ts +1 -1
- package/src/migrations/update-17-1-0/update-angular-cli.js +1 -1
- package/src/migrations/update-17-1-0/update-zone-js-deep-import.js +37 -0
- package/src/utils/backward-compatible-versions.d.ts +5 -3
- package/src/utils/version-utils.d.ts +3 -3
- package/src/utils/versions.d.ts +4 -5
- package/src/utils/versions.js +5 -6
- package/src/migrations/update-17-1-0/stub-performance-mark-in-jest-test-setup.js +0 -63
- /package/src/migrations/update-17-1-0/{stub-performance-mark-in-jest-test-setup.d.ts → update-zone-js-deep-import.d.ts} +0 -0
package/migrations.json
CHANGED
|
@@ -279,50 +279,50 @@
|
|
|
279
279
|
"description": "Update the @angular/cli package version to ~16.2.0.",
|
|
280
280
|
"factory": "./src/migrations/update-16-7-0/update-angular-cli"
|
|
281
281
|
},
|
|
282
|
-
"update-angular-cli-version-17-0-0
|
|
282
|
+
"update-angular-cli-version-17-0-0": {
|
|
283
283
|
"cli": "nx",
|
|
284
|
-
"version": "17.1.0-beta.
|
|
284
|
+
"version": "17.1.0-beta.5",
|
|
285
285
|
"requires": {
|
|
286
|
-
"@angular/core": ">=17.0.0
|
|
286
|
+
"@angular/core": ">=17.0.0"
|
|
287
287
|
},
|
|
288
|
-
"description": "Update the @angular/cli package version to ~17.0.0
|
|
288
|
+
"description": "Update the @angular/cli package version to ~17.0.0.",
|
|
289
289
|
"factory": "./src/migrations/update-17-1-0/update-angular-cli"
|
|
290
290
|
},
|
|
291
291
|
"rename-browser-target-to-build-target": {
|
|
292
292
|
"cli": "nx",
|
|
293
|
-
"version": "17.1.0-beta.
|
|
293
|
+
"version": "17.1.0-beta.5",
|
|
294
294
|
"requires": {
|
|
295
|
-
"@angular/core": ">=17.0.0
|
|
295
|
+
"@angular/core": ">=17.0.0"
|
|
296
296
|
},
|
|
297
297
|
"description": "Rename 'browserTarget' to 'buildTarget'.",
|
|
298
298
|
"factory": "./src/migrations/update-17-1-0/browser-target-to-build-target"
|
|
299
299
|
},
|
|
300
|
-
"stub-performance-mark-in-jest-test-setup": {
|
|
301
|
-
"cli": "nx",
|
|
302
|
-
"version": "17.1.0-beta.3",
|
|
303
|
-
"requires": {
|
|
304
|
-
"@angular/core": ">=17.0.0-rc.3"
|
|
305
|
-
},
|
|
306
|
-
"description": "Stubs out 'performance.mark' in the Jest test setup file.",
|
|
307
|
-
"factory": "./src/migrations/update-17-1-0/stub-performance-mark-in-jest-test-setup"
|
|
308
|
-
},
|
|
309
300
|
"replace-nguniversal-builders": {
|
|
310
301
|
"cli": "nx",
|
|
311
|
-
"version": "17.1.0-beta.
|
|
302
|
+
"version": "17.1.0-beta.5",
|
|
312
303
|
"requires": {
|
|
313
|
-
"@angular/core": ">=17.0.0
|
|
304
|
+
"@angular/core": ">=17.0.0"
|
|
314
305
|
},
|
|
315
306
|
"description": "Replace usages of '@nguniversal/builders' with '@angular-devkit/build-angular'.",
|
|
316
307
|
"factory": "./src/migrations/update-17-1-0/replace-nguniversal-builders"
|
|
317
308
|
},
|
|
318
309
|
"replace-nguniversal-engines": {
|
|
319
310
|
"cli": "nx",
|
|
320
|
-
"version": "17.1.0-beta.
|
|
311
|
+
"version": "17.1.0-beta.5",
|
|
321
312
|
"requires": {
|
|
322
|
-
"@angular/core": ">=17.0.0
|
|
313
|
+
"@angular/core": ">=17.0.0"
|
|
323
314
|
},
|
|
324
315
|
"description": "Replace usages of '@nguniversal/' packages with '@angular/ssr'.",
|
|
325
316
|
"factory": "./src/migrations/update-17-1-0/replace-nguniversal-engines"
|
|
317
|
+
},
|
|
318
|
+
"update-zone-js-deep-import": {
|
|
319
|
+
"cli": "nx",
|
|
320
|
+
"version": "17.1.0-beta.5",
|
|
321
|
+
"requires": {
|
|
322
|
+
"@angular/core": ">=17.0.0"
|
|
323
|
+
},
|
|
324
|
+
"description": "Replace the deep imports from 'zone.js/dist/zone' and 'zone.js/dist/zone-testing' with 'zone.js' and 'zone.js/testing'.",
|
|
325
|
+
"factory": "./src/migrations/update-17-1-0/update-zone-js-deep-import"
|
|
326
326
|
}
|
|
327
327
|
},
|
|
328
328
|
"packageJsonUpdates": {
|
|
@@ -1401,50 +1401,50 @@
|
|
|
1401
1401
|
}
|
|
1402
1402
|
},
|
|
1403
1403
|
"17.1.0": {
|
|
1404
|
-
"version": "17.1.0-beta.
|
|
1404
|
+
"version": "17.1.0-beta.5",
|
|
1405
1405
|
"x-prompt": "Do you want to update the Angular version to v17?",
|
|
1406
1406
|
"requires": {
|
|
1407
|
-
"@angular/core": ">=16.2.0 <17.0.0
|
|
1407
|
+
"@angular/core": ">=16.2.0 <17.0.0"
|
|
1408
1408
|
},
|
|
1409
1409
|
"packages": {
|
|
1410
1410
|
"@angular-devkit/architect": {
|
|
1411
|
-
"version": "~0.1700.0
|
|
1411
|
+
"version": "~0.1700.0",
|
|
1412
1412
|
"alwaysAddToPackageJson": false
|
|
1413
1413
|
},
|
|
1414
1414
|
"@angular-devkit/build-angular": {
|
|
1415
|
-
"version": "~17.0.0
|
|
1415
|
+
"version": "~17.0.0",
|
|
1416
1416
|
"alwaysAddToPackageJson": false
|
|
1417
1417
|
},
|
|
1418
1418
|
"@angular-devkit/build-webpack": {
|
|
1419
|
-
"version": "~0.1700.0
|
|
1419
|
+
"version": "~0.1700.0",
|
|
1420
1420
|
"alwaysAddToPackageJson": false
|
|
1421
1421
|
},
|
|
1422
1422
|
"@angular-devkit/core": {
|
|
1423
|
-
"version": "~17.0.0
|
|
1423
|
+
"version": "~17.0.0",
|
|
1424
1424
|
"alwaysAddToPackageJson": false
|
|
1425
1425
|
},
|
|
1426
1426
|
"@angular-devkit/schematics": {
|
|
1427
|
-
"version": "~17.0.0
|
|
1427
|
+
"version": "~17.0.0",
|
|
1428
1428
|
"alwaysAddToPackageJson": false
|
|
1429
1429
|
},
|
|
1430
1430
|
"@angular/core": {
|
|
1431
|
-
"version": "~17.0.0
|
|
1431
|
+
"version": "~17.0.0",
|
|
1432
1432
|
"alwaysAddToPackageJson": true
|
|
1433
1433
|
},
|
|
1434
1434
|
"@angular/material": {
|
|
1435
|
-
"version": "~17.0.0
|
|
1435
|
+
"version": "~17.0.0",
|
|
1436
1436
|
"alwaysAddToPackageJson": false
|
|
1437
1437
|
},
|
|
1438
1438
|
"@angular/cdk": {
|
|
1439
|
-
"version": "~17.0.0
|
|
1439
|
+
"version": "~17.0.0",
|
|
1440
1440
|
"alwaysAddToPackageJson": false
|
|
1441
1441
|
},
|
|
1442
1442
|
"@schematics/angular": {
|
|
1443
|
-
"version": "~17.0.0
|
|
1443
|
+
"version": "~17.0.0",
|
|
1444
1444
|
"alwaysAddToPackageJson": false
|
|
1445
1445
|
},
|
|
1446
1446
|
"ng-packagr": {
|
|
1447
|
-
"version": "~17.0.0
|
|
1447
|
+
"version": "~17.0.0",
|
|
1448
1448
|
"alwaysAddToPackageJson": false
|
|
1449
1449
|
},
|
|
1450
1450
|
"zone.js": {
|
|
@@ -1454,7 +1454,7 @@
|
|
|
1454
1454
|
}
|
|
1455
1455
|
},
|
|
1456
1456
|
"17.1.0-jest": {
|
|
1457
|
-
"version": "17.1.0-beta.
|
|
1457
|
+
"version": "17.1.0-beta.5",
|
|
1458
1458
|
"requires": {
|
|
1459
1459
|
"@angular-devkit/build-angular": ">=13.0.0 <18.0.0",
|
|
1460
1460
|
"@angular/compiler-cli": ">=13.0.0 <18.0.0",
|
|
@@ -1470,22 +1470,22 @@
|
|
|
1470
1470
|
}
|
|
1471
1471
|
},
|
|
1472
1472
|
"17.1.0-angular-eslint": {
|
|
1473
|
-
"version": "17.1.0-beta.
|
|
1473
|
+
"version": "17.1.0-beta.5",
|
|
1474
1474
|
"requires": {
|
|
1475
1475
|
"eslint": "^7.20.0 || ^8.0.0",
|
|
1476
|
-
"@angular/core": ">= 17.0.0
|
|
1476
|
+
"@angular/core": ">= 17.0.0 < 18.0.0"
|
|
1477
1477
|
},
|
|
1478
1478
|
"packages": {
|
|
1479
1479
|
"@angular-eslint/eslint-plugin": {
|
|
1480
|
-
"version": "~17.0.0
|
|
1480
|
+
"version": "~17.0.0",
|
|
1481
1481
|
"alwaysAddToPackageJson": false
|
|
1482
1482
|
},
|
|
1483
1483
|
"@angular-eslint/eslint-plugin-template": {
|
|
1484
|
-
"version": "~17.0.0
|
|
1484
|
+
"version": "~17.0.0",
|
|
1485
1485
|
"alwaysAddToPackageJson": false
|
|
1486
1486
|
},
|
|
1487
1487
|
"@angular-eslint/template-parser": {
|
|
1488
|
-
"version": "~17.0.0
|
|
1488
|
+
"version": "~17.0.0",
|
|
1489
1489
|
"alwaysAddToPackageJson": false
|
|
1490
1490
|
}
|
|
1491
1491
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/angular",
|
|
3
|
-
"version": "17.1.0-
|
|
3
|
+
"version": "17.1.0-rc.0",
|
|
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, 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- Upgrading AngularJS applications \n\n- Single Component Application Modules (SCAMs) \n\n- NgRx helpers. \n\n- Utilities for automatic workspace refactoring.",
|
|
6
6
|
"repository": {
|
|
@@ -78,21 +78,21 @@
|
|
|
78
78
|
"tslib": "^2.3.0",
|
|
79
79
|
"webpack": "^5.80.0",
|
|
80
80
|
"webpack-merge": "^5.8.0",
|
|
81
|
-
"@nx/devkit": "17.1.0-
|
|
82
|
-
"@nx/cypress": "17.1.0-
|
|
83
|
-
"@nx/jest": "17.1.0-
|
|
84
|
-
"@nx/js": "17.1.0-
|
|
85
|
-
"@nx/eslint": "17.1.0-
|
|
86
|
-
"@nx/webpack": "17.1.0-
|
|
87
|
-
"@nx/web": "17.1.0-
|
|
88
|
-
"@nx/workspace": "17.1.0-
|
|
89
|
-
"@nrwl/angular": "17.1.0-
|
|
81
|
+
"@nx/devkit": "17.1.0-rc.0",
|
|
82
|
+
"@nx/cypress": "17.1.0-rc.0",
|
|
83
|
+
"@nx/jest": "17.1.0-rc.0",
|
|
84
|
+
"@nx/js": "17.1.0-rc.0",
|
|
85
|
+
"@nx/eslint": "17.1.0-rc.0",
|
|
86
|
+
"@nx/webpack": "17.1.0-rc.0",
|
|
87
|
+
"@nx/web": "17.1.0-rc.0",
|
|
88
|
+
"@nx/workspace": "17.1.0-rc.0",
|
|
89
|
+
"@nrwl/angular": "17.1.0-rc.0"
|
|
90
90
|
},
|
|
91
91
|
"peerDependencies": {
|
|
92
|
-
"@angular-devkit/build-angular": "
|
|
93
|
-
"@angular-devkit/schematics": "
|
|
94
|
-
"@schematics/angular": "
|
|
95
|
-
"@angular-devkit/core": "
|
|
92
|
+
"@angular-devkit/build-angular": ">= 15.0.0 < 18.0.0",
|
|
93
|
+
"@angular-devkit/schematics": ">= 15.0.0 < 18.0.0",
|
|
94
|
+
"@schematics/angular": ">= 15.0.0 < 18.0.0",
|
|
95
|
+
"@angular-devkit/core": ">= 15.0.0 < 18.0.0",
|
|
96
96
|
"rxjs": "^6.5.3 || ^7.5.0",
|
|
97
97
|
"esbuild": "^0.19.2"
|
|
98
98
|
},
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
*/
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
11
|
exports.parseRemappedTsConfigAndMergeDefaults = void 0;
|
|
12
|
-
const ng_compiler_cli_1 = require("ng-packagr/lib/utils/ng-compiler-cli");
|
|
13
12
|
const path_1 = require("path");
|
|
14
13
|
const ts = require("typescript");
|
|
14
|
+
const ng_compiler_cli_1 = require("./ng-compiler-cli");
|
|
15
15
|
async function readDefaultTsConfig(fileName) {
|
|
16
16
|
// these options are mandatory
|
|
17
17
|
const extraOptions = {
|
|
@@ -4,7 +4,6 @@ exports.addUnitTestRunner = void 0;
|
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const jest_1 = require("@nx/jest");
|
|
6
6
|
const test_runners_1 = require("../../../utils/test-runners");
|
|
7
|
-
const version_utils_1 = require("../../utils/version-utils");
|
|
8
7
|
async function addUnitTestRunner(host, options) {
|
|
9
8
|
if (options.unitTestRunner === test_runners_1.UnitTestRunner.Jest) {
|
|
10
9
|
await (0, jest_1.configurationGenerator)(host, {
|
|
@@ -16,7 +15,6 @@ async function addUnitTestRunner(host, options) {
|
|
|
16
15
|
skipFormat: true,
|
|
17
16
|
});
|
|
18
17
|
const setupFile = (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'src', 'test-setup.ts');
|
|
19
|
-
const { major: angularMajorVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(host);
|
|
20
18
|
if (options.strict && host.exists(setupFile)) {
|
|
21
19
|
const contents = host.read(setupFile, 'utf-8');
|
|
22
20
|
host.write(setupFile, `// @ts-expect-error https://thymikee.github.io/jest-preset-angular/docs/getting-started/test-environment
|
|
@@ -26,15 +24,7 @@ globalThis.ngJest = {
|
|
|
26
24
|
errorOnUnknownProperties: true,
|
|
27
25
|
},
|
|
28
26
|
};
|
|
29
|
-
${contents}
|
|
30
|
-
? `
|
|
31
|
-
/**
|
|
32
|
-
* Angular uses performance.mark() which is not supported by jsdom. Stub it out
|
|
33
|
-
* to avoid errors.
|
|
34
|
-
*/
|
|
35
|
-
global.performance.mark = jest.fn();
|
|
36
|
-
`
|
|
37
|
-
: ''}`);
|
|
27
|
+
${contents}`);
|
|
38
28
|
}
|
|
39
29
|
}
|
|
40
30
|
}
|
|
@@ -94,7 +94,6 @@ async function addUnitTestRunner(host, options) {
|
|
|
94
94
|
skipPackageJson: options.skipPackageJson,
|
|
95
95
|
});
|
|
96
96
|
const setupFile = (0, devkit_1.joinPathFragments)(options.projectRoot, 'src', 'test-setup.ts');
|
|
97
|
-
const { major: angularMajorVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(host);
|
|
98
97
|
if (options.strict && host.exists(setupFile)) {
|
|
99
98
|
const contents = host.read(setupFile, 'utf-8');
|
|
100
99
|
host.write(setupFile, `// @ts-expect-error https://thymikee.github.io/jest-preset-angular/docs/getting-started/test-environment
|
|
@@ -104,15 +103,7 @@ globalThis.ngJest = {
|
|
|
104
103
|
errorOnUnknownProperties: true,
|
|
105
104
|
},
|
|
106
105
|
};
|
|
107
|
-
${contents}
|
|
108
|
-
? `
|
|
109
|
-
/**
|
|
110
|
-
* Angular uses performance.mark() which is not supported by jsdom. Stub it out
|
|
111
|
-
* to avoid errors.
|
|
112
|
-
*/
|
|
113
|
-
global.performance.mark = jest.fn();
|
|
114
|
-
`
|
|
115
|
-
: ''}`);
|
|
106
|
+
${contents}`);
|
|
116
107
|
}
|
|
117
108
|
}
|
|
118
109
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { GeneratorCallback, Tree } from '@nx/devkit';
|
|
2
|
-
import
|
|
2
|
+
import { type PackageCompatVersions, type PackageLatestVersions } from '../../utils/backward-compatible-versions';
|
|
3
3
|
export declare function getInstalledAngularVersion(tree: Tree): string;
|
|
4
4
|
export declare function getInstalledAngularMajorVersion(tree: Tree): number;
|
|
5
5
|
export declare function getInstalledAngularVersionInfo(tree: Tree): {
|
|
@@ -12,4 +12,4 @@ export declare function getInstalledPackageVersionInfo(tree: Tree, pkgName: stri
|
|
|
12
12
|
version: string;
|
|
13
13
|
};
|
|
14
14
|
export declare function addDependenciesToPackageJsonIfDontExist(tree: Tree, dependencies: Record<string, string>, devDependencies: Record<string, string>, packageJsonPath?: string): GeneratorCallback;
|
|
15
|
-
export declare function versions(tree: Tree):
|
|
15
|
+
export declare function versions(tree: Tree): PackageLatestVersions | PackageCompatVersions;
|
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.versions = exports.addDependenciesToPackageJsonIfDontExist = exports.getInstalledPackageVersionInfo = exports.getInstalledPackageVersion = exports.getInstalledAngularVersionInfo = exports.getInstalledAngularMajorVersion = exports.getInstalledAngularVersion = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const semver_1 = require("semver");
|
|
6
|
+
const backward_compatible_versions_1 = require("../../utils/backward-compatible-versions");
|
|
6
7
|
const latestVersions = require("../../utils/versions");
|
|
7
8
|
const versions_1 = require("../../utils/versions");
|
|
8
|
-
const backward_compatible_versions_1 = require("../../utils/backward-compatible-versions");
|
|
9
9
|
function getInstalledAngularVersion(tree) {
|
|
10
10
|
const pkgJson = (0, devkit_1.readJson)(tree, 'package.json');
|
|
11
11
|
const installedAngularVersion = pkgJson.dependencies && pkgJson.dependencies['@angular/core'];
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.angularCliVersion = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
exports.angularCliVersion = '~17.0.0
|
|
5
|
+
exports.angularCliVersion = '~17.0.0';
|
|
6
6
|
async function default_1(tree) {
|
|
7
7
|
let shouldFormat = false;
|
|
8
8
|
(0, devkit_1.updateJson)(tree, 'package.json', (json) => {
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const devkit_1 = require("@nx/devkit");
|
|
4
|
+
const projects_1 = require("../utils/projects");
|
|
5
|
+
async function default_1(tree) {
|
|
6
|
+
const angularProjects = await (0, projects_1.getProjectsFilteredByDependencies)(tree, [
|
|
7
|
+
'npm:@angular/core',
|
|
8
|
+
]);
|
|
9
|
+
if (!angularProjects.length) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
const zoneJsImportRegex = /(['"`])zone\.js\/dist\/zone(['"`])/g;
|
|
13
|
+
const zoneJsTestingImportRegex = /(['"`])zone\.js\/dist\/zone-testing(['"`])/g;
|
|
14
|
+
for (const { project } of angularProjects) {
|
|
15
|
+
(0, devkit_1.visitNotIgnoredFiles)(tree, project.root, (file) => {
|
|
16
|
+
// we are only interested in .ts files
|
|
17
|
+
if (!file.endsWith('.ts')) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
let content = tree.read(file, 'utf-8');
|
|
21
|
+
let wasUpdated = false;
|
|
22
|
+
if (zoneJsImportRegex.test(content)) {
|
|
23
|
+
content = content.replace(zoneJsImportRegex, '$1zone.js$2');
|
|
24
|
+
wasUpdated = true;
|
|
25
|
+
}
|
|
26
|
+
if (zoneJsTestingImportRegex.test(content)) {
|
|
27
|
+
content = content.replace(zoneJsTestingImportRegex, '$1zone.js/testing$2');
|
|
28
|
+
wasUpdated = true;
|
|
29
|
+
}
|
|
30
|
+
if (wasUpdated) {
|
|
31
|
+
tree.write(file, content);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
36
|
+
}
|
|
37
|
+
exports.default = default_1;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as latestVersions from './versions';
|
|
2
2
|
type SupportedVersions = 'angularV15' | 'angularV16';
|
|
3
|
-
export type
|
|
4
|
-
export type
|
|
5
|
-
export
|
|
3
|
+
export type LatestPackageVersionNames = Exclude<keyof typeof latestVersions, 'nxVersion'>;
|
|
4
|
+
export type CompatPackageVersionNames = LatestPackageVersionNames | 'ngUniversalVersion';
|
|
5
|
+
export type PackageLatestVersions = Record<LatestPackageVersionNames, string>;
|
|
6
|
+
export type PackageCompatVersions = Record<CompatPackageVersionNames, string>;
|
|
7
|
+
export declare const backwardCompatibleVersions: Record<SupportedVersions, PackageCompatVersions>;
|
|
6
8
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function getPkgVersionForAngularMajorVersion(pkgVersionName:
|
|
3
|
-
export declare function getPkgVersionsForAngularMajorVersion(angularMajorVersion: number):
|
|
1
|
+
import type { CompatPackageVersionNames, LatestPackageVersionNames, PackageCompatVersions, PackageLatestVersions } from './backward-compatible-versions';
|
|
2
|
+
export declare function getPkgVersionForAngularMajorVersion(pkgVersionName: LatestPackageVersionNames | CompatPackageVersionNames, angularMajorVersion: number): string;
|
|
3
|
+
export declare function getPkgVersionsForAngularMajorVersion(angularMajorVersion: number): PackageLatestVersions | PackageCompatVersions;
|
package/src/utils/versions.d.ts
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
export declare const nxVersion: any;
|
|
2
|
-
export declare const angularVersion = "~17.0.0
|
|
3
|
-
export declare const angularDevkitVersion = "~17.0.0
|
|
4
|
-
export declare const ngPackagrVersion = "~17.0.0
|
|
2
|
+
export declare const angularVersion = "~17.0.0";
|
|
3
|
+
export declare const angularDevkitVersion = "~17.0.0";
|
|
4
|
+
export declare const ngPackagrVersion = "~17.0.0";
|
|
5
5
|
export declare const ngrxVersion = "~16.0.0";
|
|
6
6
|
export declare const rxjsVersion = "~7.8.0";
|
|
7
7
|
export declare const zoneJsVersion = "~0.14.0";
|
|
8
8
|
export declare const angularJsVersion = "1.7.9";
|
|
9
9
|
export declare const tsLibVersion = "^2.3.0";
|
|
10
|
-
export declare const ngUniversalVersion = "~16.2.0";
|
|
11
10
|
export declare const corsVersion = "~2.8.5";
|
|
12
11
|
export declare const typesCorsVersion = "~2.8.5";
|
|
13
12
|
export declare const expressVersion = "~4.18.2";
|
|
14
13
|
export declare const typesExpressVersion = "4.17.14";
|
|
15
14
|
export declare const moduleFederationNodeVersion = "~1.0.5";
|
|
16
|
-
export declare const angularEslintVersion = "~17.0.0
|
|
15
|
+
export declare const angularEslintVersion = "~17.0.0";
|
|
17
16
|
export declare const tailwindVersion = "^3.0.2";
|
|
18
17
|
export declare const postcssVersion = "^8.4.5";
|
|
19
18
|
export declare const postcssImportVersion = "~14.1.0";
|
package/src/utils/versions.js
CHANGED
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.jsoncEslintParserVersion = exports.jasmineMarblesVersion = exports.typesNodeVersion = exports.jestPresetAngularVersion = exports.tsNodeVersion = exports.autoprefixerVersion = exports.postcssUrlVersion = exports.postcssPresetEnvVersion = exports.postcssImportVersion = exports.postcssVersion = exports.tailwindVersion = exports.angularEslintVersion = exports.moduleFederationNodeVersion = exports.typesExpressVersion = exports.expressVersion = exports.typesCorsVersion = exports.corsVersion = exports.
|
|
3
|
+
exports.jsoncEslintParserVersion = exports.jasmineMarblesVersion = exports.typesNodeVersion = exports.jestPresetAngularVersion = exports.tsNodeVersion = exports.autoprefixerVersion = exports.postcssUrlVersion = exports.postcssPresetEnvVersion = exports.postcssImportVersion = exports.postcssVersion = exports.tailwindVersion = exports.angularEslintVersion = exports.moduleFederationNodeVersion = exports.typesExpressVersion = exports.expressVersion = exports.typesCorsVersion = exports.corsVersion = exports.tsLibVersion = exports.angularJsVersion = exports.zoneJsVersion = exports.rxjsVersion = exports.ngrxVersion = exports.ngPackagrVersion = exports.angularDevkitVersion = exports.angularVersion = exports.nxVersion = void 0;
|
|
4
4
|
exports.nxVersion = require('../../package.json').version;
|
|
5
|
-
exports.angularVersion = '~17.0.0
|
|
6
|
-
exports.angularDevkitVersion = '~17.0.0
|
|
7
|
-
exports.ngPackagrVersion = '~17.0.0
|
|
5
|
+
exports.angularVersion = '~17.0.0';
|
|
6
|
+
exports.angularDevkitVersion = '~17.0.0';
|
|
7
|
+
exports.ngPackagrVersion = '~17.0.0';
|
|
8
8
|
exports.ngrxVersion = '~16.0.0';
|
|
9
9
|
exports.rxjsVersion = '~7.8.0';
|
|
10
10
|
exports.zoneJsVersion = '~0.14.0';
|
|
11
11
|
exports.angularJsVersion = '1.7.9';
|
|
12
12
|
exports.tsLibVersion = '^2.3.0';
|
|
13
|
-
exports.ngUniversalVersion = '~16.2.0';
|
|
14
13
|
exports.corsVersion = '~2.8.5';
|
|
15
14
|
exports.typesCorsVersion = '~2.8.5';
|
|
16
15
|
exports.expressVersion = '~4.18.2';
|
|
17
16
|
exports.typesExpressVersion = '4.17.14';
|
|
18
17
|
exports.moduleFederationNodeVersion = '~1.0.5';
|
|
19
|
-
exports.angularEslintVersion = '~17.0.0
|
|
18
|
+
exports.angularEslintVersion = '~17.0.0';
|
|
20
19
|
exports.tailwindVersion = '^3.0.2';
|
|
21
20
|
exports.postcssVersion = '^8.4.5';
|
|
22
21
|
exports.postcssImportVersion = '~14.1.0';
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const devkit_1 = require("@nx/devkit");
|
|
4
|
-
const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
|
|
5
|
-
const tsquery_1 = require("@phenomnomnominal/tsquery");
|
|
6
|
-
const path_1 = require("path");
|
|
7
|
-
const ts = require("typescript");
|
|
8
|
-
const projects_1 = require("../utils/projects");
|
|
9
|
-
async function default_1(tree) {
|
|
10
|
-
const angularProjects = await (0, projects_1.getProjectsFilteredByDependencies)(tree, [
|
|
11
|
-
'npm:@angular/core',
|
|
12
|
-
]);
|
|
13
|
-
const jestConfigFiles = new Set();
|
|
14
|
-
const projectGraph = await (0, devkit_1.createProjectGraphAsync)();
|
|
15
|
-
(0, executor_options_utils_1.forEachExecutorOptionsInGraph)(projectGraph, '@nx/jest:jest', (options, projectName) => {
|
|
16
|
-
const projectConfig = angularProjects.find(({ project }) => projectName === project.name);
|
|
17
|
-
if (!projectConfig) {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
if (options.jestConfig && tree.exists(options.jestConfig)) {
|
|
21
|
-
jestConfigFiles.add(options.jestConfig);
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
const setupFilePaths = [];
|
|
25
|
-
for (const jestConfigFile of jestConfigFiles) {
|
|
26
|
-
const projectSetupFilePaths = getSetupFilePaths(tree, jestConfigFile);
|
|
27
|
-
setupFilePaths.push(...projectSetupFilePaths);
|
|
28
|
-
}
|
|
29
|
-
for (const setupFilePath of setupFilePaths) {
|
|
30
|
-
if (!tree.exists(setupFilePath)) {
|
|
31
|
-
continue;
|
|
32
|
-
}
|
|
33
|
-
updateSetupFileWithPerformanceMarkStub(tree, setupFilePath);
|
|
34
|
-
}
|
|
35
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
36
|
-
}
|
|
37
|
-
exports.default = default_1;
|
|
38
|
-
function getSetupFilePaths(tree, jestConfigFile) {
|
|
39
|
-
const config = tree.read(jestConfigFile, 'utf-8');
|
|
40
|
-
const TS_QUERY_JEST_CONFIG_PREFIX = ':matches(ExportAssignment, BinaryExpression:has(Identifier[name="module"]):has(Identifier[name="exports"]))';
|
|
41
|
-
const setupFilePathNodes = tsquery_1.tsquery.query(config, `${TS_QUERY_JEST_CONFIG_PREFIX} > ObjectLiteralExpression PropertyAssignment:has(Identifier[name="setupFilesAfterEnv"]) > ArrayLiteralExpression StringLiteral`);
|
|
42
|
-
const rootDir = (0, path_1.dirname)(jestConfigFile);
|
|
43
|
-
const setupFilePaths = setupFilePathNodes.map((node) => node.text.replace('<rootDir>', rootDir));
|
|
44
|
-
return setupFilePaths;
|
|
45
|
-
}
|
|
46
|
-
function updateSetupFileWithPerformanceMarkStub(tree, setupFilePath) {
|
|
47
|
-
const setupFile = tree.read(setupFilePath, 'utf-8');
|
|
48
|
-
const setupFileSource = ts.createSourceFile(setupFilePath, setupFile, ts.ScriptTarget.Latest);
|
|
49
|
-
const TS_QUERY_PERFORMANCE_MARK_ACCESS = 'PropertyAccessExpression:has(Identifier[name=performance]):has(Identifier[name=mark])';
|
|
50
|
-
const TS_QUERY_PERFORMANCE_MARK_ASSIGNMENT = 'PropertyAccessExpression:has(Identifier[name=performance]) + EqualsToken + ObjectLiteralExpression:has(PropertyAssignment Identifier[name=mark])';
|
|
51
|
-
const performanceMarkNodes = tsquery_1.tsquery.query(setupFileSource, `:matches(${TS_QUERY_PERFORMANCE_MARK_ACCESS}, ${TS_QUERY_PERFORMANCE_MARK_ASSIGNMENT})`);
|
|
52
|
-
// there is already some access to performance.mark, so we assume it was handled already
|
|
53
|
-
if (performanceMarkNodes.length) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
tree.write(setupFilePath, `${setupFile}
|
|
57
|
-
/**
|
|
58
|
-
* Angular uses performance.mark() which is not supported by jsdom. Stub it out
|
|
59
|
-
* to avoid errors.
|
|
60
|
-
*/
|
|
61
|
-
global.performance.mark = jest.fn();
|
|
62
|
-
`);
|
|
63
|
-
}
|