Skip to content

Commit 6827a74

Browse files
ctranctran
ctran
authored and
ctran
committed
test ionic
1 parent c7d9378 commit 6827a74

24 files changed

+1742
-76
lines changed

apps/ionic-app/.eslintrc.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"extends": ["../../.eslintrc.json"],
3+
"ignorePatterns": ["!**/*"],
4+
"overrides": [
5+
{
6+
"files": ["*.ts"],
7+
"extends": ["plugin:@nx/angular", "plugin:@angular-eslint/template/process-inline-templates"],
8+
"rules": {
9+
"@angular-eslint/directive-selector": [
10+
"error",
11+
{
12+
"type": "attribute",
13+
"prefix": "platform",
14+
"style": "camelCase"
15+
}
16+
],
17+
"@angular-eslint/component-selector": [
18+
"error",
19+
{
20+
"type": "element",
21+
"prefix": "platform",
22+
"style": "kebab-case"
23+
}
24+
],
25+
"@angular-eslint/component-class-suffix": [
26+
"error",
27+
{
28+
"suffixes": ["Page", "Component"]
29+
}
30+
],
31+
"@angular-eslint/no-empty-lifecycle-method": 0,
32+
"@typescript-eslint/no-empty-function": 0
33+
}
34+
},
35+
{
36+
"files": ["*.html"],
37+
"extends": ["plugin:@nx/angular-template"],
38+
"rules": {}
39+
}
40+
]
41+
}

apps/ionic-app/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/node_modules

apps/ionic-app/capacitor.config.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { CapacitorConfig } from '@capacitor/cli';
2+
3+
const config: CapacitorConfig = {
4+
appId: 'io.ionic.starter',
5+
appName: 'ionic-app',
6+
webDir: '../../dist/apps/ionic-app',
7+
bundledWebRuntime: false,
8+
server: {
9+
androidScheme: 'https',
10+
},
11+
};
12+
13+
export default config;

apps/ionic-app/ionic.config.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "ionic-app",
3+
"integrations": {
4+
"capacitor": {}
5+
},
6+
"type": "angular"
7+
}

apps/ionic-app/package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "ionic-app",
3+
"devDependencies": {
4+
"@capacitor/cli": "^5.0.3",
5+
"@capacitor/ios": "../../node_modules/@capacitor/ios",
6+
"@capacitor/android": "../../node_modules/@capacitor/android"
7+
}
8+
}

apps/ionic-app/project.json

Lines changed: 207 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
1+
{
2+
"name": "ionic-app",
3+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
4+
"projectType": "application",
5+
"prefix": "platform",
6+
"sourceRoot": "apps/ionic-app/src",
7+
"tags": [],
8+
"targets": {
9+
"build": {
10+
"executor": "@angular-devkit/build-angular:browser",
11+
"outputs": ["{options.outputPath}"],
12+
"options": {
13+
"outputPath": "dist/apps/ionic-app",
14+
"index": "apps/ionic-app/src/index.html",
15+
"main": "apps/ionic-app/src/main.ts",
16+
"polyfills": ["zone.js"],
17+
"tsConfig": "apps/ionic-app/tsconfig.app.json",
18+
"inlineStyleLanguage": "scss",
19+
"assets": [
20+
{
21+
"glob": "**/*",
22+
"input": "apps/ionic-app/public"
23+
},
24+
{
25+
"glob": "**/*.svg",
26+
"input": "node_modules/ionicons/dist/ionicons/svg",
27+
"output": "./svg"
28+
}
29+
],
30+
"styles": [
31+
"apps/ionic-app/src/styles.scss",
32+
{
33+
"input": "apps/ionic-app/src/theme/variables.scss"
34+
},
35+
{
36+
"input": "node_modules/@ionic/angular/css/core.css"
37+
},
38+
{
39+
"input": "node_modules/@ionic/angular/css/normalize.css"
40+
},
41+
{
42+
"input": "node_modules/@ionic/angular/css/structure.css"
43+
},
44+
{
45+
"input": "node_modules/@ionic/angular/css/typography.css"
46+
},
47+
{
48+
"input": "node_modules/@ionic/angular/css/display.css"
49+
},
50+
{
51+
"input": "node_modules/@ionic/angular/css/padding.css"
52+
},
53+
{
54+
"input": "node_modules/@ionic/angular/css/float-elements.css"
55+
},
56+
{
57+
"input": "node_modules/@ionic/angular/css/text-alignment.css"
58+
},
59+
{
60+
"input": "node_modules/@ionic/angular/css/text-transformation.css"
61+
},
62+
{
63+
"input": "node_modules/@ionic/angular/css/flex-utils.css"
64+
}
65+
],
66+
"scripts": []
67+
},
68+
"configurations": {
69+
"production": {
70+
"budgets": [
71+
{
72+
"type": "initial",
73+
"maximumWarning": "500kb",
74+
"maximumError": "1mb"
75+
},
76+
{
77+
"type": "anyComponentStyle",
78+
"maximumWarning": "2kb",
79+
"maximumError": "4kb"
80+
}
81+
],
82+
"outputHashing": "all"
83+
},
84+
"development": {
85+
"buildOptimizer": false,
86+
"optimization": false,
87+
"vendorChunk": true,
88+
"extractLicenses": false,
89+
"sourceMap": true,
90+
"namedChunks": true
91+
}
92+
},
93+
"defaultConfiguration": "production"
94+
},
95+
"serve": {
96+
"executor": "@angular-devkit/build-angular:dev-server",
97+
"configurations": {
98+
"production": {
99+
"buildTarget": "ionic-app:build:production"
100+
},
101+
"development": {
102+
"buildTarget": "ionic-app:build:development"
103+
}
104+
},
105+
"defaultConfiguration": "development"
106+
},
107+
"extract-i18n": {
108+
"executor": "@angular-devkit/build-angular:extract-i18n",
109+
"options": {
110+
"buildTarget": "ionic-app:build"
111+
}
112+
},
113+
"lint": {
114+
"executor": "@nx/eslint:lint"
115+
},
116+
"cap": {
117+
"executor": "@nxext/capacitor:cap",
118+
"options": {
119+
"cmd": "--help"
120+
}
121+
},
122+
"add": {
123+
"executor": "@nxext/capacitor:cap",
124+
"options": {
125+
"cmd": "add"
126+
},
127+
"configurations": {
128+
"ios": {
129+
"cmd": "add ios"
130+
},
131+
"android": {
132+
"cmd": "add android"
133+
}
134+
}
135+
},
136+
"copy": {
137+
"executor": "@nxext/capacitor:cap",
138+
"options": {
139+
"cmd": "copy"
140+
},
141+
"configurations": {
142+
"ios": {
143+
"cmd": "copy ios"
144+
},
145+
"android": {
146+
"cmd": "copy android"
147+
}
148+
}
149+
},
150+
"open": {
151+
"executor": "@nxext/capacitor:cap",
152+
"options": {
153+
"cmd": "open"
154+
},
155+
"configurations": {
156+
"ios": {
157+
"cmd": "open ios"
158+
},
159+
"android": {
160+
"cmd": "open android"
161+
}
162+
}
163+
},
164+
"run": {
165+
"executor": "@nxext/capacitor:cap",
166+
"options": {
167+
"cmd": "run"
168+
},
169+
"configurations": {
170+
"ios": {
171+
"cmd": "run ios"
172+
},
173+
"android": {
174+
"cmd": "run android"
175+
}
176+
}
177+
},
178+
"sync": {
179+
"executor": "@nxext/capacitor:cap",
180+
"options": {
181+
"cmd": "sync"
182+
},
183+
"configurations": {
184+
"ios": {
185+
"cmd": "sync ios"
186+
},
187+
"android": {
188+
"cmd": "sync android"
189+
}
190+
}
191+
},
192+
"update": {
193+
"executor": "@nxext/capacitor:cap",
194+
"options": {
195+
"cmd": "update"
196+
},
197+
"configurations": {
198+
"ios": {
199+
"cmd": "update ios"
200+
},
201+
"android": {
202+
"cmd": "update android"
203+
}
204+
}
205+
}
206+
}
207+
}

apps/ionic-app/public/favicon.ico

14.7 KB
Binary file not shown.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { CommonModule } from '@angular/common';
2+
import { Component } from '@angular/core';
3+
import { IonicModule } from '@ionic/angular';
4+
5+
@Component({
6+
selector: 'platform-root',
7+
standalone: true,
8+
imports: [CommonModule, IonicModule],
9+
template: `
10+
<ion-app>
11+
<ion-router-outlet></ion-router-outlet>
12+
</ion-app>
13+
`,
14+
styles: ``,
15+
})
16+
export class AppComponent {}

apps/ionic-app/src/app/app.config.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { ApplicationConfig, importProvidersFrom } from '@angular/core';
2+
import { provideRouter } from '@angular/router';
3+
import { IonicModule } from '@ionic/angular';
4+
import { appRoutes } from './app.routes';
5+
6+
export const appConfig: ApplicationConfig = {
7+
providers: [provideRouter(appRoutes), importProvidersFrom(IonicModule.forRoot())],
8+
};

apps/ionic-app/src/app/app.routes.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Routes } from '@angular/router';
2+
3+
export const appRoutes: Routes = [
4+
{
5+
path: 'home',
6+
loadChildren: () => import('./home/home.routes').then((r) => r.routes),
7+
},
8+
{
9+
path: '',
10+
redirectTo: 'home',
11+
pathMatch: 'full',
12+
},
13+
];
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import { ChangeDetectionStrategy, Component, CUSTOM_ELEMENTS_SCHEMA, ElementRef, viewChild } from '@angular/core';
2+
import { IonicModule } from '@ionic/angular';
3+
import { extend, injectBeforeRender, NgtCanvas } from 'angular-three';
4+
import * as THREE from 'three';
5+
import { Mesh } from 'three';
6+
7+
extend(THREE);
8+
9+
@Component({
10+
standalone: true,
11+
template: `
12+
<ngt-mesh #mesh>
13+
<ngt-box-geometry />
14+
</ngt-mesh>
15+
`,
16+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
17+
changeDetection: ChangeDetectionStrategy.OnPush,
18+
})
19+
export class Scene {
20+
mesh = viewChild.required<ElementRef<Mesh>>('mesh');
21+
22+
constructor() {
23+
injectBeforeRender(() => {
24+
const mesh = this.mesh().nativeElement;
25+
mesh.rotation.x += 0.01;
26+
mesh.rotation.y += 0.01;
27+
});
28+
}
29+
}
30+
31+
@Component({
32+
selector: 'platform-home',
33+
standalone: true,
34+
imports: [IonicModule, NgtCanvas],
35+
template: `
36+
<ion-content [fullscreen]="true">
37+
<div id="container">
38+
<ngt-canvas [sceneGraph]="scene" />
39+
</div>
40+
</ion-content>
41+
`,
42+
styles: `
43+
#container {
44+
text-align: center;
45+
position: absolute;
46+
left: 0;
47+
right: 0;
48+
top: 50%;
49+
height: 100%;
50+
transform: translateY(-50%);
51+
}
52+
`,
53+
})
54+
export class HomePage {
55+
scene = Scene;
56+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { Routes } from '@angular/router';
2+
3+
export const routes: Routes = [
4+
{
5+
path: '',
6+
loadComponent: () => import('./home.page').then((p) => p.HomePage),
7+
},
8+
];
930 Bytes
Loading

apps/ionic-app/src/assets /shapes.svg

Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)