Skip to content

Commit

Permalink
Updated Angular to v17
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianRappl committed Nov 24, 2023
1 parent 2243cd9 commit 07d38da
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 15 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
- Moved `piral-jest-utils` and `piral-ie11polyfills-utils` into a separate repository
- Updated documentation on `piral-ng` (#646)
- Updated dependencies (#641)
- Updated `piral-cli` compatibility with Bun as runtime
- Updated generated code to fully use ES2020
- Added support for Angular 17 in `piral-ng`
- Added `piral-react` as converter for React
- Added possibility to publish emulator as a website (#644)
- Added orchestration engine choices (`systemjs`, `module-federation`) (#643)
Expand Down
31 changes: 30 additions & 1 deletion src/converters/piral-ng/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,36 @@ The basic dependencies look as follows:
}
```

Besides the usual imports, the explicit import of the `@angular/compiler` package may be necessary. TypeScript has to be higher than 4.8 (4.9 or later).
Besides the usual imports, the explicit import of the `@angular/compiler` package may be necessary. TypeScript has to be higher than 4.8 (and pre-5.0).

So include in your app shell as preamble:

```js
import 'core-js/proposals/reflect-metadata';
import '@angular/compiler';
```

### Angular 17

In general, Angular 17 seems to work and is **supported**.

The basic dependencies look as follows:

```json
{
"@angular/common": "^17",
"@angular/compiler": "^17",
"@angular/core": "^17",
"@angular/router": "^17",
"@angular/platform-browser": "^17",
"@angular/platform-browser-dynamic": "^17",
"core-js": "^3.19.0",
"rxjs": "^7.4",
"zone.js": "~0.14.0"
}
```

Besides the usual imports, the explicit import of the `@angular/compiler` package may be necessary. TypeScript has to be higher or equal to 5.2 (and less than 5.3).

So include in your app shell as preamble:

Expand Down
30 changes: 16 additions & 14 deletions src/converters/piral-ng/src/startup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,16 @@ if (process.env.NODE_ENV === 'development') {
// May be used later for something useful. Right now only debugging output.
const versionHandlers = {
legacy() {
console.log('Running in legacy mode (Angular 2, Angular 4)');
console.log('Running in legacy mode (Angular 2-8)');
},
outdated() {
console.log('Running in outdated mode (Angular 5-8)');
console.log('Running in outdated mode (Angular 9-13)');
},
current() {
console.log('Running in current mode (Angular 9-15)');
console.log('Running in current mode (Angular 14-17)');
},
next() {
console.log('Running in next mode (Angular 16)');
console.log('Running in next mode (Angular 18)');
},
unknown() {
console.log('Running with an unknown version of Angular');
Expand All @@ -127,18 +127,20 @@ if (process.env.NODE_ENV === 'development') {
const versions = {
v2: versionHandlers.legacy,
v4: versionHandlers.legacy,
v5: versionHandlers.outdated,
v6: versionHandlers.outdated,
v7: versionHandlers.outdated,
v8: versionHandlers.outdated,
v9: versionHandlers.current,
v10: versionHandlers.current,
v11: versionHandlers.current,
v12: versionHandlers.current,
v13: versionHandlers.current,
v5: versionHandlers.legacy,
v6: versionHandlers.legacy,
v7: versionHandlers.legacy,
v8: versionHandlers.legacy,
v9: versionHandlers.outdated,
v10: versionHandlers.outdated,
v11: versionHandlers.outdated,
v12: versionHandlers.outdated,
v13: versionHandlers.outdated,
v14: versionHandlers.current,
v15: versionHandlers.current,
v16: versionHandlers.next,
v16: versionHandlers.current,
v17: versionHandlers.current,
v18: versionHandlers.next,
};

const handler = getVersionHandler(versions) || versionHandlers.unknown;
Expand Down

0 comments on commit 07d38da

Please sign in to comment.