Skip to content

Commit 281f4d5

Browse files
authored
Merge pull request #63 from jsGanttImproved/upgrade/angular-19-complete
Upgrade to Angular 19: align all packages and fix deprecated APIs
2 parents 1fafe4d + b8f2989 commit 281f4d5

11 files changed

Lines changed: 53 additions & 180 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -17,39 +17,7 @@ jobs:
1717
- name: Set up Node.js
1818
uses: actions/setup-node@v3
1919
with:
20-
node-version: '18'
21-
22-
# package.json has inconsistent Angular versions (10.0.8, 19.x, ^9 ng-packagr),
23-
# TypeScript 3.9.7 (ng-packagr@11 needs >=4.0 <4.2), and webpack:"*" which
24-
# resolves to v5 — but build-angular@0.900 uses webpack 4 APIs (ParserHelpers
25-
# was removed in v5). Patch everything to a consistent Angular 11 set.
26-
- name: Pin Angular 11 + TypeScript 4.1 + webpack 4 in package.json
27-
run: |
28-
node -e "
29-
const fs = require('fs');
30-
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
31-
const v = '11.2.14';
32-
const ng = ['@angular/animations','@angular/common','@angular/compiler',
33-
'@angular/compiler-cli','@angular/core','@angular/forms',
34-
'@angular/platform-browser','@angular/platform-browser-dynamic',
35-
'@angular/router'];
36-
ng.forEach(p => {
37-
if (pkg.dependencies && pkg.dependencies[p]) pkg.dependencies[p] = v;
38-
if (pkg.devDependencies && pkg.devDependencies[p]) pkg.devDependencies[p] = v;
39-
});
40-
if (pkg.dependencies) pkg.dependencies['webpack'] = '4.46.0';
41-
if (pkg.devDependencies) {
42-
pkg.devDependencies['ng-packagr'] = '11.2.0';
43-
pkg.devDependencies['typescript'] = '4.1.6';
44-
pkg.devDependencies['@angular/cli'] = '11.2.19';
45-
pkg.devDependencies['@angular-devkit/build-angular'] = '0.1102.19';
46-
pkg.devDependencies['@angular-devkit/schematics'] = '11.2.19';
47-
}
48-
// source-map 0.8+ requires WASM init; pin transitive dep to last 0.7.x.
49-
// Only safe as an override (not direct dep) to avoid EOVERRIDE conflict.
50-
pkg.overrides = { 'source-map': '0.7.4' };
51-
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2));
52-
"
20+
node-version: '20'
5321

5422
- name: Install dependencies
5523
run: npm install --legacy-peer-deps
@@ -61,9 +29,7 @@ jobs:
6129
run: npm run copy
6230

6331
- name: Build demo app
64-
run: npx ng build --prod --base-href /ng-gantt/
65-
env:
66-
NODE_OPTIONS: --openssl-legacy-provider
32+
run: npx ng build dev --configuration production --base-href /ng-gantt/
6733

6834
deploy:
6935
name: Deploy to GitHub Pages
@@ -77,33 +43,7 @@ jobs:
7743
- name: Set up Node.js
7844
uses: actions/setup-node@v3
7945
with:
80-
node-version: '18'
81-
82-
- name: Pin Angular 11 + TypeScript 4.1 + webpack 4 in package.json
83-
run: |
84-
node -e "
85-
const fs = require('fs');
86-
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
87-
const v = '11.2.14';
88-
const ng = ['@angular/animations','@angular/common','@angular/compiler',
89-
'@angular/compiler-cli','@angular/core','@angular/forms',
90-
'@angular/platform-browser','@angular/platform-browser-dynamic',
91-
'@angular/router'];
92-
ng.forEach(p => {
93-
if (pkg.dependencies && pkg.dependencies[p]) pkg.dependencies[p] = v;
94-
if (pkg.devDependencies && pkg.devDependencies[p]) pkg.devDependencies[p] = v;
95-
});
96-
if (pkg.dependencies) pkg.dependencies['webpack'] = '4.46.0';
97-
if (pkg.devDependencies) {
98-
pkg.devDependencies['ng-packagr'] = '11.2.0';
99-
pkg.devDependencies['typescript'] = '4.1.6';
100-
pkg.devDependencies['@angular/cli'] = '11.2.19';
101-
pkg.devDependencies['@angular-devkit/build-angular'] = '0.1102.19';
102-
pkg.devDependencies['@angular-devkit/schematics'] = '11.2.19';
103-
}
104-
pkg.overrides = { 'source-map': '0.7.4' };
105-
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2));
106-
"
46+
node-version: '20'
10747

10848
- name: Install dependencies
10949
run: npm install --legacy-peer-deps
@@ -115,9 +55,7 @@ jobs:
11555
run: npm run copy
11656

11757
- name: Build demo app for production
118-
run: npx ng build --prod --base-href /ng-gantt/
119-
env:
120-
NODE_OPTIONS: --openssl-legacy-provider
58+
run: npx ng build dev --configuration production --base-href /ng-gantt/
12159

12260
- name: Deploy to GitHub Pages
12361
uses: peaceiris/actions-gh-pages@v3

angular.json

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,9 @@
3030
"optimization": true,
3131
"outputHashing": "all",
3232
"sourceMap": false,
33-
"extractCss": true,
3433
"namedChunks": false,
35-
"aot": true,
3634
"extractLicenses": true,
3735
"vendorChunk": false,
38-
"buildOptimizer": true,
3936
"fileReplacements": [
4037
{
4138
"replace": "src/environments/environment.ts",
@@ -79,39 +76,6 @@
7976
]
8077
}
8178
},
82-
"lint": {
83-
"builder": "@angular-devkit/build-angular:tslint",
84-
"options": {
85-
"tsConfig": [
86-
"src/tsconfig.app.json",
87-
"src/tsconfig.spec.json"
88-
],
89-
"exclude": []
90-
}
91-
}
92-
}
93-
},
94-
"dev-e2e": {
95-
"root": "",
96-
"sourceRoot": "",
97-
"projectType": "application",
98-
"architect": {
99-
"e2e": {
100-
"builder": "@angular-devkit/build-angular:protractor",
101-
"options": {
102-
"protractorConfig": "./protractor.conf.js",
103-
"devServerTarget": "dev:serve"
104-
}
105-
},
106-
"lint": {
107-
"builder": "@angular-devkit/build-angular:tslint",
108-
"options": {
109-
"tsConfig": [
110-
"e2e/tsconfig.e2e.json"
111-
],
112-
"exclude": []
113-
}
114-
}
11579
}
11680
},
11781
"packages": {
@@ -141,12 +105,9 @@
141105
"optimization": true,
142106
"outputHashing": "all",
143107
"sourceMap": false,
144-
"extractCss": true,
145108
"namedChunks": false,
146-
"aot": true,
147109
"extractLicenses": true,
148110
"vendorChunk": false,
149-
"buildOptimizer": true,
150111
"fileReplacements": [
151112
{
152113
"replace": "src/environments/environment.ts",
@@ -190,20 +151,9 @@
190151
]
191152
}
192153
},
193-
"lint": {
194-
"builder": "@angular-devkit/build-angular:tslint",
195-
"options": {
196-
"tsConfig": [
197-
"src/tsconfig.app.json",
198-
"src/tsconfig.spec.json"
199-
],
200-
"exclude": []
201-
}
202-
}
203154
}
204155
}
205156
},
206-
"defaultProject": "dev",
207157
"schematics": {
208158
"@schematics/angular:component": {
209159
"prefix": "app",

ng-gantt/ng-package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"$schema": "../node_modules/ng-packagr/ng-package.schema.json",
3+
"lib": {
4+
"entryFile": "src/public_api.ts"
5+
},
6+
"dest": "../dist/ng-gantt"
7+
}

ng-gantt/package.json

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,5 @@
2020
"@angular/common": ">=8.0.0",
2121
"jsgantt-improved": "*"
2222
},
23-
"ngPackage": {
24-
"$schema": "./node_modules/ng-packagr/ng-package.schema.json",
25-
26-
"lib": {
27-
"entryFile": "src/public_api.ts"
28-
},
29-
"dest": "../dist/ng-gantt"
30-
}
23+
"ngPackagr": "ng-package.json"
3124
}

ng-gantt/src/gantt/gantt.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { GanttEditorOptions } from './gantt.editoroptions';
88
@Component({
99
// tslint:disable-next-line:component-selector
1010
selector: 'ng-gantt',
11+
standalone: false,
1112
template: '<div [id]="id" #ganttEditorContainer></div>'
1213
})
1314
export class GanttEditorComponent implements OnInit {

package.json

Lines changed: 31 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -5,64 +5,54 @@
55
"license": "MIT",
66
"scripts": {
77
"start": "ng serve",
8-
"build": "npm run copy && ng build",
8+
"build": "npm run copy && ng build dev",
99
"copy": "cp -R dist/ng-gantt src/ng-gantt",
1010
"build:app": "npm run copy && ng build --project packages && rimraf src/ng-gantt",
11-
"build:lib": "rimraf dist && ng-packagr -p ng-gantt/package.json",
11+
"build:lib": "rimraf dist && ng-packagr -p ng-gantt/ng-package.json",
1212
"publish-npm": "npm run build:lib && cd dist/ng-gantt && npm publish",
1313
"reload": "npm run build:lib && npm run build && npm run start",
1414
"dev": "cd dist/app && http-server",
15-
"test": "ng test dev --watch=false && npm run e2e",
15+
"test": "ng test dev --watch=false",
1616
"unittest": "ng test",
1717
"lint": "ng lint",
18-
"e2e": "ng e2e",
1918
"kill": "kill -9 $(lsof -t -i:4200)",
2019
"reinstall": "rm package-lock.json && rm -rf node_modules && npm i",
2120
"sass:rebuild": "npm rebuild node-sass"
2221
},
2322
"dependencies": {
24-
"@angular/common": "10.0.8",
23+
"@angular/common": "19.2.18",
2524
"@angular/compiler": "19.2.18",
2625
"@angular/core": "19.2.18",
27-
"@angular/forms": "10.0.8",
28-
"@angular/http": "*",
29-
"@angular/platform-browser": "10.0.8",
30-
"@angular/platform-browser-dynamic": "10.0.8",
31-
"@angular/router": "10.0.8",
32-
"core-js": "^3.6.4",
33-
"rxjs": "*",
34-
"webpack": "*",
35-
"zone.js": "^0.10.3",
26+
"@angular/forms": "19.2.18",
27+
"@angular/platform-browser": "19.2.18",
28+
"@angular/platform-browser-dynamic": "19.2.18",
29+
"@angular/router": "19.2.18",
30+
"rxjs": "^7.4.0",
31+
"zone.js": "~0.16.0",
3632
"jsgantt-improved": "*"
3733
},
3834
"devDependencies": {
39-
"@angular-devkit/build-angular": "~0.900.2",
40-
"@angular-devkit/schematics": "^9.0.2",
41-
"@angular/cli": "10.0.5",
42-
"@angular/compiler-cli": "10.0.8",
43-
"@angular/language-service": "10.0.8",
44-
"@types/jasmine": "3.3.8",
45-
"@types/node": "^13.7.1",
46-
"codelyzer": "~5.0.0",
35+
"@angular-devkit/build-angular": "~19.2.24",
36+
"@angular-devkit/schematics": "~19.2.24",
37+
"@angular/cli": "~19.2.24",
38+
"@angular/compiler-cli": "19.2.18",
39+
"@angular/language-service": "19.2.18",
40+
"@types/jasmine": "~4.3.0",
41+
"@types/node": "^18.0.0",
4742
"cpr": "^3.0.0",
48-
"jasmine": "^3.3.0",
49-
"jasmine-core": "^3.3.0",
50-
"jasmine-spec-reporter": "^4.2.1",
51-
"karma": "~4.1.0",
52-
"karma-chrome-launcher": "~2.2.0",
53-
"karma-cli": "~1.0.1",
54-
"karma-coverage-istanbul-reporter": "^2.0.0",
55-
"karma-jasmine": "~2.0.1",
56-
"karma-jasmine-html-reporter": "^1.4.0",
57-
"ng-packagr": "^9.0.0",
58-
"protractor": "~5.4.0",
59-
"rimraf": "^2.7.1",
60-
"ts-node": "~7.0.0",
61-
"tsickle": "^0.29.0",
62-
"tslib": "^1.9.0",
63-
"tslint": "~6.1.3",
64-
"typescript": "3.9.7",
65-
"awesome-typescript-loader": "^2.2.1",
66-
"rollup": "0.67.4"
43+
"jasmine": "^4.0.0",
44+
"jasmine-core": "^4.0.0",
45+
"jasmine-spec-reporter": "~7.0.0",
46+
"karma": "~6.4.0",
47+
"karma-chrome-launcher": "~3.2.0",
48+
"karma-cli": "~2.0.0",
49+
"karma-coverage": "~2.2.0",
50+
"karma-jasmine": "~5.1.0",
51+
"karma-jasmine-html-reporter": "^2.1.0",
52+
"ng-packagr": "~19.2.2",
53+
"rimraf": "^5.0.0",
54+
"ts-node": "~10.9.0",
55+
"tslib": "^2.3.0",
56+
"typescript": "~5.7.0"
6757
}
6858
}

src/app/app.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Component } from '@angular/core';
22

33
@Component({
44
selector: 'app-root',
5+
standalone: false,
56
templateUrl: './app.component.html',
67
styleUrls: ['./app.component.css']
78
})

src/app/app.module.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { BrowserModule } from '@angular/platform-browser';
22
import { NgModule } from '@angular/core';
33
import { FormsModule } from '@angular/forms';
4-
import { HttpModule } from '@angular/http';
4+
import { HttpClientModule } from '@angular/common/http';
55
import { Routes, RouterModule } from '@angular/router';
66
import { AppComponent } from './app.component';
77
import { NgGanttEditorModule } from 'ng-gantt';
@@ -19,7 +19,7 @@ export const routes: Routes = [
1919
imports: [
2020
BrowserModule,
2121
FormsModule,
22-
HttpModule,
22+
HttpClientModule,
2323
NgGanttEditorModule,
2424
RouterModule.forRoot(routes)
2525
],

src/app/demo/demo.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { GanttEditorComponent } from 'ng-gantt';
33

44
@Component({
55
selector: 'app-demo',
6+
standalone: false,
67
templateUrl: './demo.component.html',
78
styleUrls: ['./demo.component.css']
89
})

src/polyfills.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,10 @@
4040
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
4141

4242

43-
/** Evergreen browsers require these. **/
44-
import 'core-js/es/reflect';
45-
46-
47-
/** ALL Firefox browsers require the following to support `@angular/animation`. **/
48-
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
49-
50-
51-
5243
/***************************************************************************************************
5344
* Zone JS is required by Angular itself.
5445
*/
55-
import 'zone.js/dist/zone'; // Included with Angular CLI.
46+
import 'zone.js'; // Included with Angular CLI.
5647

5748

5849

0 commit comments

Comments
 (0)