Skip to content
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

Remove hard dependencies on specific react versions in monorepo packages. #6728

Merged
merged 20 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions .github/workflows/cookieplone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,63 @@ jobs:
with:
name: cypress-videos
path: packages/seven/cypress/videos

volto:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
runs-on: ubuntu-latest
name: Volto Cookieplone
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
node-version: [22.x]
steps:
- uses: actions/checkout@v4
- run: echo "Current branch is ${GITHUB_REF#refs/heads/}"
- name: Set up Node.js environment
uses: ./.github/actions/node_env_setup
with:
node-version: ${{ matrix.node-version }}

- name: Generate Cookieplone-based frontend addon
run: |
pipx install cookieplone
pipx run --no-cache cookieplone frontend_addon --no-input

- name: Install generated package
working-directory: volto-add-on
run: |
pnpm dlx mrs-developer missdev --no-config --fetch-https
(cd core && git fetch --depth 1 origin ${GITHUB_REF#refs/heads/}:${GITHUB_REF#refs/heads/} && git checkout ${GITHUB_REF#refs/heads/})
pnpm i

- name: Cypress acceptance tests
uses: cypress-io/github-action@v6
env:
BABEL_ENV: production
CYPRESS_RETRIES: 2
# Recommended: pass the GitHub token lets this action correctly
# determine the unique run id necessary to re-run the checks
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
install: false
working-directory: packages/volto
browser: chrome
spec: cypress/tests/minimal/**/*.js
start: |
make ci-acceptance-backend-start
make cookieplone-acceptance-frontend-prod-start
wait-on: 'pnpm dlx wait-on --httpTimeout 20000 http-get://127.0.0.1:55001/plone http://127.0.0.1:3000'

# Upload Cypress screenshots
- uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-screenshots
path: packages/seven/cypress/screenshots
# Upload Cypress videos
- uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-videos
path: packages/seven/cypress/videos
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,11 @@ deployment-acceptance-web-server-start: ## Start the reverse proxy (Traefik) in
deployment-ci-acceptance-test-run-all: ## With a single command, run the backend, frontend, and the Cypress tests in headless mode for CI for deployment tests
$(MAKE) -C "./packages/volto/" deployment-ci-acceptance-test-run-all

######### Project Acceptance tests
######### Cookieplone / (deprecated) Project Acceptance tests

.PHONY: cookieplone-acceptance-frontend-prod-start
cookieplone-acceptance-frontend-prod-start: ## Start acceptance frontend in production mode for project tests
$(MAKE) -C "./packages/volto/" cookieplone-acceptance-frontend-prod-start

.PHONY: project-acceptance-frontend-prod-start
project-acceptance-frontend-prod-start: ## Start acceptance frontend in production mode for project tests
Expand Down
1 change: 1 addition & 0 deletions packages/blocks/news/6728.internal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update internal `peerDependencies` to include React 19, now for real. @sneridagh
4 changes: 2 additions & 2 deletions packages/blocks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
"release-alpha": "release-it --preRelease=alpha"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
},
"peerDependenciesMeta": {
"react-dom": {
Expand Down
1 change: 1 addition & 0 deletions packages/client/news/6728.internal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove hard dependencies on `react`, use `peerDependencies` instead. @sneridagh
20 changes: 9 additions & 11 deletions packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,26 @@
"publishConfig": {
"access": "public"
},
"dependencies": {
"@tanstack/react-query": "^5.59.0",
"axios": "^1.6.7",
"debug": "4.3.4",
"query-string": "^9.0.0",
"zod": "^3.22.4"
},
"devDependencies": {
"@arethetypeswrong/cli": "^0.16.4",
"@plone/types": "workspace: *",
"@testing-library/jest-dom": "5.16.5",
"@testing-library/react": "13.4.0",
"@types/debug": "^4.1.12",
"@types/react": "18.2.27",
"@types/react-dom": "18.2.12",
"@types/react": "^18",
"@types/react-dom": "^18",
"@types/uuid": "^9.0.2",
"@vitejs/plugin-react": "^4.1.0",
"@vitest/coverage-v8": "^1.3.1",
"glob": "7.1.6",
"jsdom": "^21.1.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"release-it": "17.1.1",
"tsup": "^8.3.5",
"typescript": "^5.7.3",
Expand All @@ -79,13 +84,6 @@
"vitest": "^2.1.3",
"wait-on": "^7.2.0"
},
"dependencies": {
"@tanstack/react-query": "^5.59.0",
"axios": "^1.6.7",
"debug": "4.3.4",
"query-string": "^9.0.0",
"zod": "^3.22.4"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
Expand Down
1 change: 1 addition & 0 deletions packages/components/news/6728.internal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update dependencies versions. @sneridagh
18 changes: 9 additions & 9 deletions packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@
"last 2 versions",
"not dead"
],
"dependencies": {
"@react-aria/utils": "^3.27.0",
"@react-spectrum/utils": "^3.12.1",
"@storybook/test": "^8.5.3",
"clsx": "^2.1.1",
"react-aria-components": "^1.6.0"
},
"devDependencies": {
"@arethetypeswrong/cli": "^0.16.4",
"@plone/types": "workspace: *",
Expand All @@ -99,8 +106,8 @@
"eslint-plugin-storybook": "^0.11.2",
"jest-axe": "^8.0.0",
"jsdom": "^22.1.0",
"lightningcss": "^1.24.0",
"lightningcss-cli": "^1.24.0",
"lightningcss": "^1.29.0",
"lightningcss-cli": "^1.29.1",
"release-it": "17.1.1",
"storybook": "^8.5.3",
"tsup": "^8.3.5",
Expand All @@ -109,13 +116,6 @@
"vitest": "^2.1.3",
"vitest-axe": "^0.1.0"
},
"dependencies": {
"@react-aria/utils": "^3.26.0",
"@react-spectrum/utils": "^3.12.0",
"@storybook/test": "^8.5.3",
"clsx": "^2.1.1",
"react-aria-components": "^1.5.0"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
Expand Down
1 change: 1 addition & 0 deletions packages/providers/news/6728.internal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove no longer required dependencies. @sneridagh
3 changes: 1 addition & 2 deletions packages/providers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,9 @@
},
"dependencies": {
"@plone/client": "workspace:*",
"@plone/components": "workspace:*",
"@plone/registry": "workspace:*",
"@tanstack/react-query": "^5.59.0",
"react-aria-components": "^1.5.0"
"react-aria-components": "^1.6.0"
},
"devDependencies": {
"@arethetypeswrong/cli": "^0.16.4",
Expand Down
1 change: 1 addition & 0 deletions packages/registry/news/6728.internal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove `react` as a hard dependency, use `peerDependencies` instead. @sneridagh
3 changes: 1 addition & 2 deletions packages/registry/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
"build": "tsup",
"build:force": "rm -rf dist && tsup",
"check:exports": "attw --pack .",
"check-ts": "tsc --project tsconfig.json",
"test": "vitest",
"test:debug": "vitest --inspect-brk --no-file-parallelism registry",
"dry-release": "release-it --dry-run",
Expand Down Expand Up @@ -105,8 +106,6 @@
"@types/react": "^18",
"@types/react-dom": "^18",
"@types/tmp": "^0.2.6",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"release-it": "16.2.1",
"tsconfig": "workspace:*",
"tsup": "^8.3.5",
Expand Down
1 change: 1 addition & 0 deletions packages/seven/news/6728.internal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Back to use `react` 18 for now, due to the incompatibilities with Volto `react` @sneridagh
8 changes: 4 additions & 4 deletions packages/seven/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@
"@react-router/node": "^7.1.5",
"@react-router/serve": "^7.1.5",
"isbot": "^5.1.17",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router": "^7.1.5"
},
"devDependencies": {
"@plone/types": "workspace:*",
"@react-router/dev": "^7.1.5",
"@testing-library/cypress": "10.0.2",
"@types/node": "^20",
"@types/react": "^19.0.8",
"@types/react-dom": "^18.0.3",
"@types/react": "^18",
"@types/react-dom": "^18",
"cypress": "^13.13.2",
"react-router-devtools": "^1.1.0",
"typescript": "^5.7.3",
Expand Down
1 change: 1 addition & 0 deletions packages/types/news/6728.internal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove hard dependencies on react-intl and history in @plone/types @sneridagh
8 changes: 1 addition & 7 deletions packages/types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,8 @@
"release-alpha": "release-it --preRelease=alpha"
},
"peerDependencies": {
"history": "^5.3.0",
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react-intl": "3.12.1"
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
},
"peerDependenciesMeta": {
"react-dom": {
Expand All @@ -50,10 +48,6 @@
"devDependencies": {
"@types/react": "^18",
"@types/react-dom": "^18",
"history": "^5.3.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-intl": "3.12.1",
"release-it": "^17.1.1",
"tsconfig": "workspace:*",
"typescript": "^5.7.3"
Expand Down
4 changes: 2 additions & 2 deletions packages/types/src/blocks/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import type {
BlockExtension,
BlocksConfigData,
} from '../config/Blocks';
import type { IntlShape } from 'react-intl';
import type { Location, History } from 'history';
import type { IntlShape } from '../i18n';
import type { Location, History } from '../router';

export interface BlocksFormData {
'@type': AvailableBlocks;
Expand Down
2 changes: 1 addition & 1 deletion packages/types/src/config/Blocks.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Content } from '../content';
import type { BlockViewProps, BlockEditProps } from '../blocks';
import type { IntlShape } from 'react-intl';
import type { IntlShape } from '../i18n';
import { User } from '../services';
import { StyleDefinition } from '../blocks';

Expand Down
2 changes: 1 addition & 1 deletion packages/types/src/config/Slots.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Location } from 'history';
import { Location } from '../router';
import type { Content } from '../content';

export type SlotPredicate = (args: any) => boolean;
Expand Down
44 changes: 44 additions & 0 deletions packages/types/src/i18n.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// `react-intl` shape-like types

export declare interface MessageDescriptor {
id?: string | number;
description?: string | object;
defaultMessage?: string;
}

export declare type PrimitiveType =
| string
| number
| boolean
| null
| undefined
| Date;

export declare type FormatXMLElementFn = (...args: any[]) => string | object;

export declare interface IntlConfig {
locale: string;
timeZone?: string;
formats: unknown;
textComponent?: React.ComponentType | keyof React.ReactHTML;
messages: Record<string, string>;
defaultLocale: string;
defaultFormats: unknown;
onError(err: string): void;
}

export declare interface IntlFormatters {
formatMessage(
descriptor: MessageDescriptor,
values?: Record<string, PrimitiveType>,
): string;
formatMessage(
descriptor: MessageDescriptor,
values?: Record<
string,
PrimitiveType | React.ReactElement | FormatXMLElementFn
>,
): string | React.ReactNodeArray;
}

export declare interface IntlShape extends IntlConfig, IntlFormatters {}
Loading