Skip to content

Commit 8480c0d

Browse files
authored
Update angular recipe (#40)
1 parent 70656b8 commit 8480c0d

File tree

11 files changed

+47
-43
lines changed

11 files changed

+47
-43
lines changed

ci/typescript/create_angular_ng.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function merge-json() {
1818
npm install -g @angular/cli
1919

2020
# 2. Create Angular application
21-
ng new angular_ng --directory ./ --minimal --routing=false --skip-git --ssr=false --style=css
21+
ng new angular_ng --directory ./ --minimal --routing=false --skip-git --ssr=false --style=css --zoneless=false
2222

2323
# 3. Build and serve the initial project
2424
# npm run build
@@ -64,8 +64,8 @@ export class BokehJSComponent implements OnInit {
6464
}
6565
EOF
6666

67-
# 6. Replace src/app/app.component.ts so that it uses the BokehJSComponent
68-
cat > src/app/app.component.ts << EOF
67+
# 6. Replace src/app/app.ts so that it uses the BokehJSComponent
68+
cat > src/app/app.ts << EOF
6969
import { Component } from '@angular/core'
7070
import { BokehJSComponent } from './bokeh-js/bokeh-js.component';
7171
@@ -76,7 +76,7 @@ import { BokehJSComponent } from './bokeh-js/bokeh-js.component';
7676
styles: [],
7777
})
7878
79-
export class AppComponent {}
79+
export class App {}
8080
EOF
8181

8282
# 7. Remove some build warnings by allowing non ESM imports by adding to angular.json

recipes/src/recipes/typescript/angular_ng_recipe.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export class AngularNgRecipe extends Recipe {
1818

1919
this.add(new CommandStep(
2020
'Create Angular application',
21-
['ng new angular_ng --directory ./ --minimal --routing=false --skip-git --ssr=false --style=css']
21+
['ng new angular_ng --directory ./ --minimal --routing=false --skip-git --ssr=false --style=css --zoneless=false']
2222
));
2323

2424
this.add(new CommandStep(
@@ -55,8 +55,8 @@ export class AngularNgRecipe extends Recipe {
5555
);
5656

5757
this.add(new ReplaceFileStep(
58-
'Replace `src/app/app.component.ts` so that it uses the `BokehJSComponent`',
59-
'src/app/app.component.ts',
58+
'Replace `src/app/app.ts` so that it uses the `BokehJSComponent`',
59+
'src/app/app.ts',
6060
"import { Component } from '@angular/core'\n" +
6161
"import { BokehJSComponent } from './bokeh-js/bokeh-js.component';\n\n" +
6262
"@Component({\n" +
@@ -65,7 +65,7 @@ export class AngularNgRecipe extends Recipe {
6565
" template: \\`<app-bokeh-js></app-bokeh-js>\\`,\n" +
6666
" styles: [],\n" +
6767
"})\n\n" +
68-
"export class AppComponent {}")
68+
"export class App {}")
6969
);
7070

7171
this.add(new MergeJsonStep(

typescript/angular_ng/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ The Angular web framework includes its own builder `ng` in the `@angular/cli` pa
1111
2. Create Angular application
1212

1313
```bash
14-
ng new angular_ng --directory ./ --minimal --routing=false --skip-git --ssr=false --style=css
14+
ng new angular_ng --directory ./ --minimal --routing=false --skip-git --ssr=false --style=css --zoneless=false
1515
```
1616

1717
3. Build and serve the initial project
@@ -65,7 +65,7 @@ The Angular web framework includes its own builder `ng` in the `@angular/cli` pa
6565
}
6666
```
6767
68-
6. Replace `src/app/app.component.ts` so that it uses the `BokehJSComponent` containing
68+
6. Replace `src/app/app.ts` so that it uses the `BokehJSComponent` containing
6969
7070
```ts
7171
import { Component } from '@angular/core'
@@ -78,7 +78,7 @@ The Angular web framework includes its own builder `ng` in the `@angular/cli` pa
7878
styles: [],
7979
})
8080
81-
export class AppComponent {}
81+
export class App {}
8282
```
8383
8484
7. Remove some build warnings by allowing non ESM imports by adding to `angular.json`

typescript/angular_ng/created/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# AngularNg
22

3-
This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 19.2.9.
3+
This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 20.0.1.
44

55
## Development server
66

typescript/angular_ng/created/angular.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,8 @@
3838
"prefix": "app",
3939
"architect": {
4040
"build": {
41-
"builder": "@angular-devkit/build-angular:application",
41+
"builder": "@angular/build:application",
4242
"options": {
43-
"outputPath": "dist/angular_ng",
44-
"index": "src/index.html",
4543
"browser": "src/main.ts",
4644
"polyfills": [
4745
"zone.js"
@@ -56,7 +54,6 @@
5654
"styles": [
5755
"src/styles.css"
5856
],
59-
"scripts": [],
6057
"allowedCommonJsDependencies": [
6158
"@bokeh/bokehjs",
6259
"mathjax-full",
@@ -77,7 +74,7 @@
7774
"defaultConfiguration": "production"
7875
},
7976
"serve": {
80-
"builder": "@angular-devkit/build-angular:dev-server",
77+
"builder": "@angular/build:dev-server",
8178
"configurations": {
8279
"production": {
8380
"buildTarget": "angular_ng:build:production"
@@ -89,7 +86,7 @@
8986
"defaultConfiguration": "development"
9087
},
9188
"extract-i18n": {
92-
"builder": "@angular-devkit/build-angular:extract-i18n"
89+
"builder": "@angular/build:extract-i18n"
9390
}
9491
}
9592
}

typescript/angular_ng/created/package.json

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,21 @@
99
},
1010
"private": true,
1111
"dependencies": {
12-
"@angular/common": "^19.2.0",
13-
"@angular/compiler": "^19.2.0",
14-
"@angular/core": "^19.2.0",
15-
"@angular/forms": "^19.2.0",
16-
"@angular/platform-browser": "^19.2.0",
17-
"@angular/platform-browser-dynamic": "^19.2.0",
18-
"@angular/router": "^19.2.0",
12+
"@angular/common": "^20.0.0",
13+
"@angular/compiler": "^20.0.0",
14+
"@angular/core": "^20.0.0",
15+
"@angular/forms": "^20.0.0",
16+
"@angular/platform-browser": "^20.0.0",
17+
"@angular/router": "^20.0.0",
1918
"@bokeh/bokehjs": "file:../../../../bokeh-bokehjs-3.8.0-dev.1.tgz",
2019
"rxjs": "~7.8.0",
2120
"tslib": "^2.3.0",
2221
"zone.js": "~0.15.0"
2322
},
2423
"devDependencies": {
25-
"@angular-devkit/build-angular": "^19.2.9",
26-
"@angular/cli": "^19.2.9",
27-
"@angular/compiler-cli": "^19.2.0",
28-
"typescript": "~5.7.2"
24+
"@angular/build": "^20.0.1",
25+
"@angular/cli": "^20.0.1",
26+
"@angular/compiler-cli": "^20.0.0",
27+
"typescript": "~5.8.2"
2928
}
3029
}
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';
1+
import { ApplicationConfig, provideBrowserGlobalErrorListeners, provideZoneChangeDetection } from '@angular/core';
22

33
export const appConfig: ApplicationConfig = {
4-
providers: [provideZoneChangeDetection({ eventCoalescing: true })]
4+
providers: [
5+
provideBrowserGlobalErrorListeners(),
6+
provideZoneChangeDetection({ eventCoalescing: true }),
7+
8+
]
59
};

typescript/angular_ng/created/src/app/app.component.ts renamed to typescript/angular_ng/created/src/app/app.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ import { BokehJSComponent } from './bokeh-js/bokeh-js.component';
88
styles: [],
99
})
1010

11-
export class AppComponent {}
11+
export class App {}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { bootstrapApplication } from '@angular/platform-browser';
22
import { appConfig } from './app/app.config';
3-
import { AppComponent } from './app/app.component';
3+
import { App } from './app/app';
44

5-
bootstrapApplication(AppComponent, appConfig)
5+
bootstrapApplication(App, appConfig)
66
.catch((err) => console.error(err));

typescript/angular_ng/created/tsconfig.app.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
"outDir": "./out-tsc/app",
77
"types": []
88
},
9-
"files": [
10-
"src/main.ts"
11-
],
129
"include": [
13-
"src/**/*.d.ts"
10+
"src/**/*.ts"
11+
],
12+
"exclude": [
13+
"src/**/*.spec.ts"
1414
]
1515
}

typescript/angular_ng/created/tsconfig.json

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,29 @@
33
{
44
"compileOnSave": false,
55
"compilerOptions": {
6-
"outDir": "./dist/out-tsc",
76
"strict": true,
87
"noImplicitOverride": true,
98
"noPropertyAccessFromIndexSignature": true,
109
"noImplicitReturns": true,
1110
"noFallthroughCasesInSwitch": true,
1211
"skipLibCheck": true,
1312
"isolatedModules": true,
14-
"esModuleInterop": true,
1513
"experimentalDecorators": true,
16-
"moduleResolution": "bundler",
1714
"importHelpers": true,
1815
"target": "ES2022",
19-
"module": "ES2022"
16+
"module": "preserve"
2017
},
2118
"angularCompilerOptions": {
2219
"enableI18nLegacyMessageIdFormat": false,
2320
"strictInjectionParameters": true,
2421
"strictInputAccessModifiers": true,
22+
"typeCheckHostBindings": true,
2523
"strictTemplates": true
26-
}
24+
},
25+
"files": [],
26+
"references": [
27+
{
28+
"path": "./tsconfig.app.json"
29+
}
30+
]
2731
}

0 commit comments

Comments
 (0)