<aside> ⚠️ The guide is written to upgrade:
Starting from earlier versions might work, but it’s not guaranteed (it will probably need extra work). Note: there is an older guide to upgrade to Angular v15 from even older versions.
</aside>
<aside> 🎏 References:
<aside> 🆚 Before to start, make sure your developer tools are updated to the versions stated in our Development basics guide.
</aside>
<aside> ✅ Except for guards (see below), there are no major changes to operate in our (typical) codebase while updating Angular from 15 to 16, Ionic from 6 to 7 and Capacitor from 4 to 5.
</aside>
Locate the front-end
folder.
In the package.json
file remove any @idea-ionic/xxx
package. Then, run npm i
.
Run ng update --allow-dirty @angular/core@16 @angular/cli@16
which should bring you to version 16 of Angular.
<aside>
🤖 If the operation throws errors on incompatible packages, remove them temporarily from the package.json
You will re-add them after the update to Angular 16 is completed.
</aside>
Remove the package-lock.json
file and the node_modules
folder.
In the package.json
file, refer to to the following versions for dependencies
and devDependencies
and manually fix the packages versions so that all of IDEA’s projects are aligned to the very same state. Note: you don’t have to add packages that your codebase don’t need; also: there could be some packages missing from the list.
package.json
of cloud-app-starter project (front-end).Substitute the following files’ content:
tsconfig.json
. Note: if you use custom paths, feel free to preserve them.src/polyfills.ts
.Run a npm i
to reinstall everything from a clean state.
If the app is deployed on either iOS or Android, upgrade Capacitor to v5 by running npx cap migrate
; no manual changes should be necessary, but in case of issues refer to the official guide linked at the top of this manual.
<aside> 💬 In case of weird warnings/errors out of the scope of the official guide, contact @Matteo Carbone.
</aside>
From the front-end
folder, run npm i PACKAGE@latest
, for each of the following packages:
<aside> ⚠️ When updating these libraries, check the release notes from the previous version to make according changes. For IDEA Ionic Extra, also remember to update the i18n dictionaries.
</aside>
idea-toolbox
.@idea-ionic/xxx
and other packages removed in the first steps.@capacitor-community/…
plugins.From the front-end
folder, remove again the package-lock.json
file and node_modules
folder. Then run npm i
: at this point, it shouldn’t throw any errors or vulnerability.
Angular deprecated the guards classes (e.g. auth.guard
, init.guard
), which have now to be rewritten as functions; the change is not complicated: here’s an example from cloud-app-starter.
init.guard
auth.guard
app-routing.module
Adapt the source code to Ionic’s latest changes, by following the official Migration Guide;