Skip to content
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
6 changes: 6 additions & 0 deletions angular-standalone/base/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,9 @@ testem.log
# System files
.DS_Store
Thumbs.db

# Playwright
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
5 changes: 5 additions & 0 deletions angular-standalone/base/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Prettier only reads the root .gitignore, not the ones inside the native
# projects, so ignore them here to skip Capacitor's copied web build and
# Gradle's build output.
android/
ios/
9 changes: 6 additions & 3 deletions angular-standalone/base/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"recommendations": [
"Webnative.webnative"
]
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"Angular.ng-template",
"Webnative.webnative"
]
}
17 changes: 9 additions & 8 deletions angular-standalone/base/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,20 +95,21 @@
"test": {
"builder": "@angular/build:unit-test",
"options": {
"tsConfig": "tsconfig.spec.json",
"buildTarget": "::development",
"setupFiles": ["src/test-setup.ts"]
},
"configurations": {
"ci": {
"watch": false
}
"runnerConfig": "vitest.config.mts",
"setupFiles": ["src/test-setup.ts"],
"tsConfig": "tsconfig.spec.json"
}
},
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": ["src/**/*.ts", "src/**/*.html"]
"lintFilePatterns": [
"src/**/*.ts",
"src/**/*.html",
"e2e/**/*.ts",
"playwright.config.ts"
]
}
}
}
Expand Down
52 changes: 33 additions & 19 deletions angular-standalone/base/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,45 @@
// @ts-check
const tseslint = require("typescript-eslint");
const angular = require("angular-eslint");
const ionic = require('@ionic/eslint-config/recommended');
const angular = require('angular-eslint');
const { defineConfig } = require('eslint/config');

module.exports = tseslint.config(
module.exports = defineConfig([
{
files: ["**/*.ts"],
ignores: ["projects/**/*"],
extends: [...angular.configs.tsRecommended],
ignores: ['www/**', 'dist/**', 'coverage/**', '.angular/**', 'android/**', 'ios/**'],
},
ionic,
{
files: ['**/*.ts'],
extends: [angular.configs.tsRecommended],
processor: angular.processInlineTemplates,
rules: {
"@angular-eslint/component-class-suffix": [
"error",
{ suffixes: ["Page", "Component"] },
'@angular-eslint/directive-selector': [
'error',
{
type: 'attribute',
prefix: 'app',
style: 'camelCase',
},
],
"@angular-eslint/component-selector": [
"error",
{ type: "element", prefix: "app", style: "kebab-case" },
'@angular-eslint/component-selector': [
'error',
{
type: 'element',
prefix: 'app',
style: 'kebab-case',
},
],
"@angular-eslint/directive-selector": [
"error",
{ type: "attribute", prefix: "app", style: "camelCase" },
'@angular-eslint/component-class-suffix': [
'error',
{
suffixes: ['Page', 'Component'],
},
],
},
},
{
files: ["**/*.html"],
extends: [...angular.configs.templateRecommended],
files: ['**/*.html'],
extends: [angular.configs.templateRecommended, angular.configs.templateAccessibility],
rules: {},
}
);
},
]);
19 changes: 16 additions & 3 deletions angular-standalone/base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,15 @@
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test",
"lint": "ng lint"
"lint": "npm run eslint && npm run typecheck:e2e && npm run prettier -- --check",
"lint:fix": "npm run eslint -- --fix && npm run prettier -- --write",
"eslint": "ng lint --max-warnings 0",
"prettier": "prettier \"**/*.{ts,html}\"",
"typecheck:e2e": "tsc -p tsconfig.e2e.json",
"test": "npm run test:unit && npm run test:e2e",
"test:unit": "ng test --no-watch",
"test:unit:watch": "ng test --watch",
"test:e2e": "playwright test"
},
"private": true,
"dependencies": {
Expand All @@ -30,11 +37,17 @@
"@angular/compiler-cli": "22.2.3",
"@angular/language-service": "22.2.3",
"@ionic/angular-toolkit": "^13.0.0",
"@ionic/eslint-config": "^0.5.0",
"@ionic/prettier-config": "^4.0.0",
"@playwright/test": "^1.64.1",
"@types/node": "^24.0.0",
"angular-eslint": "22.6.0",
"eslint": "^10.10.0",
"jsdom": "^30.1.1",
"prettier": "^3.9.10",
"typescript": "~6.0.0",
"typescript-eslint": "^8.61.0",
"vitest": "~5.0.5"
}
},
"prettier": "@ionic/prettier-config"
}
27 changes: 27 additions & 0 deletions angular-standalone/base/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { defineConfig, devices } from '@playwright/test';

const baseURL = 'http://localhost:4200';

export default defineConfig({
testDir: './e2e',
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
reporter: process.env.CI ? [['github'], ['html', { open: 'never' }]] : 'list',
use: {
baseURL,
trace: 'on-first-retry',
},
projects: [
{
name: 'Mobile Chrome',
use: { ...devices['Pixel 7'] },
},
],
webServer: {
command: 'npm start -- --port 4200',
url: baseURL,
reuseExistingServer: !process.env.CI,
timeout: 120_000,
},
});
5 changes: 3 additions & 2 deletions angular-standalone/base/src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { TestBed } from '@angular/core/testing';
import { provideRouter } from '@angular/router';

import { AppComponent } from './app.component';

describe('AppComponent', () => {
it('should create the app', async () => {
await TestBed.configureTestingModule({
imports: [AppComponent],
providers: [provideRouter([])]
providers: [provideRouter([])],
}).compileComponents();

const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app).toBeTruthy();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export const environment = {
production: true
production: true,
};
2 changes: 1 addition & 1 deletion angular-standalone/base/src/environments/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// The list of file replacements can be found in `angular.json`.

export const environment = {
production: false
production: false,
};

/*
Expand Down
39 changes: 20 additions & 19 deletions angular-standalone/base/src/index.html
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Ionic App</title>

<head>
<meta charset="utf-8" />
<title>Ionic App</title>
<base href="/" />

<base href="/" />
<meta name="color-scheme" content="light dark" />
<meta
name="viewport"
content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"
/>
<meta name="format-detection" content="telephone=no" />
<meta name="msapplication-tap-highlight" content="no" />

<meta name="color-scheme" content="light dark" />
<meta name="viewport" content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="format-detection" content="telephone=no" />
<meta name="msapplication-tap-highlight" content="no" />
<link rel="icon" type="image/png" href="assets/icon/favicon.png" />

<link rel="icon" type="image/png" href="assets/icon/favicon.png" />

<!-- add to homescreen for ios -->
<meta name="mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
</head>

<body>
<app-root></app-root>
</body>
<!-- add to homescreen for ios -->
<meta name="mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
</head>

<body>
<app-root></app-root>
</body>
</html>
10 changes: 8 additions & 2 deletions angular-standalone/base/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import { bootstrapApplication } from '@angular/platform-browser';
import { RouteReuseStrategy, provideRouter, withComponentInputBinding, withPreloading, PreloadAllModules } from '@angular/router';
import {
RouteReuseStrategy,
provideRouter,
withComponentInputBinding,
withPreloading,
PreloadAllModules,
} from '@angular/router';
import { IonicRouteStrategy, provideIonicAngular } from '@ionic/angular';

import { routes } from './app/app.routes';
import { AppComponent } from './app/app.component';
import { routes } from './app/app.routes';

bootstrapApplication(AppComponent, {
providers: [
Expand Down
12 changes: 12 additions & 0 deletions angular-standalone/base/tsconfig.e2e.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "Bundler",
"strict": true,
"noEmit": true,
"skipLibCheck": true,
"types": ["node"]
},
"include": ["e2e/**/*.ts", "playwright.config.ts"]
}
10 changes: 10 additions & 0 deletions angular-standalone/base/vitest.config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { defineConfig } from 'vitest/config';

export default defineConfig({
test: {
// Angular's unit-test builder bundles each spec with the code it imports, and
// Vitest's file-system module cache can then serve a stale bundle after a
// non-spec file changes. Turn the cache off so reruns always test current code.
fsModuleCache: false,
},
});
6 changes: 6 additions & 0 deletions angular-standalone/official/blank/e2e/app.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { expect, test } from '@playwright/test';

test('visits the app root url', async ({ page }) => {
await page.goto('/');
await expect(page.locator('#container')).toContainText('Ready to create an app?');
});
2 changes: 1 addition & 1 deletion angular-standalone/official/blank/ionic.starter.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"www"
],
"scripts": {
"test": "npm run lint && npm run build && npm run test -- --configuration=ci"
"test": "npm run lint && npm run build && npm run test:unit && npx playwright install --with-deps chromium && npm run test:e2e"
}
}
2 changes: 1 addition & 1 deletion angular-standalone/official/blank/src/app/app.routes.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Routes } from '@angular/router';
import type { Routes } from '@angular/router';

export const routes: Routes = [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<ion-header [translucent]="true">
<ion-toolbar>
<ion-title>
Blank
</ion-title>
<ion-title> Blank </ion-title>
</ion-toolbar>
</ion-header>

Expand All @@ -15,6 +13,9 @@

<div id="container">
<strong>Ready to create an app?</strong>
<p>Start with Ionic <a target="_blank" rel="noopener noreferrer" href="https://ionicframework.com/docs/components">UI Components</a></p>
<p>
Start with Ionic
<a target="_blank" rel="noopener noreferrer" href="https://ionicframework.com/docs/components">UI Components</a>
</p>
</div>
</ion-content>
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import type { ComponentFixture } from '@angular/core/testing';
import { TestBed } from '@angular/core/testing';

import { HomePage } from './home.page';

Expand Down
6 changes: 6 additions & 0 deletions angular-standalone/official/list/e2e/app.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { expect, test } from '@playwright/test';

test('visits the app root url', async ({ page }) => {
await page.goto('/');
await expect(page.locator('ion-header').first()).toContainText('Inbox');
});
2 changes: 1 addition & 1 deletion angular-standalone/official/list/ionic.starter.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"www"
],
"scripts": {
"test": "npm run lint && npm run build && npm run test -- --configuration=ci"
"test": "npm run lint && npm run build && npm run test:unit && npx playwright install --with-deps chromium && npm run test:e2e"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ import { provideRouter } from '@angular/router';
import { AppComponent } from './app.component';

describe('AppComponent', () => {

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [AppComponent],
providers: [provideRouter([])]
providers: [provideRouter([])],
}).compileComponents();
});

Expand All @@ -17,5 +16,4 @@ describe('AppComponent', () => {
const app = fixture.componentInstance;
expect(app).toBeTruthy();
});

});
Loading
Loading