From 51f3595c987887d796185074fc351c65b7ff1ca9 Mon Sep 17 00:00:00 2001 From: Alex Sexton Date: Wed, 1 Oct 2025 11:02:45 -0500 Subject: [PATCH] get separated package working with registry --- apps/docs/app/shadcn/page.tsx | 4 +- apps/docs/components/open-in-v0-button.tsx | 4 +- apps/docs/components/ui/button.tsx | 50 +++++++++-------- apps/docs/package.json | 4 +- apps/docs/public/r/git-platform-sync.json | 8 ++- apps/docs/public/r/registry.json | 3 +- apps/docs/registry.json | 3 +- .../git-platform-sync/git-platform-sync.tsx | 5 -- .../new-york/blocks/git-platform-sync | 1 + bun.lock | 19 +++++-- packages/sync-ui-react/package.json | 23 -------- packages/sync-ui-react/src/index.ts | 1 - packages/sync-ui-react/tsconfig.json | 18 ------ .../git-platform-sync/git-platform-sync.tsx | 9 +++ packages/sync-ui-shadcn/components.json | 21 +++++++ .../sync-ui-shadcn/components/ui/button.tsx | 55 +++++++++++++++++++ packages/sync-ui-shadcn/lib/utils.ts | 8 +++ packages/sync-ui-shadcn/package.json | 26 +++++++++ packages/sync-ui-shadcn/tsconfig.json | 12 ++++ tsconfig.json | 2 +- 20 files changed, 193 insertions(+), 83 deletions(-) delete mode 100644 apps/docs/registry/blocks/git-platform-sync/git-platform-sync.tsx create mode 120000 apps/docs/registry/new-york/blocks/git-platform-sync delete mode 100644 packages/sync-ui-react/package.json delete mode 100644 packages/sync-ui-react/src/index.ts delete mode 100644 packages/sync-ui-react/tsconfig.json create mode 100644 packages/sync-ui-shadcn/blocks/git-platform-sync/git-platform-sync.tsx create mode 100644 packages/sync-ui-shadcn/components.json create mode 100644 packages/sync-ui-shadcn/components/ui/button.tsx create mode 100644 packages/sync-ui-shadcn/lib/utils.ts create mode 100644 packages/sync-ui-shadcn/package.json create mode 100644 packages/sync-ui-shadcn/tsconfig.json diff --git a/apps/docs/app/shadcn/page.tsx b/apps/docs/app/shadcn/page.tsx index 0daed9cc1..7f7c5e158 100644 --- a/apps/docs/app/shadcn/page.tsx +++ b/apps/docs/app/shadcn/page.tsx @@ -1,5 +1,5 @@ import { OpenInV0Button } from '@/components/open-in-v0-button'; -import { GitPlatformSync } from '@/registry/blocks/git-platform-sync/git-platform-sync'; +import { GitPlatformSync } from '@/registry/new-york/blocks/git-platform-sync/git-platform-sync'; export default function Home() { return ( @@ -19,7 +19,7 @@ export default function Home() {

Git Platform Sync

- +
diff --git a/apps/docs/components/open-in-v0-button.tsx b/apps/docs/components/open-in-v0-button.tsx index 85a56e8af..581653762 100644 --- a/apps/docs/components/open-in-v0-button.tsx +++ b/apps/docs/components/open-in-v0-button.tsx @@ -1,6 +1,8 @@ import { Button } from '@/components/ui/button'; import { cn } from '@/lib/utils'; +const FALLBACK_BASE_URL = 'https://pierrejs-docs.vercel.app'; + export function OpenInV0Button({ name, className, @@ -16,7 +18,7 @@ export function OpenInV0Button({ asChild > diff --git a/apps/docs/components/ui/button.tsx b/apps/docs/components/ui/button.tsx index d96719c06..a5e8485fa 100644 --- a/apps/docs/components/ui/button.tsx +++ b/apps/docs/components/ui/button.tsx @@ -1,38 +1,37 @@ -import * as React from "react" -import { Slot } from "@radix-ui/react-slot" -import { cva, type VariantProps } from "class-variance-authority" - -import { cn } from "@/lib/utils" +import { cn } from '@/lib/utils'; +import { Slot } from '@radix-ui/react-slot'; +import { type VariantProps, cva } from 'class-variance-authority'; +import * as React from 'react'; const buttonVariants = cva( "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", { variants: { variant: { - default: "bg-primary text-primary-foreground hover:bg-primary/90", + default: 'bg-primary text-primary-foreground hover:bg-primary/90', destructive: - "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60", + 'bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60', outline: - "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50", + 'border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50', secondary: - "bg-secondary text-secondary-foreground hover:bg-secondary/80", + 'bg-secondary text-secondary-foreground hover:bg-secondary/80', ghost: - "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50", - link: "text-primary underline-offset-4 hover:underline", + 'hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50', + link: 'text-primary underline-offset-4 hover:underline', }, size: { - default: "h-9 px-4 py-2 has-[>svg]:px-3", - sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5", - lg: "h-10 rounded-md px-6 has-[>svg]:px-4", - icon: "size-9", + default: 'h-9 px-4 py-2 has-[>svg]:px-3', + sm: 'h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5', + lg: 'h-10 rounded-md px-6 has-[>svg]:px-4', + icon: 'size-9', }, }, defaultVariants: { - variant: "default", - size: "default", + variant: 'default', + size: 'default', }, } -) +); function Button({ className, @@ -40,19 +39,24 @@ function Button({ size, asChild = false, ...props -}: React.ComponentProps<"button"> & +}: React.ComponentProps<'button'> & VariantProps & { - asChild?: boolean + asChild?: boolean; }) { - const Comp = asChild ? Slot : "button" + const Comp = asChild ? Slot : 'button'; return ( - ) + ); } -export { Button, buttonVariants } +export { Button, buttonVariants }; diff --git a/apps/docs/package.json b/apps/docs/package.json index d828824a8..3e472eeb1 100644 --- a/apps/docs/package.json +++ b/apps/docs/package.json @@ -12,8 +12,10 @@ }, "dependencies": { "@pierre/diff-ui": "workspace:*", + "@pierre/sync-ui-core": "workspace:*", + "@pierre/sync-ui-hooks": "workspace:*", "@radix-ui/react-label": "catalog:", - "@radix-ui/react-slot": "^1.2.3", + "@radix-ui/react-slot": "catalog:", "class-variance-authority": "catalog:", "clsx": "catalog:", "fumadocs-core": "catalog:", diff --git a/apps/docs/public/r/git-platform-sync.json b/apps/docs/public/r/git-platform-sync.json index 7bbba1369..c893e1d05 100644 --- a/apps/docs/public/r/git-platform-sync.json +++ b/apps/docs/public/r/git-platform-sync.json @@ -4,13 +4,17 @@ "type": "registry:component", "title": "Git Platform Sync", "description": "A component that implements repo syncing between code.storage and git platforms like GitHub.", + "dependencies": [ + "@pierre/sync-ui-core", + "@pierre/sync-ui-hooks" + ], "registryDependencies": [ "button" ], "files": [ { - "path": "registry/blocks/git-platform-sync/git-platform-sync.tsx", - "content": "import { Button } from '@/components/ui/button';\n\nexport function GitPlatformSync() {\n return ;\n}\n", + "path": "registry/new-york/blocks/git-platform-sync/git-platform-sync.tsx", + "content": "import { Button } from '@/components/ui/button';\nimport { version as versionCore } from '@pierre/sync-ui-core';\nimport { version as versionHooks } from '@pierre/sync-ui-hooks';\n\nexport function GitPlatformSync() {\n console.log('versionCore', versionCore);\n console.log('versionHooks', versionHooks);\n return ;\n}\n", "type": "registry:component" } ] diff --git a/apps/docs/public/r/registry.json b/apps/docs/public/r/registry.json index ea6daa7d6..b647a3dee 100644 --- a/apps/docs/public/r/registry.json +++ b/apps/docs/public/r/registry.json @@ -9,9 +9,10 @@ "title": "Git Platform Sync", "description": "A component that implements repo syncing between code.storage and git platforms like GitHub.", "registryDependencies": ["button"], + "dependencies": ["@pierre/sync-ui-core", "@pierre/sync-ui-hooks"], "files": [ { - "path": "registry/blocks/git-platform-sync/git-platform-sync.tsx", + "path": "registry/new-york/blocks/git-platform-sync/git-platform-sync.tsx", "type": "registry:component" } ] diff --git a/apps/docs/registry.json b/apps/docs/registry.json index ea6daa7d6..b647a3dee 100644 --- a/apps/docs/registry.json +++ b/apps/docs/registry.json @@ -9,9 +9,10 @@ "title": "Git Platform Sync", "description": "A component that implements repo syncing between code.storage and git platforms like GitHub.", "registryDependencies": ["button"], + "dependencies": ["@pierre/sync-ui-core", "@pierre/sync-ui-hooks"], "files": [ { - "path": "registry/blocks/git-platform-sync/git-platform-sync.tsx", + "path": "registry/new-york/blocks/git-platform-sync/git-platform-sync.tsx", "type": "registry:component" } ] diff --git a/apps/docs/registry/blocks/git-platform-sync/git-platform-sync.tsx b/apps/docs/registry/blocks/git-platform-sync/git-platform-sync.tsx deleted file mode 100644 index 48adb7116..000000000 --- a/apps/docs/registry/blocks/git-platform-sync/git-platform-sync.tsx +++ /dev/null @@ -1,5 +0,0 @@ -import { Button } from '@/components/ui/button'; - -export function GitPlatformSync() { - return ; -} diff --git a/apps/docs/registry/new-york/blocks/git-platform-sync b/apps/docs/registry/new-york/blocks/git-platform-sync new file mode 120000 index 000000000..3c7d3ef12 --- /dev/null +++ b/apps/docs/registry/new-york/blocks/git-platform-sync @@ -0,0 +1 @@ +../../../../../packages/sync-ui-shadcn/blocks/git-platform-sync \ No newline at end of file diff --git a/bun.lock b/bun.lock index 01309c05e..ecadcf475 100644 --- a/bun.lock +++ b/bun.lock @@ -38,8 +38,10 @@ "version": "0.0.0", "dependencies": { "@pierre/diff-ui": "workspace:*", + "@pierre/sync-ui-core": "workspace:*", + "@pierre/sync-ui-hooks": "workspace:*", "@radix-ui/react-label": "catalog:", - "@radix-ui/react-slot": "^1.2.3", + "@radix-ui/react-slot": "catalog:", "class-variance-authority": "catalog:", "clsx": "catalog:", "fumadocs-core": "catalog:", @@ -108,14 +110,23 @@ "typescript": "catalog:", }, }, - "packages/sync-ui-react": { - "name": "@pierre/sync-ui-react", + "packages/sync-ui-shadcn": { + "name": "@pierre/sync-ui-shadcn", "version": "0.0.0", "dependencies": { "@pierre/sync-ui-core": "workspace:*", "@pierre/sync-ui-hooks": "workspace:*", + "@radix-ui/react-slot": "^1.2.3", + "class-variance-authority": "catalog:", + "clsx": "catalog:", + "lucide-react": "catalog:", + "react": "catalog:", + "react-dom": "catalog:", + "tailwind-merge": "catalog:", }, "devDependencies": { + "@types/react": "catalog:", + "@types/react-dom": "catalog:", "typescript": "catalog:", }, }, @@ -469,7 +480,7 @@ "@pierre/sync-ui-hooks": ["@pierre/sync-ui-hooks@workspace:packages/sync-ui-hooks"], - "@pierre/sync-ui-react": ["@pierre/sync-ui-react@workspace:packages/sync-ui-react"], + "@pierre/sync-ui-shadcn": ["@pierre/sync-ui-shadcn@workspace:packages/sync-ui-shadcn"], "@radix-ui/number": ["@radix-ui/number@1.1.1", "", {}, "sha512-MkKCwxlXTgz6CFoJx3pCwn07GKp36+aZyu/u2Ln2VrA5DcdyCZkASEDBTd8x5whTQQL5CiYf4prXKLcgQdv29g=="], diff --git a/packages/sync-ui-react/package.json b/packages/sync-ui-react/package.json deleted file mode 100644 index 0fbc19fd6..000000000 --- a/packages/sync-ui-react/package.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "@pierre/sync-ui-react", - "private": true, - "version": "0.0.0", - "type": "module", - "scripts": { - "build": "tsc --build", - "dev": "tsc --build --watch" - }, - "exports": { - ".": { - "import": "./src/index.ts", - "types": "./src/index.ts" - } - }, - "devDependencies": { - "typescript": "catalog:" - }, - "dependencies": { - "@pierre/sync-ui-core": "workspace:*", - "@pierre/sync-ui-hooks": "workspace:*" - } -} diff --git a/packages/sync-ui-react/src/index.ts b/packages/sync-ui-react/src/index.ts deleted file mode 100644 index 5e29e9cf1..000000000 --- a/packages/sync-ui-react/src/index.ts +++ /dev/null @@ -1 +0,0 @@ -export const version = '0.0.0'; diff --git a/packages/sync-ui-react/tsconfig.json b/packages/sync-ui-react/tsconfig.json deleted file mode 100644 index e06418654..000000000 --- a/packages/sync-ui-react/tsconfig.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "extends": "../../tsconfig.options.json", - "include": ["src/**/*"], - "compilerOptions": { - "outDir": "dist", - "emitDeclarationOnly": false, - "baseUrl": ".", - "rootDir": "src" - }, - "references": [ - { - "path": "../sync-ui-core" - }, - { - "path": "../sync-ui-hooks" - } - ] -} diff --git a/packages/sync-ui-shadcn/blocks/git-platform-sync/git-platform-sync.tsx b/packages/sync-ui-shadcn/blocks/git-platform-sync/git-platform-sync.tsx new file mode 100644 index 000000000..38022b11b --- /dev/null +++ b/packages/sync-ui-shadcn/blocks/git-platform-sync/git-platform-sync.tsx @@ -0,0 +1,9 @@ +import { Button } from '@/components/ui/button'; +import { version as versionCore } from '@pierre/sync-ui-core'; +import { version as versionHooks } from '@pierre/sync-ui-hooks'; + +export function GitPlatformSync() { + console.log('versionCore', versionCore); + console.log('versionHooks', versionHooks); + return ; +} diff --git a/packages/sync-ui-shadcn/components.json b/packages/sync-ui-shadcn/components.json new file mode 100644 index 000000000..620fd2727 --- /dev/null +++ b/packages/sync-ui-shadcn/components.json @@ -0,0 +1,21 @@ +{ + "$schema": "https://ui.shadcn.com/schema.json", + "style": "new-york", + "rsc": true, + "tsx": true, + "tailwind": { + "config": "", + "css": "components/gen.css", + "baseColor": "neutral", + "cssVariables": true, + "prefix": "" + }, + "aliases": { + "components": "@/components", + "utils": "@/lib/utils", + "ui": "@/components/ui", + "lib": "@/lib", + "hooks": "@/hooks" + }, + "iconLibrary": "lucide" +} diff --git a/packages/sync-ui-shadcn/components/ui/button.tsx b/packages/sync-ui-shadcn/components/ui/button.tsx new file mode 100644 index 000000000..ee5f70ac7 --- /dev/null +++ b/packages/sync-ui-shadcn/components/ui/button.tsx @@ -0,0 +1,55 @@ +import { cn } from '@/lib/utils'; +import { Slot } from '@radix-ui/react-slot'; +import { type VariantProps, cva } from 'class-variance-authority'; +import * as React from 'react'; + +const buttonVariants = cva( + 'inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0', + { + variants: { + variant: { + default: 'bg-primary text-primary-foreground hover:bg-primary/90', + destructive: + 'bg-destructive text-destructive-foreground hover:bg-destructive/90', + outline: + 'border border-input bg-background hover:bg-accent hover:text-accent-foreground', + secondary: + 'bg-secondary text-secondary-foreground hover:bg-secondary/80', + ghost: 'hover:bg-accent hover:text-accent-foreground', + link: 'text-primary underline-offset-4 hover:underline', + }, + size: { + default: 'h-10 px-4 py-2', + sm: 'h-9 rounded-md px-3', + lg: 'h-11 rounded-md px-8', + icon: 'h-10 w-10', + }, + }, + defaultVariants: { + variant: 'default', + size: 'default', + }, + } +); + +export interface ButtonProps + extends React.ButtonHTMLAttributes, + VariantProps { + asChild?: boolean; +} + +const Button = React.forwardRef( + ({ className, variant, size, asChild = false, ...props }, ref) => { + const Comp = asChild ? Slot : 'button'; + return ( + + ); + } +); +Button.displayName = 'Button'; + +export { Button, buttonVariants }; diff --git a/packages/sync-ui-shadcn/lib/utils.ts b/packages/sync-ui-shadcn/lib/utils.ts new file mode 100644 index 000000000..12acd2660 --- /dev/null +++ b/packages/sync-ui-shadcn/lib/utils.ts @@ -0,0 +1,8 @@ +import { type ClassValue, clsx } from 'clsx'; +import { twMerge } from 'tailwind-merge'; + +export function cn(...inputs: ClassValue[]) { + return twMerge(clsx(inputs)); +} + + diff --git a/packages/sync-ui-shadcn/package.json b/packages/sync-ui-shadcn/package.json new file mode 100644 index 000000000..8bc98b720 --- /dev/null +++ b/packages/sync-ui-shadcn/package.json @@ -0,0 +1,26 @@ +{ + "name": "@pierre/sync-ui-shadcn", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "tsc": "tsc --build", + "build": "tsc --build" + }, + "dependencies": { + "@pierre/sync-ui-core": "workspace:*", + "@pierre/sync-ui-hooks": "workspace:*", + "@radix-ui/react-slot": "^1.2.3", + "class-variance-authority": "catalog:", + "clsx": "catalog:", + "lucide-react": "catalog:", + "react": "catalog:", + "react-dom": "catalog:", + "tailwind-merge": "catalog:" + }, + "devDependencies": { + "@types/react": "catalog:", + "@types/react-dom": "catalog:", + "typescript": "catalog:" + } +} diff --git a/packages/sync-ui-shadcn/tsconfig.json b/packages/sync-ui-shadcn/tsconfig.json new file mode 100644 index 000000000..35ff80159 --- /dev/null +++ b/packages/sync-ui-shadcn/tsconfig.json @@ -0,0 +1,12 @@ +{ + "extends": "../../tsconfig.options.json", + "include": ["blocks/**/*", "components/**/*", "lib/**/*"], + "compilerOptions": { + "noEmit": true, + "lib": ["ES2020", "DOM", "DOM.Iterable"], + "baseUrl": ".", + "paths": { + "@/*": ["./*"] + } + } +} diff --git a/tsconfig.json b/tsconfig.json index e7756e794..f97cbf984 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -21,7 +21,7 @@ "path": "packages/sync-ui-hooks" }, { - "path": "packages/sync-ui-react" + "path": "packages/sync-ui-shadcn" } ] }