Skip to content

Commit daae093

Browse files
committed
feat(): rewrite angular documentation
1 parent 1482f39 commit daae093

18 files changed

+637
-196
lines changed

doc-angular/.eslintrc.json

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

doc-angular/project.json

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
{
2+
"name": "doc-angular",
3+
"$schema": "../node_modules/nx/schemas/project-schema.json",
4+
"projectType": "application",
5+
"prefix": "cha",
6+
"sourceRoot": "doc-angular/src",
7+
"tags": [],
8+
"targets": {
9+
"build": {
10+
"executor": "@angular/build:application",
11+
"outputs": ["{options.outputPath}"],
12+
"options": {
13+
"outputPath": "doc-angular/dist",
14+
"browser": "doc-angular/src/main.ts",
15+
"polyfills": ["zone.js"],
16+
"tsConfig": "doc-angular/tsconfig.app.json",
17+
"inlineStyleLanguage": "scss",
18+
"assets": [
19+
{
20+
"glob": "**/*",
21+
"input": "doc-angular/public"
22+
}
23+
],
24+
"styles": ["doc-angular/src/styles.scss"],
25+
"server": "doc-angular/src/main.server.ts",
26+
"ssr": {
27+
"entry": "doc-angular/src/server.ts"
28+
},
29+
"outputMode": "server"
30+
},
31+
"configurations": {
32+
"production": {
33+
"budgets": [
34+
{
35+
"type": "initial",
36+
"maximumWarning": "500kb",
37+
"maximumError": "1mb"
38+
},
39+
{
40+
"type": "anyComponentStyle",
41+
"maximumWarning": "4kb",
42+
"maximumError": "8kb"
43+
}
44+
],
45+
"outputHashing": "all"
46+
},
47+
"development": {
48+
"optimization": false,
49+
"extractLicenses": false,
50+
"sourceMap": true
51+
}
52+
},
53+
"defaultConfiguration": "production"
54+
},
55+
"serve": {
56+
"continuous": true,
57+
"executor": "@angular/build:dev-server",
58+
"configurations": {
59+
"production": {
60+
"buildTarget": "doc-angular:build:production"
61+
},
62+
"development": {
63+
"buildTarget": "doc-angular:build:development"
64+
}
65+
},
66+
"defaultConfiguration": "development"
67+
},
68+
"extract-i18n": {
69+
"executor": "@angular/build:extract-i18n",
70+
"options": {
71+
"buildTarget": "doc-angular:build"
72+
}
73+
},
74+
"lint": {
75+
"executor": "@nx/eslint:lint"
76+
},
77+
"serve-static": {
78+
"continuous": true,
79+
"executor": "@nx/web:file-server",
80+
"options": {
81+
"buildTarget": "doc-angular:build",
82+
"staticFilePath": "dist/doc-angular/browser",
83+
"spa": true
84+
}
85+
}
86+
}
87+
}

doc-angular/public/favicon.ico

14.7 KB
Binary file not shown.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { ChangeDetectionStrategy, Component } from '@angular/core';
2+
import { RouterModule } from '@angular/router';
3+
4+
@Component({
5+
imports: [RouterModule],
6+
selector: 'cha-root',
7+
template: `
8+
<div>{{ title }}</div>
9+
<router-outlet />
10+
`,
11+
changeDetection: ChangeDetectionStrategy.OnPush,
12+
})
13+
export class AppComponent {
14+
protected title = 'doc-angular';
15+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { ApplicationConfig, mergeApplicationConfig } from '@angular/core';
2+
import { provideServerRendering, withRoutes } from '@angular/ssr';
3+
import { appConfig } from './app.config';
4+
import { serverRoutes } from './app.routes.server';
5+
6+
const serverConfig: ApplicationConfig = {
7+
providers: [provideServerRendering(withRoutes(serverRoutes))],
8+
};
9+
10+
export const config = mergeApplicationConfig(appConfig, serverConfig);

doc-angular/src/app/app.config.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import {
2+
ApplicationConfig,
3+
provideBrowserGlobalErrorListeners,
4+
provideZonelessChangeDetection,
5+
} from '@angular/core';
6+
import {
7+
provideClientHydration,
8+
withEventReplay,
9+
} from '@angular/platform-browser';
10+
import { provideRouter } from '@angular/router';
11+
import { appRoutes } from './app.routes';
12+
13+
export const appConfig: ApplicationConfig = {
14+
providers: [
15+
provideClientHydration(withEventReplay()),
16+
provideBrowserGlobalErrorListeners(),
17+
provideZonelessChangeDetection(),
18+
provideRouter(appRoutes),
19+
],
20+
};
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { RenderMode, ServerRoute } from '@angular/ssr';
2+
3+
export const serverRoutes: ServerRoute[] = [
4+
{
5+
path: '**',
6+
renderMode: RenderMode.Prerender,
7+
},
8+
];

doc-angular/src/app/app.routes.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { Route } from '@angular/router';
2+
3+
export const appRoutes: Route[] = [];

doc-angular/src/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<title>doc-angular</title>
6+
<base href="/" />
7+
<meta name="viewport" content="width=device-width, initial-scale=1" />
8+
<link rel="icon" type="image/x-icon" href="favicon.ico" />
9+
</head>
10+
<body>
11+
<cha-root></cha-root>
12+
</body>
13+
</html>

doc-angular/src/main.server.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { bootstrapApplication } from '@angular/platform-browser';
2+
import { AppComponent } from './app/app.component';
3+
import { config } from './app/app.config.server';
4+
5+
const bootstrap = () => bootstrapApplication(AppComponent, config);
6+
7+
export default bootstrap;

0 commit comments

Comments
 (0)