From 3a97295eba63675c15854567213d3920e14904a5 Mon Sep 17 00:00:00 2001 From: lukemojo <143453762+lukemojo@users.noreply.github.com> Date: Wed, 22 Jan 2025 15:22:03 +0000 Subject: [PATCH] Release/v10.2.0 (#1025) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add svg to imageUploader * Use pnpm version from packageManager * 10.2.0-0 * 10.2.0-2 * VE-265 ESM & CJS Builds (#1024) * esm and cjs builds * 10.2.0-0 * esm default * 10.2.0-1 * resolve conflicts with latest package file from main * 10.2.0-3 * label description type should be optional * 10.2.0-4 * release version prep --------- Co-authored-by: Petauskas, Áron <67595415+AronPetrauskas@users.noreply.github.com> Co-authored-by: Matthew Corner Co-authored-by: David Barry --- .github/workflows/test.yml | 2 -- package.json | 17 +++++++++++++---- src/ImageUploader/ImageUploader.test.tsx | 2 +- src/ImageUploader/ImageUploader.tsx | 1 + src/LabelSelector/Label.types.ts | 2 +- tsconfig.cjs.json | 11 +++++++++++ tsconfig.esm.json | 10 ++++++++++ tsconfig.json | 21 ++++++++++++++++----- tsconfig.production.json | 16 ---------------- 9 files changed, 53 insertions(+), 29 deletions(-) create mode 100644 tsconfig.cjs.json create mode 100644 tsconfig.esm.json delete mode 100644 tsconfig.production.json diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 882843619..b63b61aad 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,8 +20,6 @@ jobs: uses: actions/checkout@v4 - name: Setup pnpm uses: pnpm/action-setup@v3 - with: - version: 8 - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v4 with: diff --git a/package.json b/package.json index 853daaeb8..8d8beda92 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ipguk/react-ui", - "version": "10.1.0", + "version": "10.2.0", "description": "React UI component library for IPG web applications", "author": { "name": "IPG-Automotive-UK" @@ -10,14 +10,23 @@ "type": "git", "url": "git+https://github.com/IPG-Automotive-UK/react-ui.git" }, - "main": "dist/index", + "main": "dist/cjs/index.js", + "module": "dist/esm/index.js", + "exports": { + ".": { + "import": "./dist/esm/index.js", + "require": "./dist/cjs/index.js" + } + }, "engines": { "node": ">=10" }, "scripts": { - "build": "pnpm run clean && pnpm run copy-files && tsc --project ./tsconfig.production.json", + "build": "pnpm run clean && pnpm run copy-files && pnpm run build:cjs && pnpm run build:esm", + "build:cjs": "tsc --project ./tsconfig.cjs.json", + "build:esm": "tsc --project ./tsconfig.esm.json", "clean": "rimraf dist", - "copy-files": "copyfiles -e '**/*.test.**' -e '**/*.spec.**' -e '**/*.stories.**' -u 1 src/**/*.html src/**/*.css src/**/*/*.svg dist/", + "copy-files": "copyfiles -e '**/*.test.**' -e '**/*.spec.**' -e '**/*.stories.**' -u 1 src/**/*.html src/**/*.css src/**/*/*.svg dist/esm/ && copyfiles -e '**/*.test.**' -e '**/*.spec.**' -e '**/*.stories.**' -u 1 src/**/*.html src/**/*.css src/**/*/*.svg dist/cjs/", "prepublishOnly": "pnpm run build", "start": "microbundle-crl watch --no-compress --format modern,cjs --jsxFragment React.Fragment", "storybook": "storybook dev -p 6006", diff --git a/src/ImageUploader/ImageUploader.test.tsx b/src/ImageUploader/ImageUploader.test.tsx index 8aa13bf96..79c619894 100644 --- a/src/ImageUploader/ImageUploader.test.tsx +++ b/src/ImageUploader/ImageUploader.test.tsx @@ -103,7 +103,7 @@ describe("ImageUploader", () => { // wait for the error message to be displayed await waitFor(() => expect(dropzoneElement).toHaveTextContent( - "File type must be .gif, .jpg, .jpeg, .png, .webp." + "File type must be .gif, .jpg, .jpeg, .png, .svg, .webp." ) ); }); diff --git a/src/ImageUploader/ImageUploader.tsx b/src/ImageUploader/ImageUploader.tsx index 3b650f16a..59e8c60dd 100644 --- a/src/ImageUploader/ImageUploader.tsx +++ b/src/ImageUploader/ImageUploader.tsx @@ -25,6 +25,7 @@ export default function ImageUploader({ "image/gif": [".gif"], "image/jpeg": [".jpg", ".jpeg"], "image/png": [".png"], + "image/svg": [".svg"], "image/webp": [".webp"] }, filesLimit: 1, diff --git a/src/LabelSelector/Label.types.ts b/src/LabelSelector/Label.types.ts index 206fdd7c8..304282252 100644 --- a/src/LabelSelector/Label.types.ts +++ b/src/LabelSelector/Label.types.ts @@ -1,6 +1,6 @@ export type Label = { _id: string; color: string; - description: string; + description?: string; name: string; }; diff --git a/tsconfig.cjs.json b/tsconfig.cjs.json new file mode 100644 index 000000000..a37150fdf --- /dev/null +++ b/tsconfig.cjs.json @@ -0,0 +1,11 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "./dist/cjs", + "module": "CommonJS", + "moduleResolution": "node", + "target": "ES2017", + "declaration": true, + "declarationMap": true + } +} diff --git a/tsconfig.esm.json b/tsconfig.esm.json new file mode 100644 index 000000000..4c3a7e6ef --- /dev/null +++ b/tsconfig.esm.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "./dist/esm", + "module": "ESNext", + "target": "ES6", + "declaration": true, + "declarationMap": true + } +} diff --git a/tsconfig.json b/tsconfig.json index daef84dc5..51dfd1b68 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,18 +2,29 @@ "files": ["globals.d.ts"], "compilerOptions": { "allowJs": true, - "declaration": true, + "allowSyntheticDefaultImports": true, "esModuleInterop": true, "forceConsistentCasingInFileNames": true, "isolatedModules": true, "jsx": "react-jsx", "lib": ["DOM", "DOM.Iterable", "ES2019"], + "module": "ESNext", "moduleResolution": "node", - "module": "ES2022", - "outDir": "dist", "resolveJsonModule": true, + "skipLibCheck": true, "strict": true, "target": "ES2019", - "types": ["vitest/globals"] - } + "types": ["vitest/globals"], + "downlevelIteration": true + }, + "include": ["src/**/*.tsx", "src/**/*.ts", "src/**/*.jsx", "src/**/*.js"], + "exclude": [ + "src/**/*.test.**", + "src/**/*.spec.**", + "src/**/*.stories.**", + "dist", + "vitest-setup.ts", + "vite.config.ts", + "vite.config.ts" + ] } diff --git a/tsconfig.production.json b/tsconfig.production.json deleted file mode 100644 index 048d8354a..000000000 --- a/tsconfig.production.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "extends": "./tsconfig.json", - "include": ["src/**/*.tsx", "src/**/*.ts", "src/**/*.jsx", "src/**/*.js"], - "exclude": [ - "src/**/*.test.**", - "src/**/*.spec.**", - "src/**/*.stories.**", - "dist", - "vitest-setup.ts", - "vite.config.ts", - "vite.config.ts" - ], - "compilerOptions": { - "skipLibCheck": true - } -}