From 1e1a39c99a66c63280ff32b4be931455c45f1143 Mon Sep 17 00:00:00 2001 From: smouillour Date: Mon, 15 Apr 2024 11:05:30 +0200 Subject: [PATCH] cmf-router, dataviz, design-tokens and faceted-search --- packages/cmf-router/package.json | 16 +++++++++++ packages/cmf-router/tsconfig.esm.json | 7 +++++ packages/cmf-router/tsconfig.json | 4 +++ packages/dataviz/package.json | 16 ++++++++++- packages/dataviz/tsconfig.esm.json | 8 ++++++ packages/design-tokens/package.json | 10 ++----- packages/faceted-search/package.json | 27 ++++++++++++++++++- .../QuickSearchInput.component.js | 11 +++++--- packages/faceted-search/tsconfig.esm.json | 7 +++++ packages/faceted-search/tsconfig.json | 4 +++ .../stories/CustomArrayTemplate.component.tsx | 2 +- 11 files changed, 97 insertions(+), 15 deletions(-) create mode 100644 packages/cmf-router/tsconfig.esm.json create mode 100644 packages/cmf-router/tsconfig.json create mode 100644 packages/dataviz/tsconfig.esm.json create mode 100644 packages/faceted-search/tsconfig.esm.json create mode 100644 packages/faceted-search/tsconfig.json diff --git a/packages/cmf-router/package.json b/packages/cmf-router/package.json index e009cf57271..c0c09e63664 100644 --- a/packages/cmf-router/package.json +++ b/packages/cmf-router/package.json @@ -3,11 +3,26 @@ "version": "6.1.2", "description": "", "main": "lib/index.js", + "module": "./lib/esm/index.js", + "exports": { + "./package.json": "./package.json", + ".": { + "import": { + "types": "./lib/esm/index.d.ts", + "default": "./lib/esm/index.js" + }, + "require": { + "types": "./lib/index.d.ts", + "default": "./lib/index.js" + } + } + }, "author": "Talend Frontend (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": "tsc --project ./tsconfig.esm.json", "pre-release": "yarn build:dev && yarn build:prod", "build:lib": "talend-scripts build", "start": "echo nothing to start", @@ -39,6 +54,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" diff --git a/packages/cmf-router/tsconfig.esm.json b/packages/cmf-router/tsconfig.esm.json new file mode 100644 index 00000000000..0b9ecd61042 --- /dev/null +++ b/packages/cmf-router/tsconfig.esm.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "lib/esm", + "module": "ESNext" + } +} diff --git a/packages/cmf-router/tsconfig.json b/packages/cmf-router/tsconfig.json new file mode 100644 index 00000000000..3405e576ec1 --- /dev/null +++ b/packages/cmf-router/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "@talend/scripts-config-typescript/tsconfig.json", + "include": ["src/**/*"] +} diff --git a/packages/dataviz/package.json b/packages/dataviz/package.json index a205a9d0706..57fef045533 100644 --- a/packages/dataviz/package.json +++ b/packages/dataviz/package.json @@ -3,14 +3,28 @@ "version": "6.1.3", "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": { + "./package.json": "./package.json", + ".": { + "import": { + "types": "./lib/esm/index.d.ts", + "default": "./lib/esm/index.js" + }, + "require": { + "types": "./lib/index.d.ts", + "default": "./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": "tsc --project ./tsconfig.esm.json && cpx 'src/**/*.{scss,json}' lib/esm --verbose", "build-storybook": "talend-scripts build-storybook", "extract-i18n": "i18next-scanner --config i18next-scanner.config.js", "lint": "talend-scripts lint", diff --git a/packages/dataviz/tsconfig.esm.json b/packages/dataviz/tsconfig.esm.json new file mode 100644 index 00000000000..c2a3716108b --- /dev/null +++ b/packages/dataviz/tsconfig.esm.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "lib/esm", + "module": "ESNext" + }, + "exclude": ["src/**/*.test.*", "src/**/*.stories.*", "src/**/*.cy.*"] +} diff --git a/packages/design-tokens/package.json b/packages/design-tokens/package.json index f33ef33698a..336eb582cc2 100644 --- a/packages/design-tokens/package.json +++ b/packages/design-tokens/package.json @@ -7,14 +7,8 @@ "module": "./lib/esm/index.js", "exports": { "./package.json": "./package.json", - "./lib/tokens": { - "import": "./lib/esm/_tokens.scss", - "require": "./lib/_tokens.scss" - }, - "./lib/_tokens": { - "import": "./lib/esm/_tokens.scss", - "require": "./lib/_tokens.scss" - }, + "./lib/tokens": "./lib/esm/_tokens.scss", + "./lib/_tokens": "./lib/esm/_tokens.scss", "./lib/*": { "import": "./lib/esm/*", "require": "./lib/*" diff --git a/packages/faceted-search/package.json b/packages/faceted-search/package.json index 7f18fd0cc26..2d61316c0ab 100644 --- a/packages/faceted-search/package.json +++ b/packages/faceted-search/package.json @@ -3,13 +3,37 @@ "version": "19.0.0", "description": "Faceted search", "main": "lib/index.js", - "mainSrc": "src/index.js", + "module": "./lib/esm/index.js", + "exports": { + "./package.json": "./package.json", + "./lib/*": { + "import": { + "types": "./lib/esm/*/index.d.ts", + "default": "./lib/esm/*/index.js" + }, + "require": { + "types": "./lib/*/index.d.ts", + "default": "./lib/*/index.js" + } + }, + ".": { + "import": { + "types": "./lib/esm/index.d.ts", + "default": "./lib/esm/index.js" + }, + "require": { + "types": "./lib/index.d.ts", + "default": "./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": "tsc --project ./tsconfig.esm.json && cpx 'src/**/*.{scss,json}' lib/esm --verbose", "test": "cross-env TZ=UTC talend-scripts test", "test:watch": "cross-env TZ=UTC talend-scripts test --watch", "test:cov": "cross-env TZ=UTC talend-scripts test --coverage", @@ -55,6 +79,7 @@ "@talend/scripts-config-jest": "^14.0.2", "@talend/scripts-config-react-webpack": "^16.5.1", "@talend/scripts-config-storybook-lib": "^5.3.1", + "@talend/scripts-config-typescript": "^11.2.1", "@testing-library/react": "^14.2.1", "@testing-library/user-event": "^14.5.2", "babel-plugin-angularjs-annotate": "^0.10.0", diff --git a/packages/faceted-search/src/components/QuickSearchInput/QuickSearchInput.component.js b/packages/faceted-search/src/components/QuickSearchInput/QuickSearchInput.component.js index 25a20fb0569..4078eddf351 100644 --- a/packages/faceted-search/src/components/QuickSearchInput/QuickSearchInput.component.js +++ b/packages/faceted-search/src/components/QuickSearchInput/QuickSearchInput.component.js @@ -1,7 +1,10 @@ -import { useState, useMemo } from 'react'; -import PropTypes from 'prop-types'; +import { useMemo, useState } from 'react'; + import get from 'lodash/get'; -import { Typeahead } from '@talend/react-components/lib/Typeahead'; +import PropTypes from 'prop-types'; + +import Typeahead from '@talend/react-components/lib/Typeahead'; + import { badgesFacetedPropTypes } from '../facetedSearch.propTypes'; export const DEFAULT_QUICKSEARCH_OPERATOR = 'containsIgnoreCase'; @@ -62,7 +65,7 @@ export const QuickSearchInput = ({ }), suggestions: filteredFacets.map(a => get(a, ['properties', 'label'], null)), }, - ] + ] : undefined } value={value} diff --git a/packages/faceted-search/tsconfig.esm.json b/packages/faceted-search/tsconfig.esm.json new file mode 100644 index 00000000000..0b9ecd61042 --- /dev/null +++ b/packages/faceted-search/tsconfig.esm.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "lib/esm", + "module": "ESNext" + } +} diff --git a/packages/faceted-search/tsconfig.json b/packages/faceted-search/tsconfig.json new file mode 100644 index 00000000000..3405e576ec1 --- /dev/null +++ b/packages/faceted-search/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "@talend/scripts-config-typescript/tsconfig.json", + "include": ["src/**/*"] +} diff --git a/packages/forms/stories/CustomArrayTemplate.component.tsx b/packages/forms/stories/CustomArrayTemplate.component.tsx index bbfdd8d6a6c..7af1c4d469e 100644 --- a/packages/forms/stories/CustomArrayTemplate.component.tsx +++ b/packages/forms/stories/CustomArrayTemplate.component.tsx @@ -71,7 +71,7 @@ export function CustomArrayTemplate({ return (
  • - {renderItem(index) ?? null} + {renderItem(index)}
  • ); })}