Skip to content
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

feat: ⚡ Analog app #17

Merged
merged 2 commits into from
Jan 8, 2025
Merged
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
3 changes: 0 additions & 3 deletions README.md

This file was deleted.

44 changes: 44 additions & 0 deletions demo/analog-app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

# Compiled output
/dist
/tmp
/out-tsc
/bazel-out

# Node
/node_modules
npm-debug.log
yarn-error.log

# IDEs and editors
.idea/
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# Visual Studio Code
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*

# Miscellaneous
/.angular/cache
/.nx/cache
/.nx/workspace-data
.sass-cache/
/connect.lock
/coverage
/libpeerconnection.log
testem.log
/typings

# System files
.DS_Store
Thumbs.db
54 changes: 54 additions & 0 deletions demo/analog-app/angular.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"my-app": {
"projectType": "application",
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@analogjs/platform:vite",
"options": {
"configFile": "vite.config.ts",
"main": "src/main.ts",
"outputPath": "dist/client",
"tsConfig": "tsconfig.app.json"
},
"defaultConfiguration": "production",
"configurations": {
"development": {
"mode": "development"
},
"production": {
"sourcemap": false,
"mode": "production"
}
}
},
"serve": {
"builder": "@analogjs/platform:vite-dev-server",
"defaultConfiguration": "development",
"options": {
"buildTarget": "my-app:build",
"port": 5173
},
"configurations": {
"development": {
"buildTarget": "my-app:build:development",
"hmr": true
},
"production": {
"buildTarget": "my-app:build:production"
}
}
}
}
}
},
"cli": {
"analytics": false
}
}
15 changes: 15 additions & 0 deletions demo/analog-app/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>analog-app</title>
<base href="/" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
<link rel="stylesheet" href="/src/styles.css" />
</head>
<body>
<app-root></app-root>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
53 changes: 53 additions & 0 deletions demo/analog-app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"name": "analog-app",
"version": "0.0.0",
"type": "module",
"engines": {
"node": ">=18.19.1"
},
"scripts": {
"ng": "ng",
"dev": "ng serve",
"start": "pnpm run dev",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test"
},
"private": true,
"dependencies": {
"@analogjs/content": "^1.12.0",
"@analogjs/router": "^1.12.0",
"@angular/animations": "^19.0.0",
"@angular/common": "^19.0.0",
"@angular/compiler": "^19.0.0",
"@angular/core": "^19.0.0",
"@angular/forms": "^19.0.0",
"@angular/platform-browser": "^19.0.0",
"@angular/platform-browser-dynamic": "^19.0.0",
"@angular/platform-server": "^19.0.0",
"@angular/router": "^19.0.0",
"front-matter": "^4.0.2",
"marked": "^5.0.2",
"marked-gfm-heading-id": "^3.1.0",
"marked-highlight": "^2.0.1",
"marked-mangle": "^1.1.7",
"prismjs": "^1.29.0",
"rxjs": "~7.8.0",
"tslib": "^2.3.0",
"zone.js": "~0.15.0"
},
"devDependencies": {
"@analogjs/platform": "^1.12.0",
"@analogjs/vite-plugin-angular": "^1.12.0",
"@analogjs/vitest-angular": "^1.12.0",
"@angular-devkit/build-angular": "^19.0.0",
"@angular/build": "^19.0.0",
"@angular/cli": "^19.0.0",
"@angular/compiler-cli": "^19.0.0",
"jsdom": "^22.0.0",
"typescript": "~5.5.0",
"vite": "^5.0.0",
"vite-tsconfig-paths": "^4.2.0",
"vitest": "^2.0.0"
}
}
Empty file added demo/analog-app/public/.gitkeep
Empty file.
Binary file added demo/analog-app/public/favicon.ico
Binary file not shown.
10 changes: 10 additions & 0 deletions demo/analog-app/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Component } from '@angular/core';
import { RouterOutlet } from '@angular/router';

@Component({
selector: 'app-root',
standalone: true,
imports: [RouterOutlet],
template: '<router-outlet />',
})
export class AppComponent {}
10 changes: 10 additions & 0 deletions demo/analog-app/src/app/app.config.server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { mergeApplicationConfig, type ApplicationConfig } from '@angular/core';
import { provideServerRendering } from '@angular/platform-server';

import { appConfig } from './app.config';

const serverConfig: ApplicationConfig = {
providers: [provideServerRendering()],
};

export const config = mergeApplicationConfig(appConfig, serverConfig);
23 changes: 23 additions & 0 deletions demo/analog-app/src/app/app.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import {
provideHttpClient,
withFetch,
withInterceptors,
} from '@angular/common/http';
import {
type ApplicationConfig,
provideZoneChangeDetection,
} from '@angular/core';
import { provideClientHydration } from '@angular/platform-browser';
import { provideFileRouter, requestContextInterceptor } from '@analogjs/router';

export const appConfig: ApplicationConfig = {
providers: [
provideZoneChangeDetection({ eventCoalescing: true }),
provideFileRouter(),
provideHttpClient(
withFetch(),
withInterceptors([requestContextInterceptor]),
),
provideClientHydration(),
],
};
27 changes: 27 additions & 0 deletions demo/analog-app/src/app/pages/index.page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { Component } from '@angular/core';

@Component({
selector: 'app-home',
standalone: true,
template: `
<div>
<h1>Google</h1>
<p class="poppins">Poppins</p>
<p class="press-start">Press Start 2P</p>

<h1>Bunny</h1>
<p class="bunny-aclonica">Aclonica</p>
<p class="bunny-allan">Allan</p>

<h1>FontShare</h1>
<p class="font-share-panchang">Panchang</p>

<h1>FontSource</h1>
<p class="font-source-luckiest">Luckiest</p>

<h1>Local</h1>
<p class="local">Local font</p>
</div>
`,
})
export default class HomeComponent {}
Binary file added demo/analog-app/src/black-fox.ttf
Binary file not shown.
8 changes: 8 additions & 0 deletions demo/analog-app/src/main.server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import 'zone.js/node';
import '@angular/platform-server/init';
import { render } from '@analogjs/router/server';

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

export default render(AppComponent, config);
7 changes: 7 additions & 0 deletions demo/analog-app/src/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { bootstrapApplication } from '@angular/platform-browser';
import 'zone.js';

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

bootstrapApplication(AppComponent, appConfig);
41 changes: 41 additions & 0 deletions demo/analog-app/src/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
:root {
color: rgba(255, 255, 255, 0.87);
background-color: #242424;
}

p {
font-size: x-large;
}

.google-poppins {
font-family: "Poppins", sans-serif;
}

.google-press-start {
font-family: "Press Start 2P", sans-serif;
}

.bunny-aclonica {
font-family: "Aclonica", sans-serif;
}

.bunny-allan {
font-family: "Allan", sans-serif;
}

.font-share-panchang {
font-family: "Panchang", sans-serif;
}

.font-source-luckiest {
font-family: "Luckiest Guy", sans-serif;
}

@font-face {
font-family: "Black Fox";
src: url("./black-fox.ttf");
}

.local {
font-family: "Black Fox", sans-serif;
}
1 change: 1 addition & 0 deletions demo/analog-app/src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="vite/client" />
14 changes: 14 additions & 0 deletions demo/analog-app/tsconfig.app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"types": []
},
"files": ["src/main.ts", "src/main.server.ts"],
"include": [
"src/**/*.d.ts",
"src/app/pages/**/*.page.ts",
"src/server/middleware/**/*.ts"
]
}
32 changes: 32 additions & 0 deletions demo/analog-app/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"moduleResolution": "node",
"isolatedModules": true,
"importHelpers": true,
"target": "ES2022",
"module": "ES2022",
"lib": ["ES2022", "dom"],
"useDefineForClassFields": false,
"skipLibCheck": true
},
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
"strictTemplates": true
}
}
25 changes: 25 additions & 0 deletions demo/analog-app/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/// <reference types="vitest" />

import analog from '@analogjs/platform';
import { defineConfig } from 'vite';
import { fontless } from '../../lib/vite/plugin';

// https://vitejs.dev/config/
export default defineConfig(({ mode }) => ({
build: {
target: ['es2020'],
},
resolve: {
mainFields: ['module'],
},
plugins: [
analog({
ssr: false,
static: true,
prerender: {
routes: [],
},
}),
fontless(),
],
}));
Loading
Loading