Skip to content

Commit 719b39d

Browse files
Merge pull request #514 from jogelin/upgrade-to-nx-18-align-configs
Upgrade to Nx 18 and Align Configs
2 parents 1c88a77 + e022435 commit 719b39d

File tree

135 files changed

+2378
-3484
lines changed

Some content is hidden

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

135 files changed

+2378
-3484
lines changed

.eslintrc.base.json

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"root": true,
3+
"ignorePatterns": ["**/*"],
4+
"plugins": ["@nx"],
5+
"overrides": [
6+
{
7+
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
8+
"rules": {
9+
"@typescript-eslint/no-explicit-any": "warn",
10+
"@nx/enforce-module-boundaries": [
11+
"error",
12+
{
13+
"enforceBuildableLibDependency": true,
14+
"allow": [],
15+
"depConstraints": [
16+
{
17+
"sourceTag": "*",
18+
"onlyDependOnLibsWithTags": ["*"]
19+
}
20+
]
21+
}
22+
]
23+
}
24+
},
25+
{
26+
"files": ["*.ts", "*.tsx"],
27+
"extends": ["plugin:@nx/typescript"],
28+
"rules": { "@typescript-eslint/no-explicit-any": "warn" }
29+
},
30+
{
31+
"files": ["*.js", "*.jsx"],
32+
"extends": ["plugin:@nx/javascript"],
33+
"rules": {}
34+
},
35+
{
36+
"files": ["*.spec.ts", "*.spec.tsx", "*.spec.js", "*.spec.jsx"],
37+
"env": {
38+
"jest": true
39+
},
40+
"rules": {}
41+
},
42+
{
43+
"files": "*.json",
44+
"parser": "jsonc-eslint-parser",
45+
"rules": {}
46+
}
47+
]
48+
}

.eslintrc.json

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
{
2-
"root": true,
32
"ignorePatterns": ["**/*"],
4-
"plugins": ["@nx"],
53
"overrides": [
64
{
75
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
86
"rules": {
9-
"@typescript-eslint/no-explicit-any": "warn",
107
"@nx/enforce-module-boundaries": [
118
"error",
129
{
@@ -24,18 +21,24 @@
2421
},
2522
{
2623
"files": ["*.ts", "*.tsx"],
27-
"extends": ["plugin:@nx/typescript"],
28-
"rules": { "@typescript-eslint/no-explicit-any": "warn" }
24+
"rules": {}
2925
},
3026
{
3127
"files": ["*.js", "*.jsx"],
32-
"extends": ["plugin:@nx/javascript"],
28+
"rules": {}
29+
},
30+
{
31+
"files": ["*.spec.ts", "*.spec.tsx", "*.spec.js", "*.spec.jsx"],
32+
"env": {
33+
"jest": true
34+
},
3335
"rules": {}
3436
},
3537
{
3638
"files": "*.json",
3739
"parser": "jsonc-eslint-parser",
3840
"rules": {}
3941
}
40-
]
42+
],
43+
"extends": ["./.eslintrc.base.json"]
4144
}

.gitignore

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# See http://help.github.com/ignore-files/ for more about ignoring files.
22

33
# compiled output
4-
/dist
5-
/tmp
4+
dist
5+
tmp
66
/out-tsc
77

88
# dependencies
9-
/node_modules
9+
node_modules
1010

1111
# IDEs and editors
1212
/.idea
@@ -25,7 +25,6 @@
2525
!.vscode/extensions.json
2626

2727
# misc
28-
/.angular/cache
2928
/.sass-cache
3029
/connect.lock
3130
/coverage
@@ -39,6 +38,5 @@ testem.log
3938
.DS_Store
4039
Thumbs.db
4140

41+
.nx/cache
4242
.angular
43-
44-
.nx/cache

.prettierignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
/dist
44
/coverage
5-
6-
/.nx/cache
5+
/.nx/cache
6+
.angular

apps/mfe1-e2e/project.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@
1919
},
2020
"lint": {
2121
"executor": "@nx/eslint:lint",
22-
"outputs": ["{options.outputFile}"],
23-
"options": {
24-
"lintFilePatterns": ["apps/mfe1-e2e/**/*.{js,ts}"]
25-
}
22+
"outputs": ["{options.outputFile}"]
2623
}
2724
},
2825
"tags": [],

apps/mfe1/.eslintrc.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"extends": ["../../.eslintrc.json"],
2+
"extends": ["../../.eslintrc.json", "../../.eslintrc.base.json"],
33
"ignorePatterns": ["!**/*"],
44
"overrides": [
55
{
@@ -13,15 +13,15 @@
1313
"error",
1414
{
1515
"type": "attribute",
16-
"prefix": "angularArchitects",
16+
"prefix": "mfe1",
1717
"style": "camelCase"
1818
}
1919
],
2020
"@angular-eslint/component-selector": [
2121
"error",
2222
{
2323
"type": "element",
24-
"prefix": "angular-architects",
24+
"prefix": "mfe1",
2525
"style": "kebab-case"
2626
}
2727
]

apps/mfe1/federation.config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,12 @@ module.exports = withNativeFederation({
1919
},
2020

2121
sharedMappings: ['@angular-architects/playground-lib'],
22+
23+
skip: [
24+
'rxjs/ajax',
25+
'rxjs/fetch',
26+
'rxjs/testing',
27+
'rxjs/webSocket',
28+
// Add further packages you don't need at runtime
29+
],
2230
});

apps/mfe1/jest.config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ export default {
33
displayName: 'mfe1',
44
preset: '../../jest.preset.js',
55
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
6-
globals: {},
76
coverageDirectory: '../../coverage/apps/mfe1',
87
transform: {
98
'^.+\\.(ts|mjs|js|html)$': [

apps/mfe1/project.json

Lines changed: 41 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,47 @@
22
"name": "mfe1",
33
"$schema": "../../node_modules/nx/schemas/project-schema.json",
44
"projectType": "application",
5+
"prefix": "mfe1",
56
"sourceRoot": "apps/mfe1/src",
6-
"prefix": "angular-architects",
7+
"tags": [],
78
"targets": {
89
"build": {
910
"executor": "@angular-architects/native-federation:build",
11+
"options": {},
12+
"configurations": {
13+
"production": {
14+
"target": "mfe1:esbuild:production"
15+
},
16+
"development": {
17+
"target": "mfe1:esbuild:development",
18+
"dev": true
19+
}
20+
},
21+
"defaultConfiguration": "production"
22+
},
23+
"serve": {
24+
"executor": "@angular-architects/native-federation:build",
25+
"options": {
26+
"target": "mfe1:serve-original:development",
27+
"rebuildDelay": 0,
28+
"dev": true,
29+
"port": 0
30+
}
31+
},
32+
"extract-i18n": {
33+
"executor": "@angular-devkit/build-angular:extract-i18n",
34+
"options": {
35+
"buildTarget": "mfe1:build"
36+
}
37+
},
38+
"esbuild": {
39+
"executor": "@angular-devkit/build-angular:application",
1040
"outputs": ["{options.outputPath}"],
1141
"options": {
1242
"outputPath": "dist/apps/mfe1",
1343
"index": "apps/mfe1/src/index.html",
14-
"main": "apps/mfe1/src/main.ts",
15-
"polyfills": "apps/mfe1/src/polyfills.ts",
44+
"browser": "apps/mfe1/src/main.ts",
45+
"polyfills": ["zone.js", "es-module-shims"],
1646
"tsConfig": "apps/mfe1/tsconfig.app.json",
1747
"assets": ["apps/mfe1/src/favicon.ico", "apps/mfe1/src/assets"],
1848
"styles": ["apps/mfe1/src/styles.css"],
@@ -32,56 +62,30 @@
3262
"maximumError": "4kb"
3363
}
3464
],
35-
"fileReplacements": [
36-
{
37-
"replace": "apps/mfe1/src/environments/environment.ts",
38-
"with": "apps/mfe1/src/environments/environment.prod.ts"
39-
}
40-
],
4165
"outputHashing": "all"
4266
},
4367
"development": {
44-
"buildOptimizer": false,
4568
"optimization": false,
46-
"vendorChunk": true,
4769
"extractLicenses": false,
48-
"sourceMap": true,
49-
"namedChunks": true
70+
"sourceMap": true
5071
}
5172
},
5273
"defaultConfiguration": "production"
5374
},
54-
"serve": {
75+
"serve-original": {
5576
"executor": "@angular-devkit/build-angular:dev-server",
77+
"options": {
78+
"port": 4201
79+
},
5680
"configurations": {
5781
"production": {
58-
"buildTarget": "mfe1:build:production"
82+
"buildTarget": "mfe1:esbuild:production"
5983
},
6084
"development": {
61-
"buildTarget": "mfe1:build:development"
85+
"buildTarget": "mfe1:esbuild:development"
6286
}
6387
},
6488
"defaultConfiguration": "development"
65-
},
66-
"extract-i18n": {
67-
"executor": "@angular-devkit/build-angular:extract-i18n",
68-
"options": {
69-
"buildTarget": "mfe1:build"
70-
}
71-
},
72-
"lint": {
73-
"executor": "@nx/eslint:lint",
74-
"options": {
75-
"lintFilePatterns": ["apps/mfe1/**/*.ts", "apps/mfe1/**/*.html"]
76-
}
77-
},
78-
"test": {
79-
"executor": "@nx/jest:jest",
80-
"outputs": ["{workspaceRoot}/coverage/apps/mfe1"],
81-
"options": {
82-
"jestConfig": "apps/mfe1/jest.config.ts"
83-
}
8489
}
85-
},
86-
"tags": []
90+
}
8791
}

apps/mfe1/src/app/app.component.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
<angular-architects-nx-welcome></angular-architects-nx-welcome>
1+
<mfe1-nx-welcome></mfe1-nx-welcome>
2+
<router-outlet></router-outlet>

apps/mfe1/src/app/app.component.spec.ts

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

apps/mfe1/src/app/app.component.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
import { Component } from '@angular/core';
2+
import { RouterModule } from '@angular/router';
3+
import { NxWelcomeComponent } from './nx-welcome.component';
24

35
@Component({
4-
selector: 'angular-architects-root',
6+
standalone: true,
7+
imports: [NxWelcomeComponent, RouterModule],
8+
selector: 'mfe1-app-root',
59
templateUrl: './app.component.html',
6-
styleUrls: ['./app.component.css'],
10+
styleUrl: './app.component.css',
711
})
812
export class AppComponent {
913
title = 'mfe1';

apps/mfe1/src/app/app.config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { ApplicationConfig } from '@angular/core';
2+
import { provideRouter } from '@angular/router';
3+
import { appRoutes } from './app.routes';
4+
5+
export const appConfig: ApplicationConfig = {
6+
providers: [provideRouter(appRoutes)],
7+
};

apps/mfe1/src/app/app.module.ts

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

apps/mfe1/src/app/app.routes.ts

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[] = [];

apps/mfe1/src/app/demo/demo.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { Component } from '@angular/core';
77

88
@Component({
99
standalone: true,
10-
selector: 'angular-architects-demo',
10+
selector: 'mfe1-demo',
1111
templateUrl: './demo.component.html',
1212
styleUrls: ['./demo.component.css'],
1313
imports: [CommonModule, PlaygroundLibModule],

0 commit comments

Comments
 (0)