## Third-party deps support for Angular v19
- [x] `jest-preset-angular`
- [x] PRs:
- [x] https://github.com/thymikee/jest-preset-angular/pull/2835
- [x] Released:
- [x] RC:
https://github.com/thymikee/jest-preset-angular/releases/tag/v14.4.0-rc.0
- [x] Stable:
https://github.com/thymikee/jest-preset-angular/releases/tag/v14.4.0
- [x] Angular ESLint
- [x] PRs:
- [x] https://github.com/angular-eslint/angular-eslint/pull/2109
- [x] Released:
- [x]
https://github.com/angular-eslint/angular-eslint/releases/tag/v19.0.0
- [x] Storybook
- [x] PRs:
- [x] https://github.com/storybookjs/storybook/pull/29659
- [x] https://github.com/storybookjs/storybook/pull/29677
- [x] Released:
- [x] https://github.com/storybookjs/storybook/pull/29679
- [ ] NgRx
- [x] PRs:
- [x] https://github.com/ngrx/platform/pull/4602
- [ ] Released:
- [x] Beta:
https://github.com/ngrx/platform/blob/main/CHANGELOG.md#1900-beta0-2024-11-20
- [ ] Stable:
- [ ] Analog
- [x] PRs:
- [x] https://github.com/analogjs/analog/pull/1447
- [x] https://github.com/analogjs/analog/pull/1451
- [ ] Released:
- [x] Beta:
https://github.com/analogjs/analog/releases/tag/v1.10.0-beta.6
- [ ] Stable:
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->
<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->
<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->
## Current Behavior
<!-- This is the behavior we have today -->
Angular v19 is not supported.
## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
Angular v19 should be supported.
## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->
Fixes #29028
71 lines
2.0 KiB
TypeScript
71 lines
2.0 KiB
TypeScript
import { readJson, type Tree } from '@nx/devkit';
|
|
import { clean, coerce, major } from 'semver';
|
|
import {
|
|
backwardCompatibleVersions,
|
|
type PackageCompatVersions,
|
|
type PackageLatestVersions,
|
|
} from '../../utils/backward-compatible-versions';
|
|
import * as latestVersions from '../../utils/versions';
|
|
import { angularVersion } from '../../utils/versions';
|
|
|
|
export function getInstalledAngularVersion(tree: Tree): string {
|
|
const pkgJson = readJson(tree, 'package.json');
|
|
const installedAngularVersion =
|
|
pkgJson.dependencies && pkgJson.dependencies['@angular/core'];
|
|
|
|
if (
|
|
!installedAngularVersion ||
|
|
installedAngularVersion === 'latest' ||
|
|
installedAngularVersion === 'next'
|
|
) {
|
|
return clean(angularVersion) ?? coerce(angularVersion).version;
|
|
}
|
|
|
|
return (
|
|
clean(installedAngularVersion) ?? coerce(installedAngularVersion).version
|
|
);
|
|
}
|
|
|
|
export function getInstalledAngularMajorVersion(tree: Tree): number {
|
|
return major(getInstalledAngularVersion(tree));
|
|
}
|
|
|
|
export function getInstalledAngularVersionInfo(tree: Tree) {
|
|
const installedVersion = getInstalledAngularVersion(tree);
|
|
|
|
return {
|
|
version: installedVersion,
|
|
major: major(installedVersion),
|
|
};
|
|
}
|
|
|
|
export function getInstalledPackageVersion(
|
|
tree: Tree,
|
|
pkgName: string
|
|
): string | null {
|
|
const { dependencies, devDependencies } = readJson(tree, 'package.json');
|
|
const version = dependencies?.[pkgName] ?? devDependencies?.[pkgName];
|
|
|
|
return version;
|
|
}
|
|
|
|
export function getInstalledPackageVersionInfo(tree: Tree, pkgName: string) {
|
|
const version = getInstalledPackageVersion(tree, pkgName);
|
|
|
|
return version ? { major: major(coerce(version)), version } : null;
|
|
}
|
|
|
|
export function versions(
|
|
tree: Tree
|
|
): PackageLatestVersions | PackageCompatVersions {
|
|
const majorAngularVersion = getInstalledAngularMajorVersion(tree);
|
|
switch (majorAngularVersion) {
|
|
case 17:
|
|
return backwardCompatibleVersions.angularV17;
|
|
case 18:
|
|
return backwardCompatibleVersions.angularV18;
|
|
default:
|
|
return latestVersions;
|
|
}
|
|
}
|