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 16 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
9 changes: 2 additions & 7 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,13 @@
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nx/typescript"],
"rules": {
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-extra-semi": "error",
"no-extra-semi": "off"
"@typescript-eslint/no-inferrable-types": "off"
}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nx/javascript"],
"rules": {
"@typescript-eslint/no-extra-semi": "error",
"no-extra-semi": "off"
}
"rules": {}
}
]
}
9 changes: 3 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,8 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: lts/*
cache: 'yarn'
- uses: nrwl/nx-set-shas@v3
- name: Setup global dependencies
run: npm i -g yarn
- name: yarn install
run: yarn
- name: npm install
run: npm install --legacy-peer-deps
- name: Build.all affected
run: yarn nx affected --target=build --exclude nativescript-demo-ng
run: npx nx affected --target=build --exclude nativescript-demo-ng
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
# dependencies
/node_modules
/packages/*/node_modules
package-lock.json
.npmrc
yarn.lock

# IDEs and editors
/.idea
Expand Down 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
4 changes: 2 additions & 2 deletions DevelopmentWorkflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ $ cd angular

```
$ cd angular
$ yarn clean.all
$ npm run clean.all
```

### Run some of the e2e applications e.g. router-tab-view
Expand All @@ -43,7 +43,7 @@ $ yarn clean.all
Install NPM packages (use the local copy of `@nativescript/angular`):
```
$ cd e2e/router-tab-view
$ yarn install
$ npm install
```

Start the app:
Expand Down
5 changes: 3 additions & 2 deletions apps/nativescript-demo-ng/App_Resources/Android/app.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
//}

android {
namespace "org.nativescript.demong"
defaultConfig {
minSdkVersion 17
targetSdkVersion 29
minSdkVersion 24
targetSdkVersion 34
generatedDensities = []
applicationId = "org.nativescript.demong"
manifestPlaceholders = [isUnitTesting:"${unitTesting}"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
android:name="com.tns.NativeScriptActivity"
android:label="@string/title_activity_kimera"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|smallestScreenSize|screenLayout|locale|uiMode"
android:theme="@style/LaunchScreenTheme">
android:theme="@style/LaunchScreenTheme"
android:exported="true">

<meta-data android:name="SET_THEME_ON_LAUNCH" android:resource="@style/AppTheme" />

Expand Down
102 changes: 51 additions & 51 deletions apps/nativescript-demo-ng/App_Resources/iOS/Info.plist
Original file line number Diff line number Diff line change
@@ -1,58 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiresFullScreen</key>
<true/>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSAllowsArbitraryLoadsForMedia</key>
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAllowsArbitraryLoadsInWebContent</key>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiresFullScreen</key>
<true/>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSAllowsArbitraryLoadsForMedia</key>
<true/>
<key>NSAllowsArbitraryLoadsInWebContent</key>
<true/>
</dict>
</dict>
</dict>
</plist>
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/app/item/items.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import { ModalDialogService, NativeDialogService, NativeScriptCommonModule } fro
templateUrl: './items.component.html',
imports: [NativeScriptCommonModule],
standalone: true,
schemas: [NO_ERRORS_SCHEMA]
schemas: [NO_ERRORS_SCHEMA],
})
export class ItemsComponent implements OnInit, OnDestroy {
message = 'Hello Angular 19!';
message = 'Hello Angular 20.0.0!';
items: Array<Item>;

constructor(
Expand Down
11 changes: 8 additions & 3 deletions apps/nativescript-demo-ng/src/app/item3/items.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,23 @@ import { HttpClient } from '@angular/common/http';
import { Item } from '../item/item';
import { ItemService } from '../item/item.service';
import { ModalComponent } from '../modal/modal.component';
import { ModalDialogService, NativeDialogService, NativeScriptCommonModule, NativeScriptRouterModule } from '@nativescript/angular';
import {
ModalDialogService,
NativeDialogService,
NativeScriptCommonModule,
NativeScriptRouterModule,
} from '@nativescript/angular';

@Component({
selector: 'ns-items',
moduleId: module.id,
templateUrl: './items.component.html',
imports: [NativeScriptCommonModule, NativeScriptRouterModule],
standalone: true,
schemas: [NO_ERRORS_SCHEMA]
schemas: [NO_ERRORS_SCHEMA],
})
export class ItemsComponent implements OnInit, OnDestroy {
message = 'Hello Angular 19';
message = 'Hello Angular 20.0.0';
items: Array<Item>;
borderRadius: number;
fontSize: number;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<GridLayout [backgroundColor]="'#d63681'" rows="*,auto,auto">
<!-- <Image [src]="logo" stretch="aspectFit" width="200" marginTop="50" /> -->
<Image src="~/assets/ng-18.png" stretch="aspectFit" (loaded)="loadedImg($event)" class="w-full" />
<Image src="~/assets/ng-20.png" stretch="aspectFit" (loaded)="loadedImg($event)" class="w-full" />

<!-- @if (this.itemService.currentFlavor + 1 !== this.itemService.flavors.length) {
<Button row="1" (tap)="openNewModal()" text="Taste Another" fontSize="20" borderRadius="25"></Button>
Expand Down
Binary file added apps/nativescript-demo-ng/src/assets/ng-20.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 10 additions & 1 deletion apps/nativescript-demo-ng/src/main.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
import './polyfills';
import '@nativescript/zone-js/dist/pre-zone-polyfills';

// Zone JS is required by default for Angular itself
import 'zone.js';

// Add NativeScript specific Zone JS patches
import '@nativescript/zone-js';
import 'zone.js/testing';
import { TestBed } from '@angular/core/testing';
import { platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing';
import { NativeScriptTestingModule } from '@nativescript/angular/testing';

TestBed.initTestEnvironment(NativeScriptTestingModule, platformBrowserDynamicTesting(), { teardown: { destroyAfterEach: true } });
TestBed.initTestEnvironment(NativeScriptTestingModule, platformBrowserDynamicTesting(), {
teardown: { destroyAfterEach: true },
});
8 changes: 4 additions & 4 deletions apps/nativescript-demo-ng/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@ 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 { provideZonelessChangeDetection } from '@angular/core';

const EXPERIMENTAL_ZONELESS = true;
const ZONELESS = true;

Trace.enable();
Trace.setCategories('ns-route-reuse-strategy,ns-router');

runNativeScriptAngularApp({
appModuleBootstrap: () => {
if (global.isIOS) {
if (__APPLE__) {
setWindowBackgroundColor('#a6120d');
}
return bootstrapApplication(AppComponent, {
providers: [
provideNativeScriptHttpClient(withInterceptorsFromDi()),
provideNativeScriptRouter(routes),
EXPERIMENTAL_ZONELESS ? provideExperimentalZonelessChangeDetection() : provideNativeScriptNgZone(),
ZONELESS ? provideZonelessChangeDetection() : provideNativeScriptNgZone(),
],
});
},
Expand Down
12 changes: 6 additions & 6 deletions apps/nativescript-demo-ng/src/polyfills.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
import '@nativescript/core/globals';
// Install @nativescript/angular specific polyfills
import '@nativescript/angular/polyfills';

/**
* Zone.js and patches
*/
// Add pre-zone.js patches needed for the NativeScript platform
import '@nativescript/zone-js/dist/pre-zone-polyfills';
// import '@nativescript/zone-js/dist/pre-zone-polyfills';

// Zone JS is required by default for Angular itself
import 'zone.js';
// Uncomment if using zone:
// // Zone JS is required by default for Angular itself
// import 'zone.js';

// Add NativeScript specific Zone JS patches
import '@nativescript/zone-js';
// // Add NativeScript specific Zone JS patches
// import '@nativescript/zone-js';
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() });
Loading