Skip to content

Commit d5f65f9

Browse files
fix(sdk): Fix build on sdk-experiments (dotCMS#31427)
https://github.com/user-attachments/assets/8a1766ad-add6-41fb-b0a0-6809a0709152 This pull request includes several changes to update dependencies, refactor imports, and clean up the TypeScript configuration. The most important changes are listed below: Dependency updates: * [`core-web/libs/sdk/experiments/package.json`](diffhunk://#diff-68dca14af128d4f3c11f3f15f20268f9e50d5f3d8886b00845a16344aacfae35L28-R29): Updated `@dotcms/client` and added `@dotcms/react` to use the `next` version. Refactoring imports: * [`core-web/libs/sdk/react/src/lib/next/hooks/useIsDevMode.ts`](diffhunk://#diff-793e5a8e4779776f9af6518bb4c05a75267059db2aa82f5acac2cc28c1caa4ddL3-R7): Reorganized imports to ensure `DotCMSPageRendererMode` and `DotCMSPageContext` are imported from the correct local context file. * [`core-web/libs/sdk/react/src/lib/next/utils/index.ts`](diffhunk://#diff-3d9ca80fd74cf5ec1dc58260167bc521739f8b5a09e4073322a7fe2e935f924aL6-R6): Simplified import path for `DotCMSContentlet`, `DotCMSColumnContainer`, and `DotCMSPageAsset` to use a relative path. TypeScript configuration cleanup: * [`core-web/tsconfig.base.json`](diffhunk://#diff-a96484261b73ba1eb1e119e1aa36e6be97f219d53cdbdbf3fc718cf11bfa98ebL61): Removed the path mapping for `@dotcms/react/next/*` to streamline the configuration. --------- Co-authored-by: Kevin Davila <[email protected]>
1 parent 3c56c1e commit d5f65f9

File tree

13 files changed

+33
-43
lines changed

13 files changed

+33
-43
lines changed

core-web/libs/sdk/experiments/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"peerDependencies": {
2626
"react": ">=18",
2727
"react-dom": ">=18",
28-
"@dotcms/client": "0.0.1-alpha.38"
28+
"@dotcms/client": "next",
29+
"@dotcms/react": "next"
2930
}
3031
}

core-web/libs/sdk/react/src/lib/next/__test__/components/Column.test.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@ import '@testing-library/jest-dom';
22

33
import { render, screen } from '@testing-library/react';
44

5-
import { Column } from '@dotcms/react/next/components/Column/Column';
6-
5+
import { Column } from '../../components/Column/Column';
76
import { MOCK_COLUMN } from '../mock';
87

9-
jest.mock('@dotcms/react/next/components/Container/Container', () => ({
8+
jest.mock('../../components/Container/Container', () => ({
109
Container: ({ container }: any) => (
1110
<div data-testid="mock-container" data-container-id={container.identifier}>
1211
Mock Container

core-web/libs/sdk/react/src/lib/next/__test__/components/Container.test.tsx

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,17 @@
11
import { render, screen } from '@testing-library/react';
22

3-
import { Container } from '@dotcms/react/next/components/Container/Container';
4-
import {
5-
DotCMSPageContext,
6-
DotCMSPageContextProps
7-
} from '@dotcms/react/next/contexts/DotCMSPageContext';
8-
import * as utils from '@dotcms/react/next/utils';
9-
3+
import { Container } from '../../components/Container/Container';
4+
import { DotCMSPageContext, DotCMSPageContextProps } from '../../contexts/DotCMSPageContext';
5+
import * as utils from '../../utils';
106
import { EMPTY_PAGE_ASSET, MOCK_CONTAINER, MOCK_PAGE_ASSET, MOCK_CONTAINER_DATA } from '../mock';
117

12-
jest.mock('@dotcms/react/next/components/Contentlet/Contentlet', () => ({
8+
jest.mock('../../components/Contentlet/Contentlet', () => ({
139
Contentlet: ({ contentlet }: { contentlet: any }) => (
1410
<div data-testid="mock-contentlet">{contentlet.identifier}</div>
1511
)
1612
}));
1713

18-
jest.mock('@dotcms/react/next/utils', () => ({
14+
jest.mock('../../utils', () => ({
1915
getContainersData: jest.fn(),
2016
getDotContainerAttributes: jest.fn(),
2117
getContentletsInContainer: jest.fn()

core-web/libs/sdk/react/src/lib/next/__test__/components/Contentlet.test.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@ import '@testing-library/jest-dom';
22

33
import { render, screen } from '@testing-library/react';
44

5-
import { Contentlet } from '@dotcms/react/next/components/Contentlet/Contentlet';
6-
import { DotCMSPageContext } from '@dotcms/react/next/contexts/DotCMSPageContext';
7-
import { useCheckVisibleContent } from '@dotcms/react/next/hooks/useCheckVisibleContent';
8-
import { getDotContentletAttributes } from '@dotcms/react/next/utils';
5+
import { Contentlet } from '../../components/Contentlet/Contentlet';
6+
import { DotCMSPageContext } from '../../contexts/DotCMSPageContext';
7+
import { useCheckVisibleContent } from '../../hooks/useCheckVisibleContent';
8+
import { getDotContentletAttributes } from '../../utils';
99

10-
jest.mock('@dotcms/react/next/components/FallbackComponent/FallbackComponent', () => ({
10+
jest.mock('../../components/FallbackComponent/FallbackComponent', () => ({
1111
FallbackComponent: ({ contentlet }: any) => (
1212
<div data-testid="fallback">Fallback Component: {contentlet.contentType}</div>
1313
),
1414
NoComponentType: () => <div>No Component</div>
1515
}));
1616

17-
jest.mock('@dotcms/react/next/hooks/useCheckVisibleContent', () => ({
17+
jest.mock('../../hooks/useCheckVisibleContent', () => ({
1818
useCheckVisibleContent: jest.fn(() => false)
1919
}));
2020

21-
jest.mock('@dotcms/react/next/utils', () => ({
21+
jest.mock('../../utils', () => ({
2222
getDotContentletAttributes: jest.fn(() => ({ 'data-custom': 'true' }))
2323
}));
2424

core-web/libs/sdk/react/src/lib/next/__test__/components/DotCMSLayoutBody.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ import '@testing-library/jest-dom';
22

33
import { render, screen } from '@testing-library/react';
44

5-
import { DotCMSLayoutBody } from '@dotcms/react/next/components/DotCMSLayoutBody/DotCMSLayoutBody';
65
import * as dotcmsUVE from '@dotcms/uve';
76
import { UVE_MODE } from '@dotcms/uve/types';
87

8+
import { DotCMSLayoutBody } from '../../components/DotCMSLayoutBody/DotCMSLayoutBody';
99
import { MOCK_PAGE_ASSET } from '../mock';
1010

11-
jest.mock('@dotcms/react/next/components/Row/Row', () => ({
11+
jest.mock('../../components/Row/Row', () => ({
1212
Row: ({ row }: { row: any }) => <div data-testid="row">Mocked Row - {row.content}</div>
1313
}));
1414

core-web/libs/sdk/react/src/lib/next/__test__/components/FallbackComponent.test.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ import '@testing-library/jest-dom';
33
import { render, screen } from '@testing-library/react';
44
import React from 'react';
55

6-
import { FallbackComponent } from '@dotcms/react/next/components/FallbackComponent/FallbackComponent';
7-
import * as useIsDevModeHook from '@dotcms/react/next/hooks/useIsDevMode';
8-
import { DotCMSContentlet } from '@dotcms/react/next/types';
6+
import { FallbackComponent } from '../../components/FallbackComponent/FallbackComponent';
7+
import * as useIsDevModeHook from '../../hooks/useIsDevMode';
8+
import { DotCMSContentlet } from '../../types';
99

10-
jest.mock('@dotcms/react/next/hooks/useIsDevMode', () => ({
10+
jest.mock('../../hooks/useIsDevMode', () => ({
1111
useIsDevMode: jest.fn()
1212
}));
1313

core-web/libs/sdk/react/src/lib/next/__test__/components/Row.test.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import '@testing-library/jest-dom';
22
import { render, screen } from '@testing-library/react';
33

4-
import { Row } from '@dotcms/react/next/components/Row/Row';
5-
import { DotPageAssetLayoutRow } from '@dotcms/react/next/types';
6-
4+
import { Row } from '../../components/Row/Row';
5+
import { DotPageAssetLayoutRow } from '../../types';
76
import { MOCK_COLUMN } from '../mock';
87

98
const MOCK_ROW: DotPageAssetLayoutRow = {
@@ -12,7 +11,7 @@ const MOCK_ROW: DotPageAssetLayoutRow = {
1211
columns: [MOCK_COLUMN]
1312
};
1413

15-
jest.mock('@dotcms/react/next/components/Column/Column', () => ({
14+
jest.mock('../../components/Column/Column', () => ({
1615
Column: ({ column }: any) => <div data-testid="mock-column">{column?.width}</div>
1716
}));
1817

core-web/libs/sdk/react/src/lib/next/__test__/hook/useCheckVisibleContent.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { render, screen, waitFor } from '@testing-library/react';
22
import { useRef } from 'react';
33

4-
import { useCheckVisibleContent } from '@dotcms/react/next/hooks/useCheckVisibleContent';
4+
import { useCheckVisibleContent } from '../../hooks/useCheckVisibleContent';
55

66
const MOCK_DOM_RECT = {
77
height: 0,

core-web/libs/sdk/react/src/lib/next/__test__/hook/useIsDevMode.test.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import { renderHook } from '@testing-library/react';
22

3-
import {
4-
DotCMSPageContext,
5-
DotCMSPageRendererMode
6-
} from '@dotcms/react/next/contexts/DotCMSPageContext';
7-
import { useIsDevMode } from '@dotcms/react/next/hooks/useIsDevMode';
83
import { getUVEState } from '@dotcms/uve';
94
import { UVE_MODE } from '@dotcms/uve/types';
105

6+
import { DotCMSPageContext, DotCMSPageRendererMode } from '../../contexts/DotCMSPageContext';
7+
import { useIsDevMode } from '../../hooks/useIsDevMode';
8+
119
const Wrapper = ({ children, mode = 'production' }: any) => {
1210
return (
1311
<DotCMSPageContext.Provider value={{ mode, pageAsset: {} as any, userComponents: {} }}>

core-web/libs/sdk/react/src/lib/next/__test__/utils.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
getContainersData,
66
getContentletsInContainer,
77
getDotContainerAttributes
8-
} from '@dotcms/react/next/utils';
8+
} from '../utils';
99

1010
describe('utils', () => {
1111
describe('combineClasses', () => {

0 commit comments

Comments
 (0)