Skip to content

feat: Angular 20 #151

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,6 @@ Thumbs.db
/.env

.nx/cache
.nx/workspace-data
.nx/workspace-data
.cursor/rules/nx-rules.mdc
.github/instructions/nx.instructions.md
3 changes: 0 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged --allow-empty --relative
6 changes: 3 additions & 3 deletions apps/nativescript-demo-ng/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
"@nativescript/core": "file:../../node_modules/@nativescript/core"
},
"devDependencies": {
"@nativescript/android": "~8.8.0",
"@nativescript/ios": "~8.8.0",
"@nativescript/android": "~8.9.0",
"@nativescript/ios": "~8.9.0",
"@nativescript/tailwind": "^2.1.0",
"@nativescript/unit-test-runner": "^3.0.1",
"@nativescript/visionos": "8.8.1"
"@nativescript/visionos": "~8.9.0"
}
}
4 changes: 2 additions & 2 deletions apps/nativescript-demo-ng/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { withInterceptorsFromDi } from '@angular/common/http';
import { setWindowBackgroundColor } from '@nativescript/core/utils/ios';
import { AppComponent } from './app/app.component';
import { routes } from './app/app.routes';
import { provideExperimentalZonelessChangeDetection } from '@angular/core';
import { provideZoneChangeDetection } from '@angular/core';

const EXPERIMENTAL_ZONELESS = true;

Expand All @@ -28,7 +28,7 @@ runNativeScriptAngularApp({
providers: [
provideNativeScriptHttpClient(withInterceptorsFromDi()),
provideNativeScriptRouter(routes),
EXPERIMENTAL_ZONELESS ? provideExperimentalZonelessChangeDetection() : provideNativeScriptNgZone(),
EXPERIMENTAL_ZONELESS ? provideZoneChangeDetection() : provideNativeScriptNgZone(),
],
});
},
Expand Down
4 changes: 3 additions & 1 deletion apps/nativescript-demo-ng/src/polyfills.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
import '@nativescript/core/globals';
// Install @nativescript/angular specific polyfills
import '@nativescript/angular/polyfills';

import { AbortController, AbortSignal } from '@nativescript/core/abortcontroller';
(global as any).AbortController = AbortController;
(global as any).AbortSignal = AbortSignal;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be in the pre-zone polyfills

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed but I'll leave comment in case want to adjust further - they are in pre-zone polyfills now.

/**
* Zone.js and patches
*/
Expand Down
8 changes: 8 additions & 0 deletions apps/nativescript-demo-ng/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
const webpack = require('@nativescript/webpack');
const { ProvidePlugin } = require("webpack");

module.exports = (env) => {
webpack.init(env);
webpack.useConfig('angular');

webpack.chainWebpack((config) => {
config.resolve.set('fallback', {
AbortController: require.resolve('@nativescript/core/abortcontroller'),
AbortSignal: require.resolve('@nativescript/core/abortcontroller'),
});
});

return webpack.resolveConfig();
};
4 changes: 2 additions & 2 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
const { getJestProjects } = require('@nx/jest');
const { getJestProjectsAsync } = require('@nx/jest');

export default { projects: getJestProjects() };
export default async () => ({ projects: await getJestProjectsAsync() });
79 changes: 70 additions & 9 deletions migrations.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,80 @@
{
"migrations": [
{
"version": "20.3.0-beta.1",
"description": "Update ESLint flat config to include .cjs, .mjs, .cts, and .mts files in overrides (if needed)",
"implementation": "./src/migrations/update-20-3-0/add-file-extensions-to-overrides",
"package": "@nx/eslint",
"name": "add-file-extensions-to-overrides"
"version": "21.0.0-beta.8",
"description": "Removes the legacy cache configuration from nx.json",
"implementation": "./src/migrations/update-21-0-0/remove-legacy-cache",
"package": "nx",
"name": "remove-legacy-cache"
},
{
"version": "21.0.0-beta.8",
"description": "Removes the legacy cache configuration from nx.json",
"implementation": "./src/migrations/update-21-0-0/remove-custom-tasks-runner",
"package": "nx",
"name": "remove-custom-tasks-runner"
},
{
"version": "21.0.0-beta.11",
"description": "Updates release version config based on the breaking changes in Nx v21",
"implementation": "./src/migrations/update-21-0-0/release-version-config-changes",
"package": "nx",
"name": "release-version-config-changes"
},
{
"version": "21.0.0-beta.11",
"description": "Updates release changelog config based on the breaking changes in Nx v21",
"implementation": "./src/migrations/update-21-0-0/release-changelog-config-changes",
"package": "nx",
"name": "release-changelog-config-changes"
},
{
"version": "21.1.0-beta.2",
"description": "Adds **/nx-rules.mdc and **/nx.instructions.md to .gitignore if not present",
"implementation": "./src/migrations/update-21-1-0/add-gitignore-entry",
"package": "nx",
"name": "21-1-0-add-ignore-entries-for-nx-rule-files"
},
{
"cli": "nx",
"version": "20.3.0-beta.2",
"description": "If workspace includes Module Federation projects, ensure the new @nx/module-federation package is installed.",
"factory": "./src/migrations/update-20-3-0/ensure-nx-module-federation-package",
"version": "20.4.0-beta.1",
"requires": { "@angular/core": ">=19.1.0" },
"description": "Update the @angular/cli package version to ~19.1.0.",
"factory": "./src/migrations/update-20-4-0/update-angular-cli",
"package": "@nx/angular",
"name": "ensure-nx-module-federation-package"
"name": "update-angular-cli-version-19-1-0"
},
{
"cli": "nx",
"version": "20.5.0-beta.5",
"requires": { "@angular/core": ">=19.2.0" },
"description": "Update the @angular/cli package version to ~19.2.0.",
"factory": "./src/migrations/update-20-5-0/update-angular-cli",
"package": "@nx/angular",
"name": "update-angular-cli-version-19-2-0"
},
{
"cli": "nx",
"version": "21.0.0-beta.3",
"description": "Set the `continuous` option to `true` for continuous tasks.",
"factory": "./src/migrations/update-21-0-0/set-continuous-option",
"package": "@nx/angular",
"name": "set-continuous-option"
},
{
"cli": "nx",
"version": "21.0.0-beta.9",
"description": "Replace usage of `getJestProjects` with `getJestProjectsAsync`.",
"implementation": "./src/migrations/update-21-0-0/replace-getJestProjects-with-getJestProjectsAsync",
"package": "@nx/jest",
"name": "replace-getJestProjects-with-getJestProjectsAsync-v21"
},
{
"version": "21.0.0-beta.10",
"description": "Remove the previously deprecated and unused `tsConfig` option from the `@nx/jest:jest` executor.",
"implementation": "./src/migrations/update-21-0-0/remove-tsconfig-option-from-jest-executor",
"package": "@nx/jest",
"name": "remove-tsconfig-option-from-jest-executor"
}
]
}
68 changes: 34 additions & 34 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,53 +36,53 @@
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s"
},
"dependencies": {
"@angular/animations": "~19.0.4",
"@angular/common": "~19.0.4",
"@angular/compiler": "~19.0.4",
"@angular/core": "~19.0.4",
"@angular/forms": "~19.0.4",
"@angular/platform-browser": "~19.0.4",
"@angular/platform-browser-dynamic": "~19.0.4",
"@angular/router": "~19.0.4",
"@nativescript/core": "~8.8.0",
"@angular/animations": "next",
"@angular/common": "next",
"@angular/compiler": "next",
"@angular/core": "next",
"@angular/forms": "next",
"@angular/platform-browser": "next",
"@angular/platform-browser-dynamic": "next",
"@angular/router": "next",
"@nativescript/core": "~8.9.0",
"@nativescript/tailwind": "^2.1.0",
"nativescript-fonticon": "~8.1.3",
"rxjs": "^7.8.0",
"zone.js": "~0.15.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "~19.0.4",
"@angular-devkit/core": "~19.0.4",
"@angular-devkit/schematics": "~19.0.4",
"@angular-eslint/eslint-plugin": "~19.0.2",
"@angular-eslint/eslint-plugin-template": "~19.0.2",
"@angular-eslint/template-parser": "~19.0.2",
"@angular/compiler-cli": "~19.0.3",
"@angular-devkit/build-angular": "next",
"@angular-devkit/core": "next",
"@angular-devkit/schematics": "next",
"@angular-eslint/eslint-plugin": "19.4.0",
"@angular-eslint/eslint-plugin-template": "19.4.0",
"@angular-eslint/template-parser": "19.4.0",
"@angular/compiler-cli": "next",
"@jsdevtools/coverage-istanbul-loader": "3.0.5",
"@nativescript/nx": "20.0.4",
"@nativescript/types": "~8.8.0",
"@nativescript/nx": "~20.8.0",
"@nativescript/types": "~8.9.0",
"@nativescript/unit-test-runner": "^3.0.4",
"@nativescript/webpack": "~5.0.22",
"@ngtools/webpack": "~19.0.0",
"@nx/angular": "20.3.0",
"@nx/eslint": "20.3.0",
"@nx/eslint-plugin": "20.3.0",
"@nx/jest": "20.3.0",
"@nx/js": "20.3.0",
"@nx/node": "20.3.0",
"@nx/workspace": "20.3.0",
"@schematics/angular": "~19.0.4",
"@ngtools/webpack": "next",
"@nx/angular": "21.1.0",
"@nx/eslint": "21.1.0",
"@nx/eslint-plugin": "21.1.0",
"@nx/jest": "21.1.0",
"@nx/js": "21.1.0",
"@nx/node": "21.1.0",
"@nx/workspace": "21.1.0",
"@schematics/angular": "next",
"@types/jasmine": "5.1.4",
"@types/jest": "29.5.13",
"@types/node": "^20.0.0",
"@types/sinon": "^17.0.0",
"@typescript-eslint/eslint-plugin": "^8.13.0",
"@typescript-eslint/parser": "^8.13.0",
"@typescript-eslint/utils": "^8.13.0",
"@typescript-eslint/eslint-plugin": "8.32.1",
"@typescript-eslint/parser": "8.32.1",
"@typescript-eslint/utils": "8.32.1",
"conventional-changelog-cli": "^5.0.0",
"dotenv": "16.4.5",
"eslint": "8.57.0",
"eslint-config-prettier": "9.1.0",
"eslint-config-prettier": "10.1.5",
"fs-extra": "^11.1.0",
"husky": "~9.1.0",
"jest": "29.7.0",
Expand All @@ -94,8 +94,8 @@
"karma-nativescript-launcher": "0.4.0",
"karma-sinon": "^1.0.5",
"lint-staged": "^15.0.0",
"ng-packagr": "~19.0.1",
"nx": "20.3.0",
"ng-packagr": "19.2.2",
"nx": "21.1.0",
"nyc": "17.1.0",
"postcss": "^8.4.16",
"postcss-import": "16.1.0",
Expand All @@ -108,7 +108,7 @@
"ts-jest": "~29.2.0",
"ts-node": "10.9.2",
"tslib": "^2.8.0",
"typescript": "5.6.3"
"typescript": "~5.8.0"
},
"xplat": {
"prefix": "nativescript",
Expand Down
6 changes: 3 additions & 3 deletions packages/angular/src/lib/legacy/router/page-router-outlet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import {
EnvironmentInjector,
EventEmitter,
Inject,
InjectFlags,
InjectionToken,
InjectOptions,
Injector,
NgZone,
OnDestroy,
Output,
SkipSelf,
Type,
ViewContainerRef,
} from '@angular/core';
Expand Down Expand Up @@ -84,12 +84,12 @@ export class DestructibleInjector implements Injector {
private destructibleProviders: ProviderSet,
private parent: Injector,
) {}
get<T>(token: Type<T> | InjectionToken<T>, notFoundValue?: T, flags?: InjectOptions | InjectFlags): T {
get<T>(token: Type<T> | InjectionToken<T>, notFoundValue?: T, flags?: InjectOptions): T {
const ref = this.parent.get(token, notFoundValue, flags);

// if we're skipping ourselves then it's not our responsibility to destroy
if (typeof flags === 'number') {
if (!(flags & InjectFlags.SkipSelf) && this.destructibleProviders.has(token)) {
if (!(flags && this.destructibleProviders.has(token))) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this breaks the skipself flags

this.refs.add(ref);
}
} else {
Expand Down
Loading