Skip to content

Commit

Permalink
feat(ARCH-737): add ESM support (#5329)
Browse files Browse the repository at this point in the history
  • Loading branch information
smouillour authored Jun 10, 2024
1 parent 72eef4b commit 3bd16fc
Show file tree
Hide file tree
Showing 92 changed files with 5,339 additions and 147 deletions.
7 changes: 7 additions & 0 deletions .changeset/cyan-zoos-rule.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@talend/scripts-config-babel": minor
---

feat: add preset modules option

if process.env.ESM is set to true then the babel config will set preset-env.modules option to `false` so the output will be esm.
20 changes: 20 additions & 0 deletions .changeset/smooth-queens-dance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
"@talend/scripts-config-react-webpack": minor
"@talend/json-schema-form-core": minor
"@talend/react-faceted-search": minor
"@talend/design-system": minor
"@talend/design-tokens": minor
"@talend/react-bootstrap": minor
"@talend/assets-api": minor
"@talend/react-cmf-router": minor
"@talend/react-components": minor
"@talend/react-containers": minor
"@talend/react-dataviz": minor
"@talend/react-forms": minor
"@talend/icons": minor
"@talend/utils": minor
"@talend/react-a11y": minor
"@talend/react-cmf": minor
---

Add support to ESM
8 changes: 8 additions & 0 deletions .changeset/spotty-trains-hammer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@talend/storybook-docs": patch
"@talend/design-docs": patch
"@talend/bootstrap-theme": patch
"@talend/scripts-config-storybook-lib": patch
---

Make it compatible with ESM
5 changes: 5 additions & 0 deletions .changeset/three-poets-laugh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@talend/scripts-core": minor
---

feat: add --esm option to talend-scripts build:lib
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ build/
/packages/*/i18n/
tmp/
lib/
lib-esm/
storybook-static/
dist/
eslint-report.json
Expand Down
9 changes: 8 additions & 1 deletion fork/json-schema-form-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,16 @@
"version": "1.2.7",
"description": "JSON-Schema and JSON-UI-Schema utilities for form generation.",
"main": "dist/index.js",
"mainSrc": "src/index.js",
"module": "./lib-esm/index.js",
"exports": {
".": {
"import": "./lib-esm/index.js",
"require": "./dist/index.js"
}
},
"scripts": {
"build:lib": "rimraf dist && talend-scripts build --umd",
"build:lib:esm": "talend-scripts build --esm",
"watch": "webpack --watch",
"dist-untested": "webpack --config webpack.config.dist.js",
"test:cov": "npm run test",
Expand Down
7 changes: 7 additions & 0 deletions fork/json-schema-form-core/tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "lib-esm",
"module": "ESNext"
}
}
9 changes: 9 additions & 0 deletions fork/react-bootstrap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,17 @@
"homepage": "https://react-bootstrap.github.io/",
"sideEffects": false,
"main": "lib/index.js",
"module": "./lib-esm/index.js",
"exports": {
".": {
"import": "./lib-esm/index.js",
"require": "./lib/index.js"
}
},
"scripts": {
"build:dev": "talend-scripts build --umd --dev",
"build:prod": "talend-scripts build --umd --prod",
"build:lib:esm": "talend-scripts build --esm",
"pre-release": "yarn build:dev && yarn build:prod",
"build:lib": "talend-scripts build",
"lint": "talend-scripts lint",
Expand Down Expand Up @@ -40,6 +48,7 @@
"devDependencies": {
"@talend/eslint-config": "^13.0.3",
"@talend/eslint-plugin": "^1.1.1",
"@talend/scripts-config-typescript": "^11.2.1",
"@talend/scripts-core": "^16.3.5",
"@talend/scripts-config-babel": "^13.3.1",
"@talend/scripts-config-react-webpack": "^16.6.0",
Expand Down
7 changes: 7 additions & 0 deletions fork/react-bootstrap/tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "lib-esm",
"module": "ESNext"
}
}
4 changes: 4 additions & 0 deletions fork/react-bootstrap/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "@talend/scripts-config-typescript/tsconfig.json",
"include": ["src/**/*"]
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"typescript": "^5.3.3"
},
"scripts": {
"postinstall": "talend-yarn-workspace run build:lib",
"postinstall": "talend-yarn-workspace run build:lib && talend-yarn-workspace run build:lib:esm",
"pre-release": "talend-yarn-workspace run pre-release",
"start": "yarn workspace @talend/ui-playground run start",
"start-storybook": "yarn workspace @talend/ui-storybook-one run start",
Expand Down
8 changes: 8 additions & 0 deletions packages/a11y/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,16 @@
"mainSrc": "src/index.js",
"license": "Apache-2.0",
"types": "./lib/index.d.ts",
"module": "./lib-esm/index.js",
"exports": {
".": {
"import": "./lib-esm/index.js",
"require": "./lib/index.js"
}
},
"scripts": {
"build:lib": "talend-scripts build",
"build:lib:esm": "talend-scripts build --esm",
"test": "talend-scripts test",
"lint": "talend-scripts lint"
},
Expand Down
7 changes: 7 additions & 0 deletions packages/a11y/tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "lib-esm",
"module": "ESNext"
}
}
9 changes: 8 additions & 1 deletion packages/assets-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,18 @@
"description": "A set of API designed to access assets using CDN",
"types": "lib/index.d.ts",
"main": "lib/index.js",
"mainSrc": "src/index.ts",
"module": "./lib-esm/index.js",
"exports": {
".": {
"import": "./lib-esm/index.js",
"require": "./lib/index.js"
}
},
"license": "Apache-2.0",
"scripts": {
"pre-release": "talend-scripts build --umd && talend-scripts build --umd --dev",
"build:lib": "talend-scripts build",
"build:lib:esm": "talend-scripts build --esm",
"start": "echo nothing to start",
"test": "talend-scripts test",
"test:watch": "talend-scripts test --watch",
Expand Down
9 changes: 9 additions & 0 deletions packages/assets-api/tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json",
"exclude": ["src/**/*.test.ts"],
"compilerOptions": {
"declaration": true,
"outDir": "lib-esm",
"module": "ESNext"
}
}
9 changes: 9 additions & 0 deletions packages/cmf-router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,19 @@
"version": "6.1.3",
"description": "",
"main": "lib/index.js",
"module": "./lib-esm/index.js",
"exports": {
".": {
"import": "./lib-esm/index.js",
"require": "./lib/index.js"
}
},
"author": "Talend Frontend <[email protected]> (http://www.talend.com)",
"license": "Apache-2.0",
"scripts": {
"build:dev": "talend-scripts build --umd --dev",
"build:prod": "talend-scripts build --umd --prod",
"build:lib:esm": "talend-scripts build --esm",
"pre-release": "yarn build:dev && yarn build:prod",
"build:lib": "talend-scripts build",
"start": "echo nothing to start",
Expand Down Expand Up @@ -39,6 +47,7 @@
"@talend/scripts-core": "^16.3.5",
"@talend/scripts-config-babel": "^13.3.1",
"@talend/scripts-config-react-webpack": "^16.5.1",
"@talend/scripts-config-typescript": "^11.2.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"redux-saga-tester": "^1.0.874"
Expand Down
7 changes: 7 additions & 0 deletions packages/cmf-router/tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "lib-esm",
"module": "ESNext"
}
}
4 changes: 4 additions & 0 deletions packages/cmf-router/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "@talend/scripts-config-typescript/tsconfig.json",
"include": ["src/**/*"]
}
13 changes: 13 additions & 0 deletions packages/cmf/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,21 @@
"main": "lib/index.js",
"mainSrc": "src/index.js",
"license": "Apache-2.0",
"module": "./lib-esm/index.js",
"exports": {
".": {
"import": "./lib-esm/index.js",
"require": "./lib/index.js"
},
"./lib/*": {
"import": "./lib-esm/*",
"require": "./lib/*"
}
},
"scripts": {
"build:dev": "talend-scripts build --umd --dev",
"build:prod": "talend-scripts build --umd --prod",
"build:lib:esm": "talend-scripts build --esm",
"pre-release": "yarn build:dev && yarn build:prod",
"build:lib": "talend-scripts build",
"start": "echo nothing to start",
Expand Down Expand Up @@ -54,6 +66,7 @@
"@redux-saga/testing-utils": "^1.1.5",
"@talend/eslint-config": "^13.0.3",
"@talend/eslint-plugin": "^1.1.1",
"@talend/scripts-config-typescript": "^11.2.1",
"@talend/scripts-core": "^16.3.5",
"@talend/scripts-config-babel": "^13.3.1",
"@talend/scripts-config-jest": "^14.0.2",
Expand Down
7 changes: 7 additions & 0 deletions packages/cmf/tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "lib-esm",
"module": "ESNext"
}
}
4 changes: 4 additions & 0 deletions packages/cmf/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "@talend/scripts-config-typescript/tsconfig.json",
"include": ["src/**/*"]
}
19 changes: 15 additions & 4 deletions packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,24 @@
"name": "@talend/react-components",
"description": "Set of react components.",
"main": "lib/index.js",
"mainSrc": "src/index.js",
"module": "./lib-esm/index.js",
"exports": {
"./lib/*": {
"import": "./lib-esm/*/index.js",
"require": "./lib/*/index.js"
},
".": {
"import": "./lib-esm/index.js",
"require": "./lib/index.js"
}
},
"license": "Apache-2.0",
"scripts": {
"build:dev": "talend-scripts build --umd --dev",
"build:prod": "talend-scripts build --umd --prod",
"pre-release": "yarn build:dev && yarn build:prod",
"build:lib": "talend-scripts build && yarn run tsc",
"build:lib:esm": "talend-scripts build --esm",
"watch": "talend-scripts build --watch",
"tsc": "tsc --emitDeclarationOnly --project ./tsconfig.json --outDir ./types",
"test": "cross-env TZ=UTC talend-scripts test",
Expand Down Expand Up @@ -78,15 +89,15 @@
"@talend/eslint-plugin": "^1.1.1",
"@talend/locales-design-system": "^7.15.1",
"@talend/locales-tui-components": "^11.4.5",
"@talend/scripts-core": "^16.3.5",
"@talend/scripts-config-babel": "^13.3.1",
"@talend/scripts-config-react-webpack": "^16.5.1",
"@talend/scripts-config-storybook-lib": "^5.3.1",
"@talend/scripts-config-typescript": "^11.2.1",
"@talend/scripts-core": "^16.3.5",
"@testing-library/jest-dom": "^6.4.2",
"@testing-library/react": "^14.2.1",
"@testing-library/user-event": "^14.5.2",
"@testing-library/react-hooks": "^8.0.1",
"@testing-library/user-event": "^14.5.2",
"@types/classnames": "^2.3.1",
"@types/d3": "^7.4.3",
"@types/jest": "^29.5.12",
Expand All @@ -102,8 +113,8 @@
"react": "^18.2.0",
"react-a11y": "^0.3.4",
"react-dom": "^18.2.0",
"react-router-dom": "~6.3.0",
"react-i18next": "^13.5.0",
"react-router-dom": "~6.3.0",
"react-test-renderer": "^18.2.0"
},
"peerDependencies": {
Expand Down
8 changes: 8 additions & 0 deletions packages/components/tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"exclude": ["node_modules", "src/**/*.stories.*", "src/**/*.test.*"],
"compilerOptions": {
"outDir": "lib-esm",
"module": "ESNext"
}
}
14 changes: 13 additions & 1 deletion packages/containers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,25 @@
"name": "@talend/react-containers",
"description": "Provide connected components aka containers for @talend/react-cmf based on @talend/react-components.",
"main": "lib/index.js",
"mainSrc": "src/index.js",
"types": "lib/index.d.ts",
"module": "./lib-esm/index.js",
"exports": {
"./lib/*": {
"import": "./lib-esm/*/index.js",
"require": "./lib/*/index.js"
},
".": {
"import": "./lib-esm/index.js",
"require": "./lib/index.js"
}
},
"license": "Apache-2.0",
"scripts": {
"build:dev": "talend-scripts build --umd --dev",
"build:prod": "talend-scripts build --umd --prod",
"pre-release": "yarn build:dev && yarn build:prod",
"build:lib": "talend-scripts build",
"build:lib:esm": "talend-scripts build --esm",
"start": "talend-scripts start-storybook -p 6007",
"test": "talend-scripts test",
"test:watch": "talend-scripts test --watch",
Expand Down
9 changes: 9 additions & 0 deletions packages/containers/tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "@talend/scripts-config-typescript/tsconfig.json",
"include": ["src/**/*"],
"compilerOptions": {
"declaration": true,
"outDir": "lib-esm",
"module": "ESNext"
}
}
9 changes: 8 additions & 1 deletion packages/dataviz/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,21 @@
"version": "6.1.5",
"description": "Talend charts and visualization components",
"main": "lib/index.js",
"mainSrc": "src/index.ts",
"types": "./lib/index.d.ts",
"module": "./lib-esm/index.js",
"exports": {
".": {
"import": "./lib-esm/index.js",
"require": "./lib/index.js"
}
},
"license": "Apache-2.0",
"scripts": {
"pre-release": "yarn build:umd:dev && yarn build:umd:prod",
"build:umd:dev": "talend-scripts build --umd --dev",
"build:umd:prod": "talend-scripts build --umd",
"build:lib": "talend-scripts build",
"build:lib:esm": "talend-scripts build --esm",
"build-storybook": "talend-scripts build-storybook",
"extract-i18n": "i18next-scanner --config i18next-scanner.config.js",
"lint": "talend-scripts lint",
Expand Down
8 changes: 8 additions & 0 deletions packages/dataviz/tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "lib-esm",
"module": "ESNext"
},
"exclude": ["src/**/*.test.*", "src/**/*.stories.*", "src/**/*.cy.*"]
}
Loading

0 comments on commit 3bd16fc

Please sign in to comment.