Skip to content

Commit 1a9509f

Browse files
authored
feat: ⚡ Analog app (#17)
1 parent 4d1dfeb commit 1a9509f

20 files changed

+15047
-3716
lines changed

README.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

demo/analog-app/.gitignore

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# See http://help.github.com/ignore-files/ for more about ignoring files.
2+
3+
# Compiled output
4+
/dist
5+
/tmp
6+
/out-tsc
7+
/bazel-out
8+
9+
# Node
10+
/node_modules
11+
npm-debug.log
12+
yarn-error.log
13+
14+
# IDEs and editors
15+
.idea/
16+
.project
17+
.classpath
18+
.c9/
19+
*.launch
20+
.settings/
21+
*.sublime-workspace
22+
23+
# Visual Studio Code
24+
.vscode/*
25+
!.vscode/settings.json
26+
!.vscode/tasks.json
27+
!.vscode/launch.json
28+
!.vscode/extensions.json
29+
.history/*
30+
31+
# Miscellaneous
32+
/.angular/cache
33+
/.nx/cache
34+
/.nx/workspace-data
35+
.sass-cache/
36+
/connect.lock
37+
/coverage
38+
/libpeerconnection.log
39+
testem.log
40+
/typings
41+
42+
# System files
43+
.DS_Store
44+
Thumbs.db

demo/analog-app/angular.json

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"version": 1,
4+
"newProjectRoot": "projects",
5+
"projects": {
6+
"my-app": {
7+
"projectType": "application",
8+
"root": "",
9+
"sourceRoot": "src",
10+
"prefix": "app",
11+
"architect": {
12+
"build": {
13+
"builder": "@analogjs/platform:vite",
14+
"options": {
15+
"configFile": "vite.config.ts",
16+
"main": "src/main.ts",
17+
"outputPath": "dist/client",
18+
"tsConfig": "tsconfig.app.json"
19+
},
20+
"defaultConfiguration": "production",
21+
"configurations": {
22+
"development": {
23+
"mode": "development"
24+
},
25+
"production": {
26+
"sourcemap": false,
27+
"mode": "production"
28+
}
29+
}
30+
},
31+
"serve": {
32+
"builder": "@analogjs/platform:vite-dev-server",
33+
"defaultConfiguration": "development",
34+
"options": {
35+
"buildTarget": "my-app:build",
36+
"port": 5173
37+
},
38+
"configurations": {
39+
"development": {
40+
"buildTarget": "my-app:build:development",
41+
"hmr": true
42+
},
43+
"production": {
44+
"buildTarget": "my-app:build:production"
45+
}
46+
}
47+
}
48+
}
49+
}
50+
},
51+
"cli": {
52+
"analytics": false
53+
}
54+
}

demo/analog-app/index.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<title>analog-app</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+
<link rel="stylesheet" href="/src/styles.css" />
10+
</head>
11+
<body>
12+
<app-root></app-root>
13+
<script type="module" src="/src/main.ts"></script>
14+
</body>
15+
</html>

demo/analog-app/package.json

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"name": "analog-app",
3+
"version": "0.0.0",
4+
"type": "module",
5+
"engines": {
6+
"node": ">=18.19.1"
7+
},
8+
"scripts": {
9+
"ng": "ng",
10+
"dev": "ng serve",
11+
"start": "pnpm run dev",
12+
"build": "ng build",
13+
"watch": "ng build --watch --configuration development",
14+
"test": "ng test"
15+
},
16+
"private": true,
17+
"dependencies": {
18+
"@analogjs/content": "^1.12.0",
19+
"@analogjs/router": "^1.12.0",
20+
"@angular/animations": "^19.0.0",
21+
"@angular/common": "^19.0.0",
22+
"@angular/compiler": "^19.0.0",
23+
"@angular/core": "^19.0.0",
24+
"@angular/forms": "^19.0.0",
25+
"@angular/platform-browser": "^19.0.0",
26+
"@angular/platform-browser-dynamic": "^19.0.0",
27+
"@angular/platform-server": "^19.0.0",
28+
"@angular/router": "^19.0.0",
29+
"front-matter": "^4.0.2",
30+
"marked": "^5.0.2",
31+
"marked-gfm-heading-id": "^3.1.0",
32+
"marked-highlight": "^2.0.1",
33+
"marked-mangle": "^1.1.7",
34+
"prismjs": "^1.29.0",
35+
"rxjs": "~7.8.0",
36+
"tslib": "^2.3.0",
37+
"zone.js": "~0.15.0"
38+
},
39+
"devDependencies": {
40+
"@analogjs/platform": "^1.12.0",
41+
"@analogjs/vite-plugin-angular": "^1.12.0",
42+
"@analogjs/vitest-angular": "^1.12.0",
43+
"@angular-devkit/build-angular": "^19.0.0",
44+
"@angular/build": "^19.0.0",
45+
"@angular/cli": "^19.0.0",
46+
"@angular/compiler-cli": "^19.0.0",
47+
"jsdom": "^22.0.0",
48+
"typescript": "~5.5.0",
49+
"vite": "^5.0.0",
50+
"vite-tsconfig-paths": "^4.2.0",
51+
"vitest": "^2.0.0"
52+
}
53+
}

demo/analog-app/public/.gitkeep

Whitespace-only changes.

demo/analog-app/public/favicon.ico

948 Bytes
Binary file not shown.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { Component } from '@angular/core';
2+
import { RouterOutlet } from '@angular/router';
3+
4+
@Component({
5+
selector: 'app-root',
6+
standalone: true,
7+
imports: [RouterOutlet],
8+
template: '<router-outlet />',
9+
})
10+
export class AppComponent {}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { mergeApplicationConfig, type ApplicationConfig } from '@angular/core';
2+
import { provideServerRendering } from '@angular/platform-server';
3+
4+
import { appConfig } from './app.config';
5+
6+
const serverConfig: ApplicationConfig = {
7+
providers: [provideServerRendering()],
8+
};
9+
10+
export const config = mergeApplicationConfig(appConfig, serverConfig);

demo/analog-app/src/app/app.config.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import {
2+
provideHttpClient,
3+
withFetch,
4+
withInterceptors,
5+
} from '@angular/common/http';
6+
import {
7+
type ApplicationConfig,
8+
provideZoneChangeDetection,
9+
} from '@angular/core';
10+
import { provideClientHydration } from '@angular/platform-browser';
11+
import { provideFileRouter, requestContextInterceptor } from '@analogjs/router';
12+
13+
export const appConfig: ApplicationConfig = {
14+
providers: [
15+
provideZoneChangeDetection({ eventCoalescing: true }),
16+
provideFileRouter(),
17+
provideHttpClient(
18+
withFetch(),
19+
withInterceptors([requestContextInterceptor]),
20+
),
21+
provideClientHydration(),
22+
],
23+
};
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { Component } from '@angular/core';
2+
3+
@Component({
4+
selector: 'app-home',
5+
standalone: true,
6+
template: `
7+
<div>
8+
<h1>Google</h1>
9+
<p class="poppins">Poppins</p>
10+
<p class="press-start">Press Start 2P</p>
11+
12+
<h1>Bunny</h1>
13+
<p class="bunny-aclonica">Aclonica</p>
14+
<p class="bunny-allan">Allan</p>
15+
16+
<h1>FontShare</h1>
17+
<p class="font-share-panchang">Panchang</p>
18+
19+
<h1>FontSource</h1>
20+
<p class="font-source-luckiest">Luckiest</p>
21+
22+
<h1>Local</h1>
23+
<p class="local">Local font</p>
24+
</div>
25+
`,
26+
})
27+
export default class HomeComponent {}

demo/analog-app/src/black-fox.ttf

59.3 KB
Binary file not shown.

demo/analog-app/src/main.server.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import 'zone.js/node';
2+
import '@angular/platform-server/init';
3+
import { render } from '@analogjs/router/server';
4+
5+
import { AppComponent } from './app/app.component';
6+
import { config } from './app/app.config.server';
7+
8+
export default render(AppComponent, config);

demo/analog-app/src/main.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 'zone.js';
3+
4+
import { AppComponent } from './app/app.component';
5+
import { appConfig } from './app/app.config';
6+
7+
bootstrapApplication(AppComponent, appConfig);

demo/analog-app/src/styles.css

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
:root {
2+
color: rgba(255, 255, 255, 0.87);
3+
background-color: #242424;
4+
}
5+
6+
p {
7+
font-size: x-large;
8+
}
9+
10+
.google-poppins {
11+
font-family: "Poppins", sans-serif;
12+
}
13+
14+
.google-press-start {
15+
font-family: "Press Start 2P", sans-serif;
16+
}
17+
18+
.bunny-aclonica {
19+
font-family: "Aclonica", sans-serif;
20+
}
21+
22+
.bunny-allan {
23+
font-family: "Allan", sans-serif;
24+
}
25+
26+
.font-share-panchang {
27+
font-family: "Panchang", sans-serif;
28+
}
29+
30+
.font-source-luckiest {
31+
font-family: "Luckiest Guy", sans-serif;
32+
}
33+
34+
@font-face {
35+
font-family: "Black Fox";
36+
src: url("./black-fox.ttf");
37+
}
38+
39+
.local {
40+
font-family: "Black Fox", sans-serif;
41+
}

demo/analog-app/src/vite-env.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference types="vite/client" />

demo/analog-app/tsconfig.app.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/* To learn more about this file see: https://angular.io/config/tsconfig. */
2+
{
3+
"extends": "./tsconfig.json",
4+
"compilerOptions": {
5+
"outDir": "./out-tsc/app",
6+
"types": []
7+
},
8+
"files": ["src/main.ts", "src/main.server.ts"],
9+
"include": [
10+
"src/**/*.d.ts",
11+
"src/app/pages/**/*.page.ts",
12+
"src/server/middleware/**/*.ts"
13+
]
14+
}

demo/analog-app/tsconfig.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/* To learn more about this file see: https://angular.io/config/tsconfig. */
2+
{
3+
"compileOnSave": false,
4+
"compilerOptions": {
5+
"baseUrl": "./",
6+
"outDir": "./dist/out-tsc",
7+
"forceConsistentCasingInFileNames": true,
8+
"strict": true,
9+
"noImplicitOverride": true,
10+
"noPropertyAccessFromIndexSignature": true,
11+
"noImplicitReturns": true,
12+
"noFallthroughCasesInSwitch": true,
13+
"sourceMap": true,
14+
"declaration": false,
15+
"downlevelIteration": true,
16+
"experimentalDecorators": true,
17+
"moduleResolution": "node",
18+
"isolatedModules": true,
19+
"importHelpers": true,
20+
"target": "ES2022",
21+
"module": "ES2022",
22+
"lib": ["ES2022", "dom"],
23+
"useDefineForClassFields": false,
24+
"skipLibCheck": true
25+
},
26+
"angularCompilerOptions": {
27+
"enableI18nLegacyMessageIdFormat": false,
28+
"strictInjectionParameters": true,
29+
"strictInputAccessModifiers": true,
30+
"strictTemplates": true
31+
}
32+
}

demo/analog-app/vite.config.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/// <reference types="vitest" />
2+
3+
import analog from '@analogjs/platform';
4+
import { defineConfig } from 'vite';
5+
import { fontless } from '../../lib/vite/plugin';
6+
7+
// https://vitejs.dev/config/
8+
export default defineConfig(({ mode }) => ({
9+
build: {
10+
target: ['es2020'],
11+
},
12+
resolve: {
13+
mainFields: ['module'],
14+
},
15+
plugins: [
16+
analog({
17+
ssr: false,
18+
static: true,
19+
prerender: {
20+
routes: [],
21+
},
22+
}),
23+
fontless(),
24+
],
25+
}));

0 commit comments

Comments
 (0)