Skip to content

Commit 812a4bf

Browse files
chore: create base applications
1 parent 1e55d1d commit 812a4bf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+20726
-3058
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,5 @@ Thumbs.db
4040

4141
.nx/cache
4242
.nx/workspace-data
43+
44+
.angular

.prettierignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Add files here to ignore them from prettier formatting
2+
/dist
3+
/coverage
4+
/.nx/cache
5+
/.nx/workspace-data
6+
.angular

.prettierrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"singleQuote": true
3+
}

.vscode/extensions.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"recommendations": [
3-
43
"nrwl.angular-console",
5-
"esbenp.prettier-vscode"
4+
"esbenp.prettier-vscode",
5+
"dbaeumer.vscode-eslint"
66
]
77
}

apps/bytebank/eslint.config.mjs

+34
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+
];
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { ModuleFederationConfig } from '@nx/module-federation';
2+
3+
const config: ModuleFederationConfig = {
4+
name: 'bytebank',
5+
/**
6+
* To use a remote that does not exist in your current Nx Workspace
7+
* You can use the tuple-syntax to define your remote
8+
*
9+
* remotes: [['my-external-remote', 'https://nx-angular-remote.netlify.app']]
10+
*
11+
* You _may_ need to add a `remotes.d.ts` file to your `src/` folder declaring the external remote for tsc, with the
12+
* following content:
13+
*
14+
* declare module 'my-external-remote';
15+
*
16+
*/
17+
remotes: ['dashboard'],
18+
};
19+
20+
/**
21+
* Nx requires a default export of the config to allow correct resolution of the module federation graph.
22+
**/
23+
export default config;

apps/bytebank/project.json

+95
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
{
2+
"name": "bytebank",
3+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
4+
"projectType": "application",
5+
"prefix": "app",
6+
"sourceRoot": "apps/bytebank/src",
7+
"tags": [],
8+
"targets": {
9+
"build": {
10+
"executor": "@nx/angular:webpack-browser",
11+
"outputs": ["{options.outputPath}"],
12+
"options": {
13+
"outputPath": "dist/apps/bytebank",
14+
"index": "apps/bytebank/src/index.html",
15+
"main": "apps/bytebank/src/main.ts",
16+
"polyfills": ["zone.js"],
17+
"tsConfig": "apps/bytebank/tsconfig.app.json",
18+
"inlineStyleLanguage": "scss",
19+
"assets": [
20+
{
21+
"glob": "**/*",
22+
"input": "apps/bytebank/public"
23+
}
24+
],
25+
"styles": ["apps/bytebank/src/styles.scss"],
26+
"scripts": [],
27+
"customWebpackConfig": {
28+
"path": "apps/bytebank/webpack.config.ts"
29+
}
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+
"customWebpackConfig": {
47+
"path": "apps/bytebank/webpack.prod.config.ts"
48+
}
49+
},
50+
"development": {
51+
"buildOptimizer": false,
52+
"optimization": false,
53+
"vendorChunk": true,
54+
"extractLicenses": false,
55+
"sourceMap": true,
56+
"namedChunks": true
57+
}
58+
},
59+
"defaultConfiguration": "production"
60+
},
61+
"serve": {
62+
"executor": "@nx/angular:module-federation-dev-server",
63+
"options": {
64+
"port": 4200,
65+
"publicHost": "http://localhost:4200"
66+
},
67+
"configurations": {
68+
"production": {
69+
"buildTarget": "bytebank:build:production"
70+
},
71+
"development": {
72+
"buildTarget": "bytebank:build:development"
73+
}
74+
},
75+
"defaultConfiguration": "development"
76+
},
77+
"extract-i18n": {
78+
"executor": "@angular-devkit/build-angular:extract-i18n",
79+
"options": {
80+
"buildTarget": "bytebank:build"
81+
}
82+
},
83+
"lint": {
84+
"executor": "@nx/eslint:lint"
85+
},
86+
"serve-static": {
87+
"executor": "@nx/web:file-server",
88+
"options": {
89+
"buildTarget": "bytebank:build",
90+
"port": 4200,
91+
"spa": true
92+
}
93+
}
94+
}
95+
}

apps/bytebank/public/favicon.ico

14.7 KB
Binary file not shown.
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<ul class="remote-menu">
2+
<li><a routerLink="/">Home</a></li>
3+
<li><a routerLink="dashboard">Dashboard</a></li>
4+
</ul>
5+
<router-outlet></router-outlet>

apps/bytebank/src/app/app.component.scss

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { fakeAsync, TestBed, tick } from '@angular/core/testing';
2+
import { AppComponent } from './app.component';
3+
import { NxWelcomeComponent } from './nx-welcome.component';
4+
import { Router, RouterModule } from '@angular/router';
5+
6+
describe('AppComponent', () => {
7+
beforeEach(async () => {
8+
await TestBed.configureTestingModule({
9+
imports: [
10+
RouterModule.forRoot([{ path: '', component: NxWelcomeComponent }]),
11+
AppComponent,
12+
NxWelcomeComponent,
13+
],
14+
}).compileComponents();
15+
});
16+
17+
it('should create the app', () => {
18+
const fixture = TestBed.createComponent(AppComponent);
19+
const app = fixture.componentInstance;
20+
expect(app).toBeTruthy();
21+
});
22+
23+
it(`should have as title 'bytebank'`, () => {
24+
const fixture = TestBed.createComponent(AppComponent);
25+
const app = fixture.componentInstance;
26+
expect(app.title).toEqual('bytebank');
27+
});
28+
29+
it('should render title', fakeAsync(() => {
30+
const fixture = TestBed.createComponent(AppComponent);
31+
const router = TestBed.inject(Router);
32+
fixture.ngZone?.run(() => router.navigate(['']));
33+
tick();
34+
fixture.detectChanges();
35+
const compiled = fixture.nativeElement as HTMLElement;
36+
expect(compiled.querySelector('h1')?.textContent).toContain(
37+
'Welcome bytebank'
38+
);
39+
}));
40+
});
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Component } from '@angular/core';
2+
import { RouterModule } from '@angular/router';
3+
import { NxWelcomeComponent } from './nx-welcome.component';
4+
5+
@Component({
6+
imports: [NxWelcomeComponent, RouterModule],
7+
selector: 'app-root',
8+
templateUrl: './app.component.html',
9+
styleUrl: './app.component.scss',
10+
})
11+
export class AppComponent {
12+
title = 'bytebank';
13+
}

apps/bytebank/src/app/app.config.ts

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';
2+
import { provideRouter } from '@angular/router';
3+
import { appRoutes } from './app.routes';
4+
5+
export const appConfig: ApplicationConfig = {
6+
providers: [
7+
provideZoneChangeDetection({ eventCoalescing: true }),
8+
provideRouter(appRoutes),
9+
],
10+
};

apps/bytebank/src/app/app.routes.ts

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { NxWelcomeComponent } from './nx-welcome.component';
2+
import { Route } from '@angular/router';
3+
4+
export const appRoutes: Route[] = [
5+
{
6+
path: 'dashboard',
7+
loadChildren: () => import('dashboard/Routes').then((m) => m!.remoteRoutes),
8+
},
9+
{
10+
path: '',
11+
component: NxWelcomeComponent,
12+
},
13+
];

0 commit comments

Comments
 (0)