Skip to content

Commit

Permalink
feat(sdk): fix SDK React secondary entry points (#31463)
Browse files Browse the repository at this point in the history
This pull request includes various updates to the SDK packages in the
`core-web/libs` directory, focusing on version upgrades and
configuration improvements.

Version upgrades:

*
[`core-web/libs/sdk/client/package.json`](diffhunk://#diff-4f1784b477ccd6aca3def2a0c9d331bafde1a18e91a1e4e0b3417bb5f28605a5L3-R3):
Updated the version from `0.0.1-alpha.38` to `0.0.1-beta.2`.
*
[`core-web/libs/sdk/experiments/package.json`](diffhunk://#diff-68dca14af128d4f3c11f3f15f20268f9e50d5f3d8886b00845a16344aacfae35L3-R3):
Updated the version from `0.0.1-alpha.38` to `0.0.1-beta.2`.
*
[`core-web/libs/sdk/react/package.json`](diffhunk://#diff-0e57f36b05f8bf64758e7a7c7f599a2b2ce1e20a9bff3de098a5675fd3ccb4d2L3-R3):
Updated the version from `0.0.1-alpha.38` to `0.0.1-beta-2`.
*
[`core-web/libs/sdk/uve/package.json`](diffhunk://#diff-abbd1dac0ab6355dab11ca2760e9b5dca160b15dedf00d22f2ebe9d63bc6389bL3-R3):
Updated the version from `0.0.1` to `0.0.1-beta.2`.

Configuration improvements:

*
[`core-web/libs/sdk/experiments/tsconfig.json`](diffhunk://#diff-073a1f55392ec371d8bf1970e0e498fb8642e940505ebf4f39a67410accb875dL8-R11):
Added `target`, `module`, and `moduleResolution` options to the
TypeScript configuration.
*
[`core-web/libs/sdk/react/package.json`](diffhunk://#diff-0e57f36b05f8bf64758e7a7c7f599a2b2ce1e20a9bff3de098a5675fd3ccb4d2L30-R35):
Added an `exports` field to specify entry points for the package.
*
[`core-web/libs/sdk/react/project.json`](diffhunk://#diff-7d9813e75d2eb001605855207c4c396bea3ecec81bde3e537f8fedb0d11b9382R19-L28):
Updated the Rollup configuration to include `main`,
`additionalEntryPoints`, and `generateExportsField` options.
*
[`core-web/libs/sdk/react/tsconfig.json`](diffhunk://#diff-cd05da2fb4ed1ee7a0f6982e9ed9703a86433722429a4a2bf99c1dc4a7a588feL10-R10):
Updated the `include` field to encompass various file types.
*
[`core-web/libs/sdk/react/tsconfig.lib.json`](diffhunk://#diff-f3a46b5f7fe8c57d738665f2c96e1630fe240c76e78dc314d91aef096fb5aa48L22-R29):
Expanded the `include` field to cover additional directories and file
types.

### Video


https://github.com/user-attachments/assets/07a02fa5-ce2c-425d-832e-731e62d09f99


## Nx and TypeScript docs References

- [Define Secondary Entry Points for TypeScript
Packages](https://nx.dev/recipes/tips-n-tricks/define-secondary-entrypoints#define-secondary-entry-points-for-typescript-packages).
- [Module Resolution -
moduleResolution](https://www.typescriptlang.org/tsconfig/#moduleResolution)
- [typesVersion
doc](https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html#version-selection-with-typesversions:~:text=its%20declaration%20files.-,Version%20selection%20with,typesVersions,-When%20TypeScript%20opens)

---------

Co-authored-by: Kevin Davila <[email protected]>
  • Loading branch information
rjvelazco and kevindaviladev authored Feb 26, 2025
1 parent 1eb35bd commit 4fa1761
Show file tree
Hide file tree
Showing 12 changed files with 50 additions and 22 deletions.
2 changes: 1 addition & 1 deletion core-web/libs/sdk/client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dotcms/client",
"version": "0.0.1-alpha.38",
"version": "0.0.1-beta.2",
"description": "Official JavaScript library for interacting with DotCMS REST APIs.",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion core-web/libs/sdk/experiments/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dotcms/experiments",
"version": "0.0.1-alpha.38",
"version": "0.0.1-beta.2",
"description": "Official JavaScript library to use Experiments with DotCMS.",
"repository": {
"type": "git",
Expand Down
3 changes: 2 additions & 1 deletion core-web/libs/sdk/experiments/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"allowJs": false,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"strict": true
"strict": true,
"moduleResolution": "bundler"
},
"files": [],
"include": ["src"],
Expand Down
13 changes: 12 additions & 1 deletion core-web/libs/sdk/react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dotcms/react",
"version": "0.0.1-alpha.38",
"version": "0.0.1-beta-2",
"peerDependencies": {
"react": ">=18",
"react-dom": ">=18",
Expand All @@ -22,6 +22,17 @@
"React",
"Components"
],
"exports": {
"./package.json": "./package.json",
".": "./src/index.ts",
"./next": "./src/next.ts"
},
"typesVersions": {
"*": {
".": ["./src/index.d.ts"],
"next": ["./src/next.d.ts"]
}
},
"author": "dotcms <[email protected]>",
"license": "MIT",
"bugs": {
Expand Down
6 changes: 4 additions & 2 deletions core-web/libs/sdk/react/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,18 @@
"executor": "@nx/rollup:rollup",
"outputs": ["{options.outputPath}"],
"options": {
"main": "libs/sdk/react/src/index.ts",
"additionalEntryPoints": ["libs/sdk/react/src/next.ts"],
"generateExportsField": true,
"outputPath": "dist/libs/sdk/react",
"tsConfig": "libs/sdk/react/tsconfig.lib.json",
"project": "libs/sdk/react/package.json",
"entryFile": "libs/sdk/react/src/index.ts",
"additionalEntryPoints": ["libs/sdk/react/src/next.ts"],
"external": ["react/jsx-runtime"],
"rollupConfig": "@nrwl/react/plugins/bundle-rollup",
"compiler": "babel",
"extractCss": false,
"format": ["esm"],
"extractCss": false,
"assets": [
{
"glob": "libs/sdk/react/README.md",
Expand Down
15 changes: 13 additions & 2 deletions core-web/libs/sdk/uve/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dotcms/uve",
"version": "0.0.1",
"version": "0.0.1-beta.2",
"description": "Official JavaScript library for interacting with Universal Visual Editor (UVE)",
"repository": {
"type": "git",
Expand All @@ -13,10 +13,21 @@
"UVE",
"Universal Visual Editor"
],
"exports": {
"./package.json": "./package.json",
".": "./src/index.ts",
"./types": "./src/types.ts"
},
"typesVersions": {
"*": {
".": ["./src/index.d.ts"],
"types": ["./src/types.d.ts"]
}
},
"author": "dotcms <[email protected]>",
"license": "MIT",
"bugs": {
"url": "https://github.com/dotCMS/core/issues"
},
"homepage": "https://github.com/dotCMS/core/tree/main/core-web/libs/sdk/client/README.md"
"homepage": "https://github.com/dotCMS/core/tree/main/core-web/libs/sdk/uve/README.md"
}
15 changes: 9 additions & 6 deletions core-web/libs/sdk/uve/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,17 @@
"executor": "@nx/rollup:rollup",
"outputs": ["{options.outputPath}"],
"options": {
"format": ["esm", "cjs"],
"compiler": "tsc",
"main": "libs/sdk/uve/src/index.ts",
"additionalEntryPoints": ["libs/sdk/uve/src/types.ts"],
"generateExportsField": true,
"assets": [{ "input": "libs/sdk/uve", "output": ".", "glob": "*.md" }],
"outputPath": "dist/libs/sdk/uve",
"main": "libs/sdk/uve/src/public/index.ts",
"additionalEntryPoints": ["libs/sdk/uve/src/public/types.ts"],
"tsConfig": "libs/sdk/uve/tsconfig.lib.json"
"tsConfig": "libs/sdk/uve/tsconfig.lib.json",
"project": "libs/sdk/uve/package.json",
"entryFile": "libs/sdk/uve/src/index.ts",
"compiler": "babel",
"format": ["esm", "cjs"],
"extractCss": false,
"assets": [{ "input": "libs/sdk/uve", "output": ".", "glob": "*.md" }]
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions core-web/libs/sdk/uve/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { getUVEState } from './lib/utils';

export { getUVEState };
3 changes: 0 additions & 3 deletions core-web/libs/sdk/uve/src/public/index.ts

This file was deleted.

3 changes: 0 additions & 3 deletions core-web/libs/sdk/uve/src/public/types.ts

This file was deleted.

3 changes: 3 additions & 0 deletions core-web/libs/sdk/uve/src/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { UVE_MODE, UVEState } from './lib/types';

export { UVE_MODE, UVEState };
4 changes: 2 additions & 2 deletions core-web/tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@
"@dotcms/utils": ["libs/utils/src"],
"@dotcms/utils-testing": ["libs/utils-testing/src/index.ts"],
"@dotcms/utils/*": ["libs/utils/src/*"],
"@dotcms/uve": ["libs/sdk/uve/src/public/index.ts"],
"@dotcms/uve/types": ["libs/sdk/uve/src/public/types.ts"],
"@dotcms/uve": ["libs/sdk/uve/src/index.ts"],
"@dotcms/uve/types": ["libs/sdk/uve/src/types.ts"],
"@models/*": ["apps/dotcms-ui/src/app/shared/models/*"],
"@pipes/*": ["apps/dotcms-ui/src/app/view/pipes/*"],
"@portlets/*": ["apps/dotcms-ui/src/app/portlets/*"],
Expand Down

0 comments on commit 4fa1761

Please sign in to comment.