-
Notifications
You must be signed in to change notification settings - Fork 946
feat: write dependencies of imported component to workspace.jsonc or package.json #9682
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements a new feature to write workspace component dependencies to either workspace.jsonc or package.json. Key changes include:
- Adding new methods in the workspace to write dependencies to the specified target.
- Updating import and dependency commands to recognize and handle a new writeDeps flag.
- Adjusting dependency resolution and merging logic to support the new dependency-writing feature.
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| scopes/workspace/workspace/workspace.ts | New functions for writing dependencies to workspace.jsonc or package.json have been introduced. |
| scopes/workspace/install/install.main.runtime.ts | Refactored internal calls to use workspace methods for dependency policy retrieval and updated the variant policies update method signature. |
| scopes/workspace/config-merger/config-merger.main.runtime.ts | Updated to use the new semver helper for comparing ranges instead of an internal function. |
| scopes/scope/importer/import.cmd.ts, scopes/scope/importer/import-components.ts | Added support for the new writeDeps flag in component import commands. |
| scopes/pkg/modules/semver-helper/* | Extended semver helper exports with a new helper function for comparing version ranges. |
| scopes/dependencies/* | Expanded dependency resolver types, updated merging logic, and added a new DependenciesWriteCmd command along with accompanying tests and helper changes. |
Comments suppressed due to low confidence (2)
scopes/workspace/install/install.main.runtime.ts:1058
- [nitpick] Consider renaming the parameter 'updateVariantPolicies' to 'updatedVariants' for clarity, as the function internally retrieves the current variant patterns.
private async _updateVariantsPolicies(updateVariantPolicies: string[]) {
scopes/dependencies/dependency-resolver/dependency-resolver.main.runtime.ts:1507
- [nitpick] Consider adding an inline comment here to clarify the merging logic why a dependency with a greater version range (according to a naive comparison) replaces an existing one.
if (isRange1GreaterThanRange2Naively(dep.currentRange, mergedDeps[dep.name].currentRange)) {
Proposed Changes