|
| 1 | +# Migration guide |
| 2 | + |
| 3 | +## Angular 12 to Angular 13 |
| 4 | + |
| 5 | +Use `angular-plotly.js` 5.x with Angular 13. In particular, version |
| 6 | +`5.0.0` is the release that added Angular 13 support. |
| 7 | + |
| 8 | +`angular-plotly.js` 2.0.0 targets Angular 9 and declares the following peer |
| 9 | +dependency: |
| 10 | + |
| 11 | +```text |
| 12 | +@angular/core: ^9.0.0 |
| 13 | +``` |
| 14 | + |
| 15 | +That is why Angular CLI stops with an incompatible peer dependency when it |
| 16 | +tries to update an application using `angular-plotly.js` 2.0.0 to Angular 13. |
| 17 | +The `--force` option only suppresses the warning; it does not make the old |
| 18 | +package compatible. |
| 19 | + |
| 20 | +### Recommended order |
| 21 | + |
| 22 | +1. Remove the incompatible package temporarily: |
| 23 | + |
| 24 | + ```bash |
| 25 | + npm uninstall angular-plotly.js |
| 26 | + ``` |
| 27 | + |
| 28 | +2. Update the application and Angular CLI to Angular 13: |
| 29 | + |
| 30 | + ```bash |
| 31 | + ng update @angular/core@13 @angular/cli@13 |
| 32 | + ``` |
| 33 | + |
| 34 | +3. Install the Angular 13-compatible Plotly package: |
| 35 | + |
| 36 | + ```bash |
| 37 | + npm install angular-plotly.js@5.0.0 |
| 38 | + ``` |
| 39 | + |
| 40 | + If the application uses the minified Plotly bundle, keep its existing |
| 41 | + `plotly.js-dist-min` and `@types/plotly.js-dist-min` dependencies. |
| 42 | + |
| 43 | +4. Reinstall dependencies if the update left a stale lockfile or |
| 44 | + `node_modules` tree, then build and test the application: |
| 45 | + |
| 46 | + ```bash |
| 47 | + npm install |
| 48 | + ng build |
| 49 | + ng test --watch=false |
| 50 | + ``` |
| 51 | + |
| 52 | +### Compatibility reference |
| 53 | + |
| 54 | +| `angular-plotly.js` | Angular | Notes | |
| 55 | +| --- | --- | --- | |
| 56 | +| `2.x` | 9 | Not compatible with Angular 13 | |
| 57 | +| `3.x` | 10 | Angular 10 library-format release | |
| 58 | +| `5.x` | 13 | Use this line for Angular 13 | |
| 59 | +| `6.x` | 16 | Angular 16 release | |
| 60 | + |
| 61 | +The package version does not increase for every Angular major. Check the |
| 62 | +package peer dependencies before upgrading across an Angular major, and use |
| 63 | +the package line that declares support for the Angular version in the |
| 64 | +application. |
| 65 | + |
| 66 | +### Angular 13 follow-up notes |
| 67 | + |
| 68 | +Version 5.0.0 migrated the library to the Ivy engine and removed Protractor |
| 69 | +and Codelyzer from the library development setup. Review application code and |
| 70 | +CI configuration for those Angular ecosystem changes as part of the Angular |
| 71 | +13 migration. The Plotly component API is otherwise unchanged in the release |
| 72 | +notes for 5.0.0. |
0 commit comments