Skip to content

Commit f6f544c

Browse files
Chau TranChau Tran
Chau Tran
authored and
Chau Tran
committed
docs: add demo analogjs app
1 parent 8076002 commit f6f544c

27 files changed

+2498
-32
lines changed

apps/sandbox/.eslintrc.json

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

apps/sandbox/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>MyApp</title>
6+
<base href="/" />
7+
<meta name="viewport" content="width=device-width, initial-scale=1" />
8+
<link rel="icon" type="image/x-icon" href="/src/favicon.ico" />
9+
<link rel="stylesheet" href="/src/styles.css" />
10+
</head>
11+
<body>
12+
<sandbox-root></sandbox-root>
13+
<script type="module" src="/src/main.ts"></script>
14+
</body>
15+
</html>

apps/sandbox/postcss.config.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const { join } = require('path');
2+
3+
module.exports = {
4+
plugins: {
5+
tailwindcss: {
6+
config: join(__dirname, 'tailwind.config.js'),
7+
},
8+
autoprefixer: {},
9+
},
10+
};

apps/sandbox/project.json

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"name": "sandbox",
3+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
4+
"projectType": "application",
5+
"sourceRoot": "apps/sandbox/src",
6+
"targets": {
7+
"build": {
8+
"executor": "@nx/vite:build",
9+
"outputs": [
10+
"{options.outputPath}",
11+
"dist/apps/sandbox/.nitro",
12+
"dist/apps/sandbox/ssr",
13+
"dist/apps/sandbox/analog"
14+
],
15+
"options": {
16+
"main": "apps/sandbox/src/main.ts",
17+
"configFile": "apps/sandbox/vite.config.ts",
18+
"outputPath": "dist/apps/sandbox/client"
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+
"executor": "@nx/vite:dev-server",
33+
"defaultConfiguration": "development",
34+
"options": {
35+
"buildTarget": "sandbox:build",
36+
"port": 4200
37+
},
38+
"configurations": {
39+
"development": {
40+
"buildTarget": "sandbox:build:development",
41+
"hmr": true
42+
},
43+
"production": {
44+
"buildTarget": "sandbox:build:production"
45+
}
46+
}
47+
},
48+
"extract-i18n": {
49+
"executor": "@angular-devkit/build-angular:extract-i18n",
50+
"options": {
51+
"browserTarget": "sandbox:build"
52+
}
53+
},
54+
"lint": {
55+
"executor": "@nx/linter:eslint",
56+
"outputs": ["{options.outputFile}"],
57+
"options": {
58+
"lintFilePatterns": ["apps/sandbox/**/*.ts", "apps/sandbox/**/*.html"]
59+
}
60+
},
61+
"test": {
62+
"executor": "@nx/vite:test",
63+
"outputs": ["apps/sandbox/coverage"]
64+
}
65+
},
66+
"tags": []
67+
}

apps/sandbox/src/app.config.server.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { ApplicationConfig, mergeApplicationConfig } from '@angular/core';
2+
import { provideServerRendering } from '@angular/platform-server';
3+
import { appConfig } from './app.config';
4+
5+
const serverConfig: ApplicationConfig = {
6+
providers: [provideServerRendering()],
7+
};
8+
9+
export const config = mergeApplicationConfig(appConfig, serverConfig);

apps/sandbox/src/app.config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { provideFileRouter } from '@analogjs/router';
2+
import { ApplicationConfig } from '@angular/core';
3+
import { provideClientHydration } from '@angular/platform-browser';
4+
5+
export const appConfig: ApplicationConfig = {
6+
providers: [provideFileRouter(), provideClientHydration()],
7+
};
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { TestBed } from '@angular/core/testing';
2+
import { RouterTestingModule } from '@angular/router/testing';
3+
import { AppComponent } from './app.component';
4+
5+
describe('AppComponent', () => {
6+
beforeEach(async () => {
7+
await TestBed.configureTestingModule({
8+
imports: [RouterTestingModule, AppComponent],
9+
}).compileComponents();
10+
});
11+
12+
it('should create the app', () => {
13+
const fixture = TestBed.createComponent(AppComponent);
14+
const app = fixture.componentInstance;
15+
expect(app).toBeTruthy();
16+
});
17+
});

apps/sandbox/src/app/app.component.ts

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: 'sandbox-root',
6+
standalone: true,
7+
imports: [RouterOutlet],
8+
template: ` <router-outlet></router-outlet> `,
9+
})
10+
export class AppComponent {}

0 commit comments

Comments
 (0)