-
Notifications
You must be signed in to change notification settings - Fork 953
fix(install): clear error when a component depends on an unpublished update-dependent #10427
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
Merged
+196
−13
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
b972ea2
fix(install): clear error when a component depends on an unpublished …
davidfirst 16b5328
fix(install): refetch unbuilt update-dependents before failing; use s…
davidfirst 7d5916c
fix(install): treat Skipped build status as built for update-dependen…
davidfirst 7a54a97
Merge branch 'master' into fix-install-unpublished-update-dependent
davidfirst 8b4c264
fix(install): enrich the unpublished-dependency error only on package…
davidfirst 704078f
docs(install): correct rationale comment for matching the package-man…
davidfirst dff5520
fix(install): don't assert 'update-dependent' in the unpublished-snap…
davidfirst b85689b
Merge branch 'master' into fix-install-unpublished-update-dependent
davidfirst 8949353
fix(install): only enrich the package-manager error when it's ERR_PNP…
davidfirst d768cb1
Merge branch 'master' into fix-install-unpublished-update-dependent
davidfirst 43a837a
Merge branch 'master' into fix-install-unpublished-update-dependent
davidfirst f16463d
refactor(install): generalize unpublished-snap-dependency install error
davidfirst 7157c75
test(e2e): scope verdaccio registry to workspace config (#10435)
davidfirst cf0add9
bump teambit version to 1.13.230 [skip ci]
0d90fea
fix(diff): avoid phantom peer-dependency change for component-level p…
davidfirst 8a217c7
bump teambit version to 1.13.231 [skip ci]
fe8470e
refactor(install): simplify unpublished-snap culprit matching
davidfirst 8c35cce
Merge remote-tracking branch 'origin/master' into fix-install-unpubli…
davidfirst d11f297
Merge branch 'master' into fix-install-unpublished-update-dependent
davidfirst 09fe14d
Merge branch 'master' into fix-install-unpublished-update-dependent
davidfirst File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,3 @@ | ||
| export { DependencyTypeNotSupportedInPolicy } from './dependency-type-not-supported-in-policy'; | ||
| export { UnpublishedComponentDependency } from './unpublished-component-dependency'; | ||
| export type { UnpublishedSnapDependency } from './unpublished-component-dependency'; |
43 changes: 43 additions & 0 deletions
43
scopes/workspace/install/exceptions/unpublished-component-dependency.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| import { BitError } from '@teambit/bit-error'; | ||
| import { errorSymbol, formatItem } from '@teambit/cli'; | ||
|
|
||
| export type UnpublishedSnapDependency = { | ||
| /** the depended-on component id (without version) */ | ||
| id: string; | ||
| /** the snap version (hash) that has no published package */ | ||
| version: string; | ||
| /** workspace component ids that depend on it */ | ||
| dependents: string[]; | ||
| }; | ||
|
|
||
| /** | ||
| * thrown during `bit install` when a checked-out workspace component depends on another component that | ||
| * isn't checked out and is pinned to a snap that was never published to the registry, so the package | ||
| * manager can't find it. the usual cause is a build that failed or hasn't completed yet (e.g. a hidden | ||
| * lane "update-dependent" re-snapped by "snap updates"), but the message stays generic on purpose since | ||
| * the snap may no longer be tracked as an update-dependent (e.g. after the lane was forked). | ||
| */ | ||
| export class UnpublishedComponentDependency extends BitError { | ||
| constructor(readonly unpublished: UnpublishedSnapDependency[]) { | ||
| super(UnpublishedComponentDependency.formatMessage(unpublished)); | ||
| } | ||
|
|
||
| private static formatMessage(unpublished: UnpublishedSnapDependency[]): string { | ||
| const list = unpublished | ||
| .map(({ id, version, dependents }) => { | ||
| const shortVersion = version.substring(0, 9); | ||
| const requiredBy = dependents.join(', '); | ||
| return formatItem(`${id} (${shortVersion}) required by: ${requiredBy}`, errorSymbol); | ||
| }) | ||
| .join('\n'); | ||
| const importCommand = `bit import ${unpublished.map(({ id }) => id).join(' ')}`; | ||
| return `unable to install the following component(s) — they're not checked out in your workspace and are pinned to a snap that was never published to the registry, so there's no package to fetch and no source to link: | ||
|
|
||
| ${list} | ||
|
|
||
| this usually means the component's build failed or hasn't completed yet. | ||
| to resolve, import it into your workspace so it's linked from source instead of fetched from the registry: | ||
|
|
||
| ${importCommand}`; | ||
| } | ||
| } |
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
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.
Uh oh!
There was an error while loading. Please reload this page.