-
Notifications
You must be signed in to change notification settings - Fork 161
Architecture and Tricks for Migrations & Schematics
With IVY introduced by angular, all angular packages became ESModules, except angular schematics, which is a CommonJS one. In our Ignite UI angular schematics we need to call some of the other angular modules like @angular/compiler and dynamic import()
is needed. But this is compiled to require()
instead of preserved as a dynamic module, because of the CommonJS nature of the schematics. Our solution, in that case, is to introduce a util function in a .js
file instead of .ts
, which contains the native dynamic import()
, therefore being a .js
after a compilation the import is preserved: https://github.com/IgniteUI/igniteui-angular/pull/10043/files#diff-be445e23dd0ce197a4f388f80338f15ed89c9d55e3492950a12447dd6fbcd68d
Here are the builds for the schematics and migrations, using TypeScript compiler (tsc):
"build:migrations": "gulp copyMigrations && tsc --listEmittedFiles --project ./projects/igniteui-angular/migrations/tsconfig.json",
"build:schematics": "gulp copySchematics && tsc --listEmittedFiles --project ./projects/igniteui-angular/schematics/tsconfig.json"
The first problem in Tips & Tricks section (Add skipLibCheck on compile for schematics & migrations) was diagnosed using --explainFiles. You can do that by adding the flag during the compile:
tsc --explainFiles --listEmittedFiles --project ./projects/igniteui-angular/schematics/tsconfig.json"
Below you can find some well-described migrations' & schematics' issues that define some concepts and some more advanced cases.
Here are all migrations & schematics issues.
https://github.com/IgniteUI/igniteui-angular/pull/13883
https://github.com/IgniteUI/igniteui-angular/pull/13712
https://github.com/IgniteUI/igniteui-angular/issues/13668