refactor(migrations): simplify integration of tsurge migrations into the CLI#60386
refactor(migrations): simplify integration of tsurge migrations into the CLI#60386crisbeto wants to merge 1 commit intoangular:mainfrom
Conversation
…the CLI Currently when we reuse a Tsurge migration is reused externally, there's some glue code that needs to be executed in a specific order. The code gets copied between the different migrations which is error-prone and means that bugs may have to be fixed several times. These changes move the common steps out into a separate function so that only the migration-specific logic (mostly instantiation and logging) is left in the schematic.
devversion
left a comment
There was a problem hiding this comment.
LGTM. thanks for proactively helping with this!
| getMigration: () => new UnusedImportsMigration(), | ||
| tree, | ||
| beforeProgramCreation: (tsconfigPath) => { | ||
| context.logger.info(`Preparing analysis for ${tsconfigPath}`); |
There was a problem hiding this comment.
Should this be potentially a default log?
There was a problem hiding this comment.
I was debating whether to have default logs, but I went with this approach because some migrations should be silent (e.g. InjectFlags).
| replacements = []; | ||
|
|
||
| for (const {info} of programInfos) { | ||
| const result = await migration.migrate(globalMeta, info); |
There was a problem hiding this comment.
In the future we could probably parallelize that.
|
This PR was merged into the repository by commit c147a0d. The changes were merged into the following branches: main |
…the CLI (angular#60386) Currently when we reuse a Tsurge migration is reused externally, there's some glue code that needs to be executed in a specific order. The code gets copied between the different migrations which is error-prone and means that bugs may have to be fixed several times. These changes move the common steps out into a separate function so that only the migration-specific logic (mostly instantiation and logging) is left in the schematic. PR Close angular#60386
…the CLI (#60386) (#60776) Currently when we reuse a Tsurge migration is reused externally, there's some glue code that needs to be executed in a specific order. The code gets copied between the different migrations which is error-prone and means that bugs may have to be fixed several times. These changes move the common steps out into a separate function so that only the migration-specific logic (mostly instantiation and logging) is left in the schematic. PR Close #60386 PR Close #60776
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Currently when we reuse a Tsurge migration is reused externally, there's some glue code that needs to be executed in a specific order. The code gets copied between the different migrations which is error-prone and means that bugs may have to be fixed several times.
These changes move the common steps out into a separate function so that only the migration-specific logic (mostly instantiation and logging) is left in the schematic.