Skip to content

Commit b38b483

Browse files
committed
misc: upgrade to angular 21
1 parent cb26256 commit b38b483

25 files changed

+10666
-20235
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
/out-tsc
77
/app-builds
88
/release
9+
/test-results
910
main.js
1011
src/**/*.js
1112
*.js.map

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414

1515
# Introduction
1616

17-
Bootstrap and package your project with Angular 20 and Electron 39 (Typescript + SASS + Hot Reload) for creating Desktop applications.
17+
Bootstrap and package your project with Angular 21 and Electron 39 (Typescript + SASS + Hot Reload) for creating Desktop applications.
1818

1919
Currently runs with:
2020

21-
- Angular v20.3.15
21+
- Angular v21.0.3
2222
- Electron v39.2.5
2323

2424
With this sample, you can:
@@ -160,7 +160,8 @@ Please refer to [HOW_TO file](./HOW_TO.md)
160160
- Angular 16 & Electron 25 : Branch [angular16](https://github.com/maximegris/angular-electron/tree/angular16)
161161
- Angular 17 & Electron 30 : Branch [angular17](https://github.com/maximegris/angular-electron/tree/angular17)
162162
Angular 19 & Electron 36 : Branch [angular19](https://github.com/maximegris/angular-electron/tree/angular19)
163-
- Angular 20 & Electron 39 : (main)
163+
Angular 20 & Electron 39 : Branch [angular19](https://github.com/maximegris/angular-electron/tree/angular20)
164+
- Angular 21 & Electron 39 : (main)
164165

165166
[maintained-badge]: https://img.shields.io/badge/maintained-yes-brightgreen
166167
[license-badge]: https://img.shields.io/badge/license-MIT-blue.svg

angular.json

Lines changed: 34 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,16 @@
2323
"prefix": "app",
2424
"architect": {
2525
"build": {
26-
"builder": "@angular-builders/custom-webpack:browser",
26+
"builder": "@angular/build:application",
2727
"options": {
28-
"outputPath": "dist",
28+
"outputPath": {
29+
"base": "dist"
30+
},
2931
"index": "src/index.html",
30-
"main": "src/main.ts",
32+
"polyfills": [
33+
"zone.js"
34+
],
3135
"tsConfig": "src/tsconfig.app.json",
32-
"polyfills": "src/polyfills.ts",
3336
"inlineStyleLanguage": "scss",
3437
"assets": [
3538
"src/favicon.ico",
@@ -39,10 +42,7 @@
3942
"src/styles.scss"
4043
],
4144
"scripts": [],
42-
"customWebpackConfig": {
43-
"path": "./angular.webpack.js",
44-
"replaceDuplicatePlugins": true
45-
}
45+
"browser": "src/main.ts"
4646
},
4747
"configurations": {
4848
"dev": {
@@ -52,8 +52,6 @@
5252
"namedChunks": false,
5353
"aot": false,
5454
"extractLicenses": true,
55-
"vendorChunk": false,
56-
"buildOptimizer": false,
5755
"fileReplacements": [
5856
{
5957
"replace": "src/environments/environment.ts",
@@ -68,51 +66,23 @@
6866
"namedChunks": false,
6967
"aot": true,
7068
"extractLicenses": true,
71-
"vendorChunk": false,
72-
"buildOptimizer": true,
7369
"fileReplacements": [
7470
{
7571
"replace": "src/environments/environment.ts",
7672
"with": "src/environments/environment.prod.ts"
7773
}
7874
]
79-
},
80-
"web": {
81-
"optimization": false,
82-
"outputHashing": "none",
83-
"sourceMap": true,
84-
"namedChunks": false,
85-
"aot": false,
86-
"extractLicenses": true,
87-
"vendorChunk": false,
88-
"buildOptimizer": false,
89-
"fileReplacements": [
90-
{
91-
"replace": "src/environments/environment.ts",
92-
"with": "src/environments/environment.web.ts"
93-
}
94-
]
95-
},
96-
"web-production": {
97-
"optimization": true,
98-
"outputHashing": "all",
99-
"sourceMap": false,
100-
"namedChunks": false,
101-
"aot": true,
102-
"extractLicenses": true,
103-
"vendorChunk": false,
104-
"buildOptimizer": true,
105-
"fileReplacements": [
106-
{
107-
"replace": "src/environments/environment.ts",
108-
"with": "src/environments/environment.web.prod.ts"
109-
}
75+
}
76+
"testing": {
77+
"polyfills": [
78+
"zone.js",
79+
"zone.js/testing"
11080
]
11181
}
11282
}
11383
},
11484
"serve": {
115-
"builder": "@angular-builders/custom-webpack:dev-server",
85+
"builder": "@angular/build:dev-server",
11686
"options": {
11787
"buildTarget": "angular-electron:build"
11888
},
@@ -122,12 +92,6 @@
12292
},
12393
"production": {
12494
"buildTarget": "angular-electron:build:production"
125-
},
126-
"web": {
127-
"buildTarget": "angular-electron:build:web"
128-
},
129-
"web-production": {
130-
"buildTarget": "angular-electron:build:web-production"
13195
}
13296
}
13397
},
@@ -138,11 +102,28 @@
138102
}
139103
},
140104
"test": {
141-
"builder": "@angular-builders/jest:run",
105+
"builder": "@angular/build:unit-test",
142106
"options": {
143-
"polyfills": ["src/polyfills-test.ts"],
107+
"runner": "vitest",
144108
"tsConfig": "src/tsconfig.spec.json",
145-
"globalMocks": ["styleTransform", "matchMedia", "getComputedStyle"]
109+
"browsers": [
110+
"chromium"
111+
],
112+
"buildTarget": "angular-electron:build:testing",
113+
"coverage": true,
114+
"coverageReporters": [
115+
"html",
116+
"lcovonly"
117+
],
118+
"reporters": [
119+
["default", { "summary": true }],
120+
[
121+
"html",
122+
{
123+
"outputFile": "test-results/vitest/index.html"
124+
}
125+
]
126+
]
146127
}
147128
},
148129
"lint": {

angular.webpack.js

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

app/main.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ function createWindow(): BrowserWindow {
3636
win.loadURL('http://localhost:4200');
3737
} else {
3838
// Path when running electron executable
39-
let pathIndex = './index.html';
39+
let pathIndex = './browser/index.html';
4040

41-
if (fs.existsSync(path.join(__dirname, '../dist/index.html'))) {
41+
if (fs.existsSync(path.join(__dirname, '../dist/browser/index.html'))) {
4242
// Path when running electron in local folder
43-
pathIndex = '../dist/index.html';
43+
pathIndex = '../dist/browser/index.html';
4444
}
4545

4646
const fullPath = path.join(__dirname, pathIndex);

app/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"name": "Maxime GRIS",
66
"email": "maxime.gris@gmail.com"
77
},
8-
"version": "15.0.0",
8+
"version": "17.0.0",
99
"main": "main.js",
1010
"private": true,
1111
"dependencies": {

electron-builder.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,22 @@
1515
}
1616
],
1717
"win": {
18-
"icon": "dist/assets/icons",
18+
"icon": "dist/browser/assets/icons",
1919
"target": [
2020
"portable"
2121
]
2222
},
2323
"portable": {
24-
"splashImage": "dist/assets/icons/electron.bmp"
24+
"splashImage": "dist/browser/assets/icons/electron.bmp"
2525
},
2626
"mac": {
27-
"icon": "dist/assets/icons",
27+
"icon": "dist/browser/assets/icons",
2828
"target": [
2929
"dmg"
3030
]
3131
},
3232
"linux": {
33-
"icon": "dist/assets/icons",
33+
"icon": "dist/browser/assets/icons",
3434
"target": [
3535
"AppImage"
3636
]

jest.config.js

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

0 commit comments

Comments
 (0)