feat: write dependencies of imported component to workspace.jsonc or package.json#9682
Merged
zkochan merged 17 commits intoteambit:masterfrom Apr 25, 2025
Merged
feat: write dependencies of imported component to workspace.jsonc or package.json#9682zkochan merged 17 commits intoteambit:masterfrom
zkochan merged 17 commits intoteambit:masterfrom
Conversation
Contributor
There was a problem hiding this comment.
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)) {
davidfirst
approved these changes
Apr 24, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed Changes