Skip to content

Commit 452df7a

Browse files
committed
Add angular-signals on examples-angular
1 parent 5175467 commit 452df7a

File tree

18 files changed

+288
-0
lines changed

18 files changed

+288
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import nx from '@nx/eslint-plugin';
2+
import baseConfig from '../../eslint.config.mjs';
3+
4+
export default [
5+
...baseConfig,
6+
...nx.configs['flat/angular'],
7+
...nx.configs['flat/angular-template'],
8+
{
9+
files: ['**/*.ts'],
10+
rules: {
11+
'@angular-eslint/directive-selector': [
12+
'error',
13+
{
14+
type: 'attribute',
15+
prefix: 'app',
16+
style: 'camelCase',
17+
},
18+
],
19+
'@angular-eslint/component-selector': [
20+
'error',
21+
{
22+
type: 'element',
23+
prefix: 'app',
24+
style: 'kebab-case',
25+
},
26+
],
27+
},
28+
},
29+
{
30+
files: ['**/*.html'],
31+
// Override or add rules here
32+
rules: {},
33+
},
34+
];
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
export default {
2+
displayName: 'angular-signals',
3+
preset: '../../jest.preset.js',
4+
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
5+
coverageDirectory: '../../coverage/apps/angular-signals',
6+
transform: {
7+
'^.+\\.(ts|mjs|js|html)$': [
8+
'jest-preset-angular',
9+
{
10+
tsconfig: '<rootDir>/tsconfig.spec.json',
11+
stringifyContentPathRegex: '\\.(html|svg)$',
12+
},
13+
],
14+
},
15+
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
16+
snapshotSerializers: [
17+
'jest-preset-angular/build/serializers/no-ng-attributes',
18+
'jest-preset-angular/build/serializers/ng-snapshot',
19+
'jest-preset-angular/build/serializers/html-comment',
20+
],
21+
};
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
{
2+
"name": "angular-signals",
3+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
4+
"projectType": "application",
5+
"prefix": "app",
6+
"sourceRoot": "apps/angular-signals/src",
7+
"tags": [],
8+
"targets": {
9+
"build": {
10+
"executor": "@angular/build:application",
11+
"outputs": ["{options.outputPath}"],
12+
"options": {
13+
"outputPath": "dist/apps/angular-signals",
14+
"browser": "apps/angular-signals/src/main.ts",
15+
"polyfills": ["zone.js"],
16+
"tsConfig": "apps/angular-signals/tsconfig.app.json",
17+
"assets": [
18+
{
19+
"glob": "**/*",
20+
"input": "apps/angular-signals/public"
21+
}
22+
],
23+
"styles": ["apps/angular-signals/src/styles.css"]
24+
},
25+
"configurations": {
26+
"production": {
27+
"budgets": [
28+
{
29+
"type": "initial",
30+
"maximumWarning": "500kb",
31+
"maximumError": "1mb"
32+
},
33+
{
34+
"type": "anyComponentStyle",
35+
"maximumWarning": "4kb",
36+
"maximumError": "8kb"
37+
}
38+
],
39+
"outputHashing": "all"
40+
},
41+
"development": {
42+
"optimization": false,
43+
"extractLicenses": false,
44+
"sourceMap": true
45+
}
46+
},
47+
"defaultConfiguration": "production"
48+
},
49+
"serve": {
50+
"continuous": true,
51+
"executor": "@angular/build:dev-server",
52+
"configurations": {
53+
"production": {
54+
"buildTarget": "angular-signals:build:production"
55+
},
56+
"development": {
57+
"buildTarget": "angular-signals:build:development"
58+
}
59+
},
60+
"defaultConfiguration": "development"
61+
},
62+
"extract-i18n": {
63+
"executor": "@angular/build:extract-i18n",
64+
"options": {
65+
"buildTarget": "angular-signals:build"
66+
}
67+
},
68+
"lint": {
69+
"executor": "@nx/eslint:lint"
70+
},
71+
"test": {
72+
"executor": "@nx/jest:jest",
73+
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
74+
"options": {
75+
"jestConfig": "apps/angular-signals/jest.config.ts",
76+
"tsConfig": "apps/angular-signals/tsconfig.spec.json"
77+
}
78+
},
79+
"serve-static": {
80+
"continuous": true,
81+
"executor": "@nx/web:file-server",
82+
"options": {
83+
"buildTarget": "angular-signals:build",
84+
"port": 4200,
85+
"staticFilePath": "dist/apps/angular-signals/browser",
86+
"spa": true
87+
}
88+
}
89+
}
90+
}
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 {
2+
ApplicationConfig,
3+
provideBrowserGlobalErrorListeners,
4+
provideZoneChangeDetection,
5+
} from '@angular/core';
6+
import { provideRouter } from '@angular/router';
7+
import { appRoutes } from './app.routes';
8+
9+
export const appConfig: ApplicationConfig = {
10+
providers: [
11+
provideBrowserGlobalErrorListeners(),
12+
provideZoneChangeDetection({ eventCoalescing: true }),
13+
provideRouter(appRoutes),
14+
],
15+
};

examples-angular/apps/angular-signals/src/app/app.css

Whitespace-only changes.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<h1>angular-signals</h1>
2+
<router-outlet></router-outlet>
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[] = [];
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { TestBed } from '@angular/core/testing';
2+
import { App } from './app';
3+
4+
describe('App', () => {
5+
beforeEach(async () => {
6+
await TestBed.configureTestingModule({
7+
imports: [App],
8+
}).compileComponents();
9+
});
10+
11+
it('should render title', () => {
12+
const fixture = TestBed.createComponent(App);
13+
fixture.detectChanges();
14+
const compiled = fixture.nativeElement as HTMLElement;
15+
expect(compiled.querySelector('h1')?.textContent).toContain(
16+
'angular-signals'
17+
);
18+
});
19+
});
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { Component } from '@angular/core';
2+
import { RouterModule } from '@angular/router';
3+
4+
@Component({
5+
imports: [RouterModule],
6+
selector: 'app-root',
7+
templateUrl: './app.html',
8+
styleUrl: './app.css',
9+
})
10+
export class App {
11+
protected title = 'angular-signals';
12+
}

0 commit comments

Comments
 (0)