fix(richtext-lexical): reliably install exact lexical version by removing it from peerDeps (#11122)

This will hopefully allow pnpm to reliably install the correct lexical version, as lexical is now solely part of our `dependencies`. Currently, pnpm completely disregards lexical version bumps until the user deletes both the lockfile and their `node_modules` folder.

The downside of this is that pnpm will no longer throw a warning if payload is installed in a project with a mismatching lexical version. However, noone read that warning anyways, and our runtime dependency checker is more reliable.
This commit is contained in:
Alessio Gravili
2025-02-11 14:01:33 -07:00
committed by GitHub
parent 44be433d44
commit 2056e9b740
3 changed files with 4 additions and 19 deletions

View File

@@ -19,9 +19,10 @@ export const defaultESLintIgnores = [
'**/build/',
'**/node_modules/',
'**/temp/',
'**/packages/*.spec.ts',
'packages/**/*.spec.ts',
'next-env.d.ts',
'**/app',
'src/**/*.spec.ts',
]
/** @typedef {import('eslint').Linter.Config} Config */
@@ -29,10 +30,7 @@ export const defaultESLintIgnores = [
export const rootParserOptions = {
sourceType: 'module',
ecmaVersion: 'latest',
projectService: {
maximumDefaultProjectFileMatchCount_THIS_WILL_SLOW_DOWN_LINTING: 40,
allowDefaultProject: ['scripts/*.ts', '*.js', '*.mjs', '*.d.ts'],
},
projectService: true,
}
/** @type {Config[]} */

View File

@@ -355,6 +355,7 @@
"@lexical/rich-text": "0.21.0",
"@lexical/selection": "0.21.0",
"@lexical/utils": "0.21.0",
"@lexical/table": "0.21.0",
"@payloadcms/translations": "workspace:*",
"@payloadcms/ui": "workspace:*",
"@types/uuid": "10.0.0",
@@ -395,18 +396,7 @@
"peerDependencies": {
"@faceless-ui/modal": "3.0.0-beta.2",
"@faceless-ui/scroll-info": "2.0.0",
"@lexical/headless": "0.21.0",
"@lexical/html": "0.21.0",
"@lexical/link": "0.21.0",
"@lexical/list": "0.21.0",
"@lexical/mark": "0.21.0",
"@lexical/react": "0.21.0",
"@lexical/rich-text": "0.21.0",
"@lexical/selection": "0.21.0",
"@lexical/table": "0.21.0",
"@lexical/utils": "0.21.0",
"@payloadcms/next": "workspace:*",
"lexical": "0.21.0",
"payload": "workspace:*",
"react": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
"react-dom": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020"

View File

@@ -14,8 +14,5 @@ describe('Lexical dependency checker', () => {
const packageJsonLexicalVersion = packageJson.dependencies['lexical']
expect(packageJsonLexicalVersion).toBe(lexicalTargetVersion)
const packageJsonLexicalPeerDepVersion = packageJson.peerDependencies['lexical']
expect(packageJsonLexicalPeerDepVersion).toBe(lexicalTargetVersion)
})
})