IgniteUI / igniteui-cli

Ignite UI Command-Line Interface by Infragistics
https://bit.ly/2L19rhp
MIT License
118 stars 4 forks source link

Use ES modules instead of CommonJS as a build target #1295

Open jackofdiamond5 opened 3 months ago

jackofdiamond5 commented 3 months ago

Description

The implementation of ig update - https://github.com/IgniteUI/igniteui-cli/pull/1057 - requires the usage of external code that is written in a separate module, and is possibly/preferably exported in a default async member. This means that we need to be able to dynamically import that module wherever it is supposed to be executed. Similar to what Angular are doing with their schematics.

This would require something like this to be implemented:

const { default: func } = await import('path/to/factory');
await func();

Currently, the CLI is transpiled to CommonJS and the above dynamic import will become a synchronous require call which is incapable of handling an async module without additional code overhead.

So moving to ES modules is a prerequisite for ig update.

There is already a PR that attempts to do this - https://github.com/IgniteUI/igniteui-cli/pull/1059 - but it's been so long that it's really outdated and it's probably best to be abandoned and started from scratch.

We need these changes to update the CLI's packages (Core: chalk & glob) as they are heavily outdated, which is part of this task.

github-actions[bot] commented 1 day ago

There has been no recent activity and this issue has been marked inactive.