diff --git a/apps/www/registry/default/buidl/sign-message-button.tsx b/apps/www/registry/default/buidl/sign-message-button.tsx index 4d3395a..5d26005 100644 --- a/apps/www/registry/default/buidl/sign-message-button.tsx +++ b/apps/www/registry/default/buidl/sign-message-button.tsx @@ -15,32 +15,45 @@ interface SignMessageButtonProps extends Omit { const SignMessageButton = React.forwardRef< HTMLButtonElement, SignMessageButtonProps ->(({ message, onSuccess, className, children, disabled, displayError=true, ...props }, ref) => { - const { isLoading, isError, error, signMessage } = useSignMessage({ - message, - onSuccess, - }) +>( + ( + { + message, + onSuccess, + className, + children, + disabled, + displayError = true, + ...props + }, + ref + ) => { + const { isLoading, isError, error, signMessage } = useSignMessage({ + message, + onSuccess, + }) - return ( - <> - - {isError && displayError && ( - - )} - - ) -}) + return ( + <> + + {isError && displayError && ( + + )} + + ) + } +) SignMessageButton.displayName = "SignMessageButton" diff --git a/apps/www/registry/registry.ts b/apps/www/registry/registry.ts index 8c486cc..7016975 100644 --- a/apps/www/registry/registry.ts +++ b/apps/www/registry/registry.ts @@ -1,7 +1,7 @@ import { Registry } from "@/registry/schema" -const ui : Registry =[ - { +const ui: Registry = [ + { name: "button", type: "components:ui", dependencies: ["@radix-ui/react-slot"], @@ -13,7 +13,7 @@ const ui : Registry =[ dependencies: ["@radix-ui/react-dialog"], files: ["ui/dialog.tsx"], }, - { + { name: "toast", type: "components:ui", dependencies: ["@radix-ui/react-toast"], @@ -23,11 +23,10 @@ const ui : Registry =[ name: "skeleton", type: "components:ui", files: ["ui/skeleton.tsx"], - } + }, ] const buidl: Registry = [ - { name: "address", type: "components:buidl", @@ -101,21 +100,21 @@ const buidl: Registry = [ name: "ens-avatar", type: "components:buidl", dependencies: ["wagmi"], - registryDependencies: ["blockie","skeleton"], + registryDependencies: ["blockie", "skeleton"], files: ["buidl/ens-avatar.tsx"], }, { name: "ens-name", type: "components:buidl", dependencies: ["wagmi"], - registryDependencies: ["address","skeleton"], + registryDependencies: ["address", "skeleton"], files: ["buidl/ens-name.tsx"], }, { name: "ens-address", type: "components:buidl", dependencies: ["wagmi"], - registryDependencies: ["address","skeleton", "error-message"], + registryDependencies: ["address", "skeleton", "error-message"], files: ["buidl/ens-address.tsx"], }, { @@ -456,6 +455,4 @@ const example: Registry = [ }, ] -export const registry: Registry = [...buidl, - ...ui, - ...example] +export const registry: Registry = [...buidl, ...ui, ...example] diff --git a/apps/www/scripts/build-registry.ts b/apps/www/scripts/build-registry.ts index 45f8509..f4634e8 100644 --- a/apps/www/scripts/build-registry.ts +++ b/apps/www/scripts/build-registry.ts @@ -1,7 +1,7 @@ // @ts-nocheck import fs from "fs" -import template from "lodash.template" import path, { basename } from "path" +import template from "lodash.template" import { rimraf } from "rimraf" import { colorMapping, colors } from "../registry/colors" @@ -122,7 +122,9 @@ fs.writeFileSync( // ---------------------------------------------------------------------------- // Build registry/index.json. // ---------------------------------------------------------------------------- -const names = result.data.filter((item) => item.type === "components:buidl" || item.type === "components:ui") +const names = result.data.filter( + (item) => item.type === "components:buidl" || item.type === "components:ui" +) const registryJson = JSON.stringify(names, null, 2) rimraf.sync(path.join(REGISTRY_PATH, "index.json")) fs.writeFileSync(path.join(REGISTRY_PATH, "index.json"), registryJson, "utf8") diff --git a/packages/cli/src/commands/add.ts b/packages/cli/src/commands/add.ts index bb18132..0b954b0 100644 --- a/packages/cli/src/commands/add.ts +++ b/packages/cli/src/commands/add.ts @@ -1,3 +1,5 @@ +import { existsSync, promises as fs } from "fs" +import path from "path" import { getConfig } from "@/src/utils/get-config" import { getPackageManager } from "@/src/utils/get-package-manager" import { handleError } from "@/src/utils/handle-error" @@ -13,9 +15,7 @@ import { transform } from "@/src/utils/transformers" import chalk from "chalk" import { Command } from "commander" import { execa } from "execa" -import { existsSync, promises as fs } from "fs" import ora from "ora" -import path from "path" import prompts from "prompts" import * as z from "zod" @@ -77,13 +77,15 @@ export const add = new Command() message: "Which components would you like to add?", hint: "Space to select. A to toggle all. Enter to submit.", instructions: false, - choices: registryIndex.filter(({type})=>type === "components:buidl").map((entry) => ({ - title: entry.name, - value: entry.name, - selected: options.all - ? true - : options.components?.includes(entry.name), - })), + choices: registryIndex + .filter(({ type }) => type === "components:buidl") + .map((entry) => ({ + title: entry.name, + value: entry.name, + selected: options.all + ? true + : options.components?.includes(entry.name), + })), }) selectedComponents = components } diff --git a/packages/cli/src/commands/init.ts b/packages/cli/src/commands/init.ts index 9b8dbf6..2606b18 100644 --- a/packages/cli/src/commands/init.ts +++ b/packages/cli/src/commands/init.ts @@ -1,3 +1,5 @@ +import { existsSync, promises as fs } from "fs" +import path from "path" import { DEFAULT_COMPONENTS, DEFAULT_TAILWIND_CONFIG, @@ -20,10 +22,8 @@ import * as templates from "@/src/utils/templates" import chalk from "chalk" import { Command } from "commander" import { execa } from "execa" -import { existsSync, promises as fs } from "fs" import template from "lodash.template" import ora from "ora" -import path from "path" import prompts from "prompts" import * as z from "zod" diff --git a/packages/cli/src/utils/registry/index.ts b/packages/cli/src/utils/registry/index.ts index b86a740..e5fbac1 100644 --- a/packages/cli/src/utils/registry/index.ts +++ b/packages/cli/src/utils/registry/index.ts @@ -1,3 +1,4 @@ +import path from "path" import { Config } from "@/src/utils/get-config" import { registryBaseColorSchema, @@ -8,10 +9,10 @@ import { } from "@/src/utils/registry/schema" import { HttpsProxyAgent } from "https-proxy-agent" import fetch from "node-fetch" -import path from "path" import * as z from "zod" -const baseUrl = process.env.COMPONENTS_REGISTRY_URL ?? "https://buidl.turboeth.xyz" +const baseUrl = + process.env.COMPONENTS_REGISTRY_URL ?? "https://buidl.turboeth.xyz" const agent = process.env.https_proxy ? new HttpsProxyAgent(process.env.https_proxy) : undefined @@ -92,7 +93,7 @@ export async function resolveTree( tree.push(...dependencies) } } - + return tree.filter( (component, index, self) => self.findIndex((c) => c.name === component.name) === index diff --git a/packages/cli/src/utils/registry/schema.ts b/packages/cli/src/utils/registry/schema.ts index b5bfd8a..a928d48 100644 --- a/packages/cli/src/utils/registry/schema.ts +++ b/packages/cli/src/utils/registry/schema.ts @@ -6,7 +6,12 @@ export const registryItemSchema = z.object({ dependencies: z.array(z.string()).optional(), registryDependencies: z.array(z.string()).optional(), files: z.array(z.string()), - type: z.enum(["components:ui", "components:buidl", "components:component", "components:example"]), + type: z.enum([ + "components:ui", + "components:buidl", + "components:component", + "components:example", + ]), }) export const registryIndexSchema = z.array(registryItemSchema)