| name | angular-ts-to-js-migration |
| description | Rules and workflow for migrating Angular TypeScript components to plain ES module JavaScript for the scripts/ bridge layer |
Angular TS → JS Migration Rules
When migrating .ts (Angular) components to .js:
- Remove all Angular imports, decorators (
@Component, @Input), and TypeScript types
- Remove interfaces and type annotations
- Remove all Angular lifecycle interfaces
- For simple fields components extend
FieldBaseComponent if possible and reasonable.
- For Container components extend
ContainerBaseComponent if possible and reasonable.
- For rest of components extend
BaseComponent
ngOnInit → init() with componentsManager.onComponentAdded(this)
ngOnDestroy → destroy() with super.destroy() and componentsManager.onComponentRemoved(this)
- Merge
onStateChange into checkAndUpdate()
updateSelf → #updateSelf() (private); add #sendPropsUpdate() at end
- Add
update(pConn, ...) method for external re-rendering
- Replace
this.pConn$ → this.pConn; remove all as any casts
- Normalize quotes to double quotes
- If there is some external dependency try to look in additional provided ts files and copy its content to migrated js. If nothing is found try to find existing equivalent in js files or create mocked implementation.
- When migrating parts of code prefer copy-paste over code modification.
- Never change logic of migrated components.
- In sdk-pega-component-map.js uncomment migrated component entry in pegaSdkComponentMap and also import line. Fix imported component path.