fix(richtext-lexical): dependency checker suggesting incorrect version (#7888)

Fixes this:
https://discord.com/channels/967097582721572934/1278031296970625190/1278031652089757818
This commit is contained in:
Alessio Gravili
2024-08-27 13:17:19 -04:00
committed by GitHub
parent 4cda7d2363
commit f046a04510
2 changed files with 6 additions and 5 deletions

View File

@@ -19,7 +19,8 @@ export type DependencyCheckerArgs = {
* Name of the dependency group to be displayed in the error message
*/
name: string
targetVersionDependency: string
targetVersion?: string
targetVersionDependency?: string
}[]
/**
* Dependency package names keyed to their required versions. Supports >= (greater or equal than version) as a prefix, or no prefix for the exact version
@@ -51,9 +52,9 @@ export async function checkDependencies({
}
}
if (Object.keys(foundVersions).length > 1) {
const targetVersion = resolvedDependencies.resolved.get(
dependencyGroup.targetVersionDependency,
)?.version
const targetVersion =
dependencyGroup.targetVersion ??
resolvedDependencies.resolved.get(dependencyGroup.targetVersionDependency)?.version
if (targetVersion) {
const formattedVersionsWithPackageNameString = Object.entries(foundVersions)
.filter(([version]) => version !== targetVersion)

View File

@@ -62,7 +62,7 @@ export function lexicalEditor(props?: LexicalEditorProps): LexicalRichTextAdapte
'@lexical/selection',
'@lexical/utils',
],
targetVersionDependency: 'lexical',
targetVersion: '0.17.0',
},
],
})