From 4b8a9efd7a2fd3b583bb5db6e9a74c3905b29d7d Mon Sep 17 00:00:00 2001 From: Gooddevil Date: Mon, 2 Dec 2024 12:57:52 +0330 Subject: [PATCH 1/2] Update Storybook Rollup Tailwind configs and dependencies and remove unused file --- .storybook/main.ts | 1 + .storybook/preview.ts | 1 + anotherUiTwPlugin.ts | 0 package.json | 10 ++++++---- pnpm-lock.yaml | 6 +++--- rollup.config.mjs | 4 ++-- tailwind.config.js | 7 ++----- 7 files changed, 15 insertions(+), 14 deletions(-) delete mode 100644 anotherUiTwPlugin.ts diff --git a/.storybook/main.ts b/.storybook/main.ts index 526f5d4..b5599f5 100644 --- a/.storybook/main.ts +++ b/.storybook/main.ts @@ -1,3 +1,4 @@ +/* eslint-disable n/no-unpublished-import */ import type { StorybookConfig } from '@storybook/react-vite'; const config: StorybookConfig = { diff --git a/.storybook/preview.ts b/.storybook/preview.ts index 7e98b0f..3b91b69 100644 --- a/.storybook/preview.ts +++ b/.storybook/preview.ts @@ -1,3 +1,4 @@ +/* eslint-disable n/no-unpublished-import */ import type { Preview } from '@storybook/react'; import './tailwind.css'; diff --git a/anotherUiTwPlugin.ts b/anotherUiTwPlugin.ts deleted file mode 100644 index e69de29..0000000 diff --git a/package.json b/package.json index fbac7d2..fbf2daf 100644 --- a/package.json +++ b/package.json @@ -46,13 +46,17 @@ "rollup": "4.25.0", "tailwind-merge": "^2.5.4" }, - "perDependencies": { + "peerDependencies": { "react": "^18", "react-dom": "^18", "@types/react": "^18", - "@types/react-dom": "^18" + "@types/react-dom": "^18", + "tailwindcss": "3.4.14", + "tailwindcss-animate": "^1.0.7" }, "devDependencies": { + "tailwindcss": "3.4.14", + "tailwindcss-animate": "^1.0.7", "@chromatic-com/storybook": "3.2.2", "@eslint/js": "9.13.0", "@fullstacksjs/eslint-config": "^11.4.0", @@ -89,8 +93,6 @@ "rollup-plugin-delete": "2.1.0", "rollup-plugin-postcss": "4.0.2", "storybook": "8.4.2", - "tailwindcss": "3.4.14", - "tailwindcss-animate": "^1.0.7", "typescript": "5.6.2", "typescript-eslint": "8.11.0", "vite": "5.4.10", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8b56c38..d0b56e6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -41,6 +41,9 @@ importers: tailwind-merge: specifier: ^2.5.4 version: 2.5.4 + tailwindcss: + specifier: 3.4.14 + version: 3.4.14 devDependencies: '@chromatic-com/storybook': specifier: 3.2.2 @@ -150,9 +153,6 @@ importers: storybook: specifier: 8.4.2 version: 8.4.2(prettier@3.3.3) - tailwindcss: - specifier: 3.4.14 - version: 3.4.14 tailwindcss-animate: specifier: ^1.0.7 version: 1.0.7(tailwindcss@3.4.14) diff --git a/rollup.config.mjs b/rollup.config.mjs index 823fdd4..4e06ba7 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -10,8 +10,8 @@ import postcss from 'rollup-plugin-postcss'; */ export default { - input: ['./src/index.ts'], - external: ['react', 'react-dom'], + external: ['react', 'react-dom', 'react/jsx-runtime'], + input: ['./src/index.ts', './twPlugin/auTwPlugin.ts'], output: [{ dir: './dist/', format: 'esm', sourcemap: true }], plugins: [ del({ targets: 'dist/*' }), diff --git a/tailwind.config.js b/tailwind.config.js index 872daa6..8b4fb8b 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -1,13 +1,10 @@ +/* eslint-disable n/no-unpublished-import */ import twAnimate from 'tailwindcss-animate'; import { auTwPlugin } from './twPlugin'; /** @type {import('tailwindcss').Config} */ export default { - content: [ - './src/**/*.{html,js,ts,tsx,jsx}', - '.storybook/*.ts', - '.storybook/*.tsx', - ], + content: ['./src/**/*.{html,js,ts,tsx,jsx}', './.storybook/**/*.{js,ts,tsx}'], plugins: [auTwPlugin, twAnimate], }; From 63919a66d79737e90fa32a588da13266308163b0 Mon Sep 17 00:00:00 2001 From: Gooddevil Date: Mon, 2 Dec 2024 13:11:06 +0330 Subject: [PATCH 2/2] Fix the build proccess with rollup --- package.json | 9 +++++---- pnpm-lock.yaml | 9 ++++++--- rollup.config.mjs | 2 +- tsconfig.json | 3 +-- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index fbf2daf..ca2ae13 100644 --- a/package.json +++ b/package.json @@ -47,16 +47,14 @@ "tailwind-merge": "^2.5.4" }, "peerDependencies": { - "react": "^18", - "react-dom": "^18", "@types/react": "^18", "@types/react-dom": "^18", + "react": "^18", + "react-dom": "^18", "tailwindcss": "3.4.14", "tailwindcss-animate": "^1.0.7" }, "devDependencies": { - "tailwindcss": "3.4.14", - "tailwindcss-animate": "^1.0.7", "@chromatic-com/storybook": "3.2.2", "@eslint/js": "9.13.0", "@fullstacksjs/eslint-config": "^11.4.0", @@ -93,6 +91,9 @@ "rollup-plugin-delete": "2.1.0", "rollup-plugin-postcss": "4.0.2", "storybook": "8.4.2", + "tailwindcss": "3.4.14", + "tailwindcss-animate": "^1.0.7", + "tslib": "^2.8.1", "typescript": "5.6.2", "typescript-eslint": "8.11.0", "vite": "5.4.10", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d0b56e6..6b7b223 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -41,9 +41,6 @@ importers: tailwind-merge: specifier: ^2.5.4 version: 2.5.4 - tailwindcss: - specifier: 3.4.14 - version: 3.4.14 devDependencies: '@chromatic-com/storybook': specifier: 3.2.2 @@ -153,9 +150,15 @@ importers: storybook: specifier: 8.4.2 version: 8.4.2(prettier@3.3.3) + tailwindcss: + specifier: 3.4.14 + version: 3.4.14 tailwindcss-animate: specifier: ^1.0.7 version: 1.0.7(tailwindcss@3.4.14) + tslib: + specifier: ^2.8.1 + version: 2.8.1 typescript: specifier: 5.6.2 version: 5.6.2 diff --git a/rollup.config.mjs b/rollup.config.mjs index 4e06ba7..f037007 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -17,12 +17,12 @@ export default { del({ targets: 'dist/*' }), resolve(), commonjs(), + typescript({ tsconfig: './tsconfig.json' }), postcss({ minimize: true, extract: true, sourceMap: true, }), - typescript(), copy({ targets: [{ src: './package.json', dest: 'dist/' }], }), diff --git a/tsconfig.json b/tsconfig.json index 72881ca..6884b25 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,7 +3,7 @@ "./src/**/*.ts", "./src/**/*.tsx", ".src/*.jsx", - "./twPlugin.ts", + "./twPlugin/**/*.ts", "./tailwind.config.ts" ], "exclude": ["node_modules"], @@ -22,7 +22,6 @@ "useDefineForClassFields": true, "skipLibCheck": true, "moduleResolution": "Bundler", - "allowImportingTsExtensions": true, "isolatedModules": true, "moduleDetection": "force", "noEmit": true,