perf(@angular/cli): lazily initialize package manager in command context#32854
perf(@angular/cli): lazily initialize package manager in command context#32854alan-agius4 wants to merge 1 commit into
Conversation
2d01580 to
94b9bb5
Compare
There was a problem hiding this comment.
Code Review
This pull request refactors the CommandContext to treat the packageManager as a Promise, allowing for lazy initialization. This change requires updating multiple command modules to asynchronously resolve the package manager before use. Furthermore, the SmartDefaultProvider interface and the CoreSchemaRegistry have been updated to support asynchronous providers. Review feedback focuses on improving code readability and performance by avoiding redundant await calls on the packageManager promise in AddCommandModule and gatherVersionInfo.
07795ef to
80f467d
Compare
This change refactors the `CommandContext` to defer the initialization of the `packageManager` instance until it is first accessed. This optimization avoids unnecessary configuration discovery and disk I/O for commands that do not require the package manager, such as `ng help`, and certain shell completions. As part of this refactoring: - The `packageManager` property in `CommandContext` is now a `Promise<PackageManager>`. - Internal command modules and utility functions have been updated to `await` the package manager's lazy initialization. - In `@angular-devkit/core`, `CoreSchemaRegistry` was updated to rename `_sourceMap` to `_sourceProvider` and optimize the resolution of smart defaults by awaiting values during the `_set` operation.
80f467d to
1a165b9
Compare
|
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. |
This change refactors the
CommandContextto defer the initialization of thepackageManagerinstance until it is first accessed. This optimization avoids unnecessary configuration discovery and disk I/O for commands that do not require the package manager, such asng help, and certain shell completions.As part of this refactoring:
packageManagerproperty inCommandContextis now aPromise<PackageManager>.awaitthe package manager's lazy initialization.@angular-devkit/core,CoreSchemaRegistrywas updated to rename_sourceMapto_sourceProviderand optimize the resolution of smart defaults by awaiting values during the_setoperation.