Skip to content

Commit

Permalink
fix: resolve build process issues in packages (#11)
Browse files Browse the repository at this point in the history
This commit resolves build process issues caused by external dependencies in previous versions. It uses `tsup` for building packages, with configuration now imported from the `ui-core` package, which centralizes shared configurations and utilities. The `ui-core` package exports the `merge` function, `tsconfig.base.json`, and `tsup.config.base.ts`. Additionally, the exports field in the `ui-core` package.json has been updated for better structure and functionality.
  • Loading branch information
halvaradop authored Sep 17, 2024
1 parent 0b858d2 commit 5d36a25
Show file tree
Hide file tree
Showing 13 changed files with 610 additions and 37 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"react": "^18.3.1",
"react-dom": "^18.3.1",
"tailwindcss": "^3.4.11",
"tsup": "^8.3.0",
"turbo": "^2.1.2",
"typescript": "^5.6.2"
},
Expand All @@ -70,7 +71,7 @@
"overrides": [
{
"files": [
"*.json",
"**/*.json",
"README.md",
"*.yaml"
],
Expand Down
15 changes: 10 additions & 5 deletions packages/button/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
{
"name": "@halvaradop/ui-button",
"version": "0.1.0",
"version": "0.1.0-beta.3",
"description": "A customizable button component for @halvaradop/ui library with Tailwind CSS styling.",
"main": "dist/index.jsx",
"types": "dist/index.d.ts",
"type": "module",
"scripts": {
"dev": "tsc -w",
"build": "tsc",
"dev": "tsup --watch",
"build": "tsup",
"format": "prettier --write .",
"format:check": "prettier --check ."
},
Expand All @@ -33,6 +31,13 @@
"files": [
"dist"
],
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"require": "./dist/index.cjs"
}
},
"devDependencies": {
"@halvaradop/ui-core": "workspace:*"
}
Expand Down
5 changes: 3 additions & 2 deletions packages/button/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"extends": "@halvaradop/ui-core",
"extends": "@halvaradop/ui-core/tsconfig.base.json",
"compilerOptions": {
"outDir": "dist"
"outDir": "dist",
"jsx": "preserve"
},
"include": ["src"],
"exclude": ["node_modules", "dist"]
Expand Down
4 changes: 4 additions & 0 deletions packages/button/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { defineConfig } from "tsup"
import { tsupConfig } from "@halvaradop/ui-core/tsup.config.base"

export default defineConfig(tsupConfig)
24 changes: 18 additions & 6 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "@halvaradop/ui-core",
"version": "0.1.0-beta.6",
"version": "0.1.0-beta.13",
"description": "The core of the @halvaradop/ui library, providing customizable components with Tailwind CSS styling.",
"type": "module",
"scripts": {
"dev": "tsc -w",
"build": "tsc",
"dev": "tsup --watch",
"build": "tsup",
"format": "prettier --write .",
"format:check": "prettier --check ."
},
Expand All @@ -27,10 +27,22 @@
},
"homepage": "https://github.com/halvaradop/ui#readme",
"files": [
"dist",
"index.ts",
"tsconfig.json"
"dist"
],
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"require": "./dist/index.cjs"
},
"./package.json": "./package.json",
"./tsconfig.base.json": "./tsconfig.base.json",
"./tsup.config.base": {
"types": "./dist/tsup.config.base.d.ts",
"import": "./dist/tsup.config.base.js",
"require": "./dist/tsup.config.base.cjs"
}
},
"devDependencies": {
"tailwind-merge": "^2.5.2"
}
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from "./utils.js"
export * from "./tsup.config.base.js"
11 changes: 11 additions & 0 deletions packages/core/src/tsup.config.base.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Options } from "tsup"

export const tsupConfig: Options = {
entry: ["src"],
format: ["esm", "cjs"],
dts: true,
clean: true,
splitting: false,
minify: true,
external: ["vite", "react", "react-dom", "tailwindcss"],
}
File renamed without changes.
20 changes: 20 additions & 0 deletions packages/core/tsconfig.base.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"display": "Node 20",
"_version": "20.1.0",
"compilerOptions": {
"lib": ["ES2022", "DOM"],
"target": "ES2022",
"declaration": true,
"module": "Node16",
"moduleResolution": "Node16",
"moduleDetection": "force",
"strict": true,
"allowJs": true,
"checkJs": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"skipLibCheck": true
}
}
21 changes: 4 additions & 17 deletions packages/core/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,8 @@
{
"display": "Node 20",
"_version": "20.1.0",
"extends": "./tsconfig.base.json",
"compilerOptions": {
"lib": ["ES2022", "DOM"],
"target": "ES2022",
"declaration": true,
"jsx": "preserve",
"outDir": "dist",
"module": "Node16",
"moduleResolution": "Node16",
"moduleDetection": "force",
"allowJs": true,
"checkJs": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true
"outDir": "dist"
},
"include": ["./**/*.ts"]
"include": ["src"],
"exclude": ["node_modules", "dist"]
}
4 changes: 4 additions & 0 deletions packages/core/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { defineConfig } from "tsup"
import { tsupConfig } from "./src/tsup.config.base"

export default defineConfig(tsupConfig)
Loading

0 comments on commit 5d36a25

Please sign in to comment.