From 0969bd13ef1be11c16c085d32ccced3535f89a85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matheus=20Lu=C3=ADs?= Date: Tue, 10 Sep 2024 10:25:28 -0300 Subject: [PATCH 1/2] update shadcn cli usage --- .changeset/hot-peaches-run.md | 5 +++++ package.json | 2 +- packages/ui/components.json | 8 +++++--- packages/ui/package.json | 3 +-- packages/ui/src/index.ts | 7 +------ packages/ui/src/lib/utils.ts | 6 ++++++ packages/ui/tsconfig.json | 8 +++++++- 7 files changed, 26 insertions(+), 13 deletions(-) create mode 100644 .changeset/hot-peaches-run.md create mode 100644 packages/ui/src/lib/utils.ts diff --git a/.changeset/hot-peaches-run.md b/.changeset/hot-peaches-run.md new file mode 100644 index 0000000..8b8c0b3 --- /dev/null +++ b/.changeset/hot-peaches-run.md @@ -0,0 +1,5 @@ +--- +"@sophys-web/ui": minor +--- + +Update to new shadcn-cli diff --git a/package.json b/package.json index b8c00ec..efff434 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "clean": "turbo clean", "format": "prettier --write \"**/*.{ts,tsx,md}\"", "format:check": "prettier --check \"**/*.{ts,tsx,md}\"", - "ui-add": "turbo run ui-add" + "ui-add": "pnpm dlx shadcn@latest add -c packages/ui" }, "devDependencies": { "@sophys-web/typescript-config": "workspace:*", diff --git a/packages/ui/components.json b/packages/ui/components.json index a67f57e..70ad535 100644 --- a/packages/ui/components.json +++ b/packages/ui/components.json @@ -11,8 +11,10 @@ "prefix": "" }, "aliases": { - "components": "src/", - "utils": "@sophys-web/ui", - "ui": "src/" + "components": "@/src/", + "utils": "@/src/lib/utils", + "ui": "@/src/", + "hooks": "@/src/hooks", + "lib": "@/src/lib" } } \ No newline at end of file diff --git a/packages/ui/package.json b/packages/ui/package.json index da75897..bd7701b 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -18,8 +18,7 @@ "clean": "rm -rf dist .turbo node_modules", "lint": "eslint src/", "dev": "tailwindcss -i ./src/styles.css -o ./dist/index.css --watch", - "type-check": "tsc --noEmit", - "ui-add": "pnpm dlx shadcn-ui add" + "type-check": "tsc --noEmit" }, "peerDependencies": { "react": "^18.3.1" diff --git a/packages/ui/src/index.ts b/packages/ui/src/index.ts index 365058c..3b88688 100644 --- a/packages/ui/src/index.ts +++ b/packages/ui/src/index.ts @@ -1,6 +1 @@ -import { type ClassValue, clsx } from "clsx"; -import { twMerge } from "tailwind-merge"; - -export function cn(...inputs: ClassValue[]) { - return twMerge(clsx(inputs)); -} +export { cn } from "./lib/utils"; diff --git a/packages/ui/src/lib/utils.ts b/packages/ui/src/lib/utils.ts new file mode 100644 index 0000000..365058c --- /dev/null +++ b/packages/ui/src/lib/utils.ts @@ -0,0 +1,6 @@ +import { type ClassValue, clsx } from "clsx"; +import { twMerge } from "tailwind-merge"; + +export function cn(...inputs: ClassValue[]) { + return twMerge(clsx(inputs)); +} diff --git a/packages/ui/tsconfig.json b/packages/ui/tsconfig.json index 3c19610..c99c53a 100644 --- a/packages/ui/tsconfig.json +++ b/packages/ui/tsconfig.json @@ -1,5 +1,11 @@ { "extends": "@sophys-web/typescript-config/react-library.json", "include": ["."], - "exclude": ["dist", "build", "node_modules"] + "exclude": ["dist", "build", "node_modules"], + "compilerOptions": { + "baseUrl": ".", + "paths": { + "@/*": ["./*"] + } + } } From 5aa4f46c612b807625eb63a7b3364d0b51b8c85e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matheus=20Lu=C3=ADs?= Date: Tue, 10 Sep 2024 10:30:01 -0300 Subject: [PATCH 2/2] remove ui-add from turbo.json --- turbo.json | 4 ---- 1 file changed, 4 deletions(-) diff --git a/turbo.json b/turbo.json index 9d98028..46e49de 100644 --- a/turbo.json +++ b/turbo.json @@ -14,10 +14,6 @@ }, "clean": { "cache": false - }, - "ui-add": { - "cache": false, - "interactive": true } }, "globalEnv": ["AUTH_SECRET", "PORT"],