diff --git a/apps/www/app/changelog/page.tsx b/apps/www/app/changelog/page.tsx
index 4d64c959..a8249e8c 100644
--- a/apps/www/app/changelog/page.tsx
+++ b/apps/www/app/changelog/page.tsx
@@ -1,7 +1,7 @@
import ChangelogDisplay from "components/Changelog/ChangelogDisplay";
import RetroGrid from "components/ui/Grid";
import { ChevronRight } from "lucide-react";
-const {title , description}: {title: string , description:string} = {
+const { title, description }: { title: string; description: string } = {
title: "Changelog - Any Iteration and Updates.",
description: "Changes and all jazzes will dumped here",
};
@@ -30,12 +30,11 @@ export const metadata = {
};
const ChangeLogPage = () => {
return (
-
-
+
+
-
@@ -44,19 +43,22 @@ const ChangeLogPage = () => {
-
- Changes Anouncements and
- All the jazz
- {" "}
-
- will be dumped here.
-
+
+ Changes{" "}
+ {" "}
+ {" "}
+
+ Anouncements
+ {" "}
+ and{" "}
+
+ All the jazz
+ {" "}
+ will be dumped here.
- We will update you on our iterations.
-
-
+ We will update you on our iterations.
@@ -73,13 +75,10 @@ const ChangeLogPage = () => {
-
-
-
);
};
diff --git a/apps/www/app/components/[slug]/page.tsx b/apps/www/app/components/[slug]/page.tsx
index 09414ef6..f14164ad 100644
--- a/apps/www/app/components/[slug]/page.tsx
+++ b/apps/www/app/components/[slug]/page.tsx
@@ -4,6 +4,8 @@ import matter from "gray-matter";
import PreviewApp from "components/ui/Preview/PreviewApp";
import sections from "sections/sections.json";
import { serialize } from "next-mdx-remote/serialize";
+import { ChevronRightIcon } from "lucide-react";
+import Link from "next/link";
type Params = {
slug: string;
@@ -74,11 +76,25 @@ export default async ({ params: { slug } }: { params: Params }) => {
};
})
// .sort((a, b) => a.created_at - b.created_at)
- );
+ );
return (
<>
-
diff --git a/apps/www/app/components/page.tsx b/apps/www/app/components/page.tsx
index 221624e1..04f139be 100644
--- a/apps/www/app/components/page.tsx
+++ b/apps/www/app/components/page.tsx
@@ -5,6 +5,8 @@ import { serialize } from "next-mdx-remote/serialize";
import MDXRemoteClient from "components/MDXRemoteClient";
import SupportedLibraries from "components/ui/SupportedLibraries";
import metatag from "metatag";
+import { Mdx } from "components/MdxComponent";
+import { allComponents } from "contentlayer/generated";
const {ogImage} = metatag
const title = "FarmUI - Introduction";
const description =
@@ -34,6 +36,9 @@ export const metadata = {
};
export default async () => {
+ const nativeComponnts = allComponents
+ const introDocs = allComponents.find((comp) => comp.slug === '/nativeComponents/intro')
+
const markdownWithMeta = fs.readFileSync(
path.join(process.cwd(), "content/intro.mdx"),
"utf-8"
@@ -44,10 +49,11 @@ export default async () => {
return (
<>
-
+ {/*
+ /> */}
>
);
diff --git a/apps/www/app/layout.tsx b/apps/www/app/layout.tsx
index c017a09a..2970751f 100644
--- a/apps/www/app/layout.tsx
+++ b/apps/www/app/layout.tsx
@@ -11,6 +11,8 @@ import Image from "next/image";
import bgback from "../public/bg-back.png";
import { ThemeProvider } from "components/ThemeProvider";
import { GeistSans } from "geist/font/sans";
+import { GeistMono } from "geist/font/mono";
+
import { Toaster } from "@/components/ui/toaster";
import Loglib from "@loglib/tracker/react";
import { Analytics } from "@vercel/analytics/react"
diff --git a/apps/www/components/MdxComponent.tsx b/apps/www/components/MdxComponent.tsx
index 41606d61..b6a534aa 100644
--- a/apps/www/components/MdxComponent.tsx
+++ b/apps/www/components/MdxComponent.tsx
@@ -9,7 +9,7 @@ export const components = {
h1: ({ className, ...props }) => (
),
diff --git a/apps/www/content/intro.mdx b/apps/www/content/intro.mdx
index 59882cf8..902afe19 100644
--- a/apps/www/content/intro.mdx
+++ b/apps/www/content/intro.mdx
@@ -22,16 +22,17 @@ And for the interactive components we use the following Libraries:
```bash
pnpm add @kinfe123/farm-ui
```
-2. Go to https://farmui.com/components and grab the id of the UI or component that you want
-3. Adding the UI or component based on that ID
+2. Adding the UI or component based on that ID
```bash
pnpm farm-ui add {id}
```
- **id** - being the id of the component from farmui.com
-4. Specify the directory where you want the componnt to be installed or it uses **components** dir by default.
-5. Finally you get to see the component or UI block inside of **farmui** directory nested on directory you have mentioned on step 4.
+ **id** - being the id of the component from the component section
+
+3. Specify the directory where you want the componnt to be installed or it uses **components** dir by default.
+
+4. Finally you get to see the component or UI block inside of **farmui** directory nested on directory you have mentioned on step 4.
diff --git a/apps/www/content/nativeComponents/intro.mdx b/apps/www/content/nativeComponents/intro.mdx
new file mode 100644
index 00000000..dd881e17
--- /dev/null
+++ b/apps/www/content/nativeComponents/intro.mdx
@@ -0,0 +1,44 @@
+---
+title: Intro to FARMUI components
+description: This will guide you on how to install the CLI tools and get started using FARMUI.
+lastModified: 2024-06-04
+---
+
+# What is FarmUI?
+
+
+FarmUI is a client-first and animation-rich UI component library that is built on top of several popular libraries, including Radix and Shadcn. It is designed to provide developers with a comprehensive set of UI components and tools that are optimized for performance and user experience.
+
+The "client-first" approach of FarmUI means that the library is primarily focused on delivering an exceptional user experience on the client-side, with a strong emphasis on smooth animations and responsive design. This makes FarmUI well-suited for building modern, web-based applications that require a high degree of interactivity and visual appeal.
+
+The library's use of Radix and Shadcn as its foundation provides developers with access to a wide range of primitive components and utilities, which can be easily customized and combined to create complex UI elements. This approach allows for a high degree of flexibility and control, while still maintaining a consistent and cohesive look and feel across the application.
+
+In addition to the Radix and Shadcn components, FarmUI also integrates with other primitive providers, such as Tailwind CSS, to offer a comprehensive set of styling and layout options. This ensures that developers can create visually stunning and highly functional user interfaces without having to reinvent the wheel.
+
+
+## Frameworks
+
+We Provide Support for Components Developed Using React, Vue.js, Svelte, HTML, and Alpine.js.
+And for the interactive components we use the following Libraries:
+
+
+## Installation Guide
+
+1. Install the npm package
+```bash
+pnpm add @kinfe123/farm-ui
+```
+
+2. Adding the UI or component based on that ID
+```bash
+pnpm farm-ui add {id}
+```
+
+**id** - being the id of the component from the component section
+
+3. Specify the directory where you want the componnt to be installed or it uses **components** dir by default.
+
+4. Finally you get to see the component or UI block inside of **farmui** directory nested on directory you have mentioned on step 4.
+
+
+
diff --git a/apps/www/contentlayer.config.js b/apps/www/contentlayer.config.js
index 60d09026..e107e5e0 100644
--- a/apps/www/contentlayer.config.js
+++ b/apps/www/contentlayer.config.js
@@ -170,6 +170,23 @@ export const Author = defineDocumentType(() => ({
computedFields,
}));
+export const Components = defineDocumentType(() => ({
+ name: "Components",
+ filePathPattern: `nativeComponents/**/*.mdx`,
+ contentType: "mdx",
+ fields: {
+ title: {
+ type: "string",
+ },
+ description: {
+ type: "string",
+ },
+ lastModified: {
+ type: "date",
+ },
+ },
+ computedFields,
+}));
export const Templates = defineDocumentType(() => ({
name: "Templates",
filePathPattern: `templates/**/*.mdx`,
@@ -183,46 +200,44 @@ export const Templates = defineDocumentType(() => ({
type: "string",
},
images: {
- type: "list",
- of: { type: "string" },
-
- required:true
+ type: "list",
+ of: { type: "string" },
+
+ required: true,
},
is_free: {
type: "boolean",
required: true,
},
price: {
- type: "string",
-
+ type: "string",
},
authors: {
-
type: "list",
of: { type: "string" },
},
date: {
- type:'date',
- required: true
+ type: "date",
+ required: true,
},
live_preview: {
- type:"string",
+ type: "string",
},
source_code: {
- type: "string",
+ type: "string",
},
stack_used: {
- type: "list",
- of: {type:"string"},
- required:true
- }
-},
+ type: "list",
+ of: { type: "string" },
+ required: true,
+ },
+ },
computedFields,
}));
export default makeSource({
contentDirPath: "./content",
- documentTypes: [Templates, Doc, Guide, Post, Author, Changelog],
+ documentTypes: [Templates, Doc, Guide, Post, Author, Changelog , Components],
mdx: {
remarkPlugins: [remarkGfm, codeImport],
rehypePlugins: [
diff --git a/apps/www/tailwind.config.js b/apps/www/tailwind.config.js
index 63bbb328..248e6ea6 100644
--- a/apps/www/tailwind.config.js
+++ b/apps/www/tailwind.config.js
@@ -69,6 +69,8 @@ module.exports = {
display: ["Cabinet Grotesk", ...defaultTheme.fontFamily.sans],
dmSans:"var(--font-dm-san)",
geist: ['var(--font-geist-sans)'],
+ geistMono: ['var(--font-geist-mono)'],
+
},
borderRadius: {
lg: "var(--radius)",
diff --git a/apps/www/viewport/template/index.ts b/apps/www/viewport/template/index.ts
index bb23b610..c02bf18d 100644
--- a/apps/www/viewport/template/index.ts
+++ b/apps/www/viewport/template/index.ts
@@ -11,7 +11,7 @@ const template:string = `
Document
-
+
diff --git a/packages/cli/:w b/packages/cli/:w
deleted file mode 100644
index 97dd79ce..00000000
--- a/packages/cli/:w
+++ /dev/null
@@ -1,198 +0,0 @@
-import "dotenv/config";
-import { existsSync, promises as fs } from "fs";
-import path from "path";
-import chalk from "chalk";
-import gradient from "gradient-string";
-import { toBlock, toBlockString } from "terminal-block-fonts";
-import { Command } from "commander";
-import ora from "ora";
-import { execa } from "execa";
-import prompts from "prompts";
-import { FARMUI_GRAFFITI } from "../utils/ascii-arts";
-import { logger } from "../utils/logger";
-import { custom, z } from "zod";
-import { getPackageManager } from "../utils/get-package-manager";
-import { framework_supports } from "../utils/get-suppoted";
-
-process.on("SIGINT", () => process.exit(0));
-process.on("SIGTERM", () => process.exit(0));
-
-const COMPONENT_REGISTERY_URL = "https://farmui-api.vercel.app/api/components";
-type CompToAddProps = {
- comp_path: string;
- comp_content: string;
-};
-const addCommandInput = z.object({
- id: z.string(),
- cwd: z.string(),
-});
-
-console.log(gradient("pink", "blue")(FARMUI_GRAFFITI));
-
-export const add = new Command()
-
- .name("add")
- .description("add a new component or UI from farmui")
- .argument("", "id of the component from https://farmui.com")
- // .option("--id", "id of the component")
- .option(
- "-c, --cwd ",
- "the working directory. defaults to the current directory.",
- process.cwd()
- )
- .action(async (id, opts) => {
- const options = addCommandInput.parse({
- id,
- ...opts,
- });
-
- const custom_cwd = path.resolve(options.cwd);
- const default_fm = framework_supports[0];
- let framework = default_fm.value; // the default one we supoort.
- if (!existsSync(custom_cwd)) {
- logger.error(`There is no ${custom_cwd} exists your paths.`);
- process.exit(0);
- }
- let defaultDir = "components";
-
- const custom_cwd_flag = process.cwd() === options.cwd;
- // already found the id and next will be finding the component id
- try {
- if (!custom_cwd_flag) {
- logger.info(`We are dumping the component inside of ${custom_cwd} `);
- } else {
- const { dir } = await prompts({
- type: "text",
- name: "dir",
- message: `A directory to dump the components? `,
- hint: "components ",
- });
- if (dir) {
- defaultDir = dir;
- }
- }
- const { fm } = await prompts({
- type: "select",
- name: "fm",
- message: "Which framework do you want to use with?",
- hint: "Space to select and Enter to submit.",
- instructions: false,
- choices: framework_supports.map((fm) => ({
- title: fm.name,
- value: fm.value,
- selected: fm.value === "react",
- })),
- });
- if (fm) {
- framework = fm;
- }
- if (framework !== "react") {
- logger.error(`We are not currently supporting ${fm} on farmui.com.`);
- logger.info(
- "Be a part of the community by adding an integration to your favorite framework, go for https://github.com/Kinfe123/farm-ui"
- );
- process.exit(0);
- }
- // should be prompting it for the component place to be stored
- const path_ = path.join(custom_cwd, defaultDir);
- const root_dir = path.join(path_, "/farmui");
-
- const comp_fetch = await fetch(COMPONENT_REGISTERY_URL!);
- let comp_db: any[] = await comp_fetch.json();
- const select_files_by_id = comp_db.find((x) => x.id === options.id);
- if (!select_files_by_id) {
- logger.error("No such component exists with in this ID.");
- process.exit(0);
- }
-
- const exist = existsSync(root_dir);
-
- if (exist) {
- // logic for existed
- const { proceed } = await prompts({
- type: "confirm",
- name: "proceed",
- message: `Ready to install components and dependencies. Proceed?`,
- initial: true,
- });
-
- if (!proceed) {
- logger.info(
- "Make sure you have the right path to dump the components"
- );
- process.exit(0);
- }
- } else {
- await fs.mkdir(root_dir, { recursive: true });
- }
- const path_to_add: CompToAddProps[] = [];
- // for now , the content we will support will be react based , toll we have updated the ednpoint
- const root_comp_name = select_files_by_id.files[0].root.name;
- const root_comp_content =
- select_files_by_id.files[0].root.contents[framework].content;
- const root_comp_path = path.join(root_dir, root_comp_name);
- let child_comp = [];
- if (select_files_by_id[1]) {
- child_comp = select_files_by_id.files[1].child;
- }
- path_to_add.push({
- comp_content: root_comp_content,
- comp_path: root_comp_path,
- });
-
- const child_path: string[] = [];
- const depends_on: any[] = child_comp;
- depends_on.map((dep) => {
- const child_comp_name = dep.name;
- const child_comp_content = dep.contents[framework].content;
- const child_comp_path = path.join(root_dir, child_comp_name);
- path_to_add.push({
- comp_content: child_comp_content,
- comp_path: child_comp_path,
- });
- });
- const spinner = ora(`Dumping your components...`);
- spinner.start();
- const dependencies: string[] = select_files_by_id.dependencies;
- if (!path_to_add) {
- logger.warn("No component to add");
- } else {
- path_to_add.map(async ({ comp_content, comp_path }) => {
- await fs.writeFile(`${comp_path}.tsx`, comp_content);
- });
- }
- const packageManager = await getPackageManager(custom_cwd);
- if (dependencies?.length) {
- await execa(`${packageManager}`, ["install", ...dependencies], {
- cwd: process.cwd(),
- });
- }
- spinner.stop();
- if (dependencies.length) {
- logger.info(`Dependencies - ${dependencies.length} added`);
- dependencies.map((dep) => {
- logger.success(` + ${dep}`);
- });
- }
- if (path_to_add) {
- const path_for_comp = root_dir.split("/");
- const last_two =
- path_for_comp[path_for_comp.length - 2] +
- "/" +
- path_for_comp[path_for_comp.length - 1];
-
- logger.info(
- `Components - ${path_to_add.length} added inside of ${last_two}`
- );
- path_to_add.map((comps) => {
- const comp_names = comps.comp_path.split("/");
- const comp_name = comp_names[comp_names.length - 1];
- logger.success(` + ${comp_name}`);
- });
- }
- spinner.succeed("Successfully installed");
- } catch (err) {
- logger.error("Error has occured!");
- console.log("Error: ", err);
- }
- });
diff --git a/packages/cli/dist/index.js b/packages/cli/dist/index.js
index c463020c..fb09f4d8 100644
--- a/packages/cli/dist/index.js
+++ b/packages/cli/dist/index.js
@@ -1,12 +1,12 @@
-import"dotenv/config";import{Command as H}from"commander";import"dotenv/config";import{existsSync as P,promises as S}from"fs";import d from"path";import N from"gradient-string";import{Command as U}from"commander";import D from"ora";import{execa as J}from"execa";import y from"prompts";var I=`
+import"dotenv/config";import{Command as H}from"commander";import"dotenv/config";import{existsSync as P,promises as R}from"fs";import d from"path";import N from"gradient-string";import{Command as U}from"commander";import D from"ora";import{execa as J}from"execa";import y from"prompts";var I=`
\u2591\u2592\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2592\u2591\u2592\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2592\u2593\u2588\u2593\u2592\u2591
\u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2592\u2593\u2588\u2593\u2592\u2591
\u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2592\u2593\u2588\u2593\u2592\u2591
\u2591\u2592\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2592\u2591\u2592\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2592\u2593\u2588\u2593\u2592\u2591
\u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2592\u2593\u2588\u2593\u2592\u2591
\u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2592\u2593\u2588\u2593\u2592\u2591
-\u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591 v0.0.1
+\u2591\u2592\u2593\u2588\u2593\u2592\u2591 \u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2592\u2591\u2591\u2592\u2593\u2588\u2593\u2592\u2591 v1.0.0
-`;import u from"chalk";var t={error(...e){console.log(u.red(...e))},warn(...e){console.log(u.yellow(...e))},info(...e){console.log(u.cyan(...e))},success(...e){console.log(u.green(...e))},break(){console.log("")}};import{z as k}from"zod";import{detect as G}from"@antfu/ni";async function b(e){let n=await G({programmatic:!0,cwd:e});return n==="yarn@berry"?"yarn":n==="pnpm@6"?"pnpm":n==="bun"?"bun":n??"npm"}var w=[{name:"React",value:"react"},{name:"Vue",value:"vue"},{name:"Svelte",value:"svelte"},{name:"Html",value:"html"}];process.on("SIGINT",()=>process.exit(0));process.on("SIGTERM",()=>process.exit(0));var B="https://farmui-api.vercel.app/api/components",O=k.object({id:k.string(),cwd:k.string()});console.log(N("pink","blue")(I));var R=new U().name("add").description("add a new component or UI from farmui").argument("","id of the component from https://farmui.com").option("-c, --cwd ","the working directory. defaults to the current directory.",process.cwd()).action(async(e,n)=>{let g=O.parse({id:e,...n}),c=d.resolve(g.cwd),f=w[0].value;P(c)||(t.error(`There is no ${c} exists your paths.`),process.exit(0));let v="components",M=process.cwd()===g.cwd;try{if(!M)t.info(`We are dumping the component inside of ${c} `);else{let{dir:o}=await y({type:"text",name:"dir",message:"A directory to dump the components? ",hint:"components "});o&&(v=o)}let{fm:a}=await y({type:"select",name:"fm",message:"Which framework do you want to use with?",hint:"Space to select and Enter to submit.",instructions:!1,choices:w.map(o=>({title:o.name,value:o.value,selected:o.value==="react"}))});a&&(f=a),f!=="react"&&(t.error(`We are not currently supporting ${a} on farmui.com.`),t.info("Be a part of the community by adding an integration to your favorite framework, go for https://github.com/Kinfe123/farm-ui"),process.exit(0));let $=d.join(c,v),i=d.join($,"/farmui"),s=(await(await fetch(B)).json()).find(o=>o.id===g.id);if(s||(t.error("No such component exists with in this ID."),process.exit(0)),P(i)){let{proceed:o}=await y({type:"confirm",name:"proceed",message:"Ready to install components and dependencies. Proceed?",initial:!0});o||(t.info("Make sure you have the right path to dump the components"),process.exit(0))}else await S.mkdir(i,{recursive:!0});let r=[],j=s.files[0].root.name,A=s.files[0].root.contents[f].content,C=d.join(i,j),x=[];s[1]&&(x=s.files[1].child),r.push({comp_content:A,comp_path:C});let Q=[];x.map(o=>{let m=o.name,_=o.contents[f].content,l=d.join(i,m);r.push({comp_content:_,comp_path:l})});let h=D("Dumping your components...");h.start();let p=s.dependencies;r?r.map(async({comp_content:o,comp_path:m})=>{await S.writeFile(`${m}.tsx`,o)}):t.warn("No component to add");let E=await b(c);if(p?.length&&await J(`${E}`,["install",...p],{cwd:process.cwd()}),h.stop(),p.length&&(t.info(`Dependencies - ${p.length} added`),p.map(o=>{t.success(` + ${o}`)})),r){let o=i.split("/"),m=o[o.length-2]+"/"+o[o.length-1];t.info(`Components - ${r.length} added inside of ${m}`),r.map(_=>{let l=_.comp_path.split("/"),F=l[l.length-1];t.success(` + ${F}`)})}h.succeed("Successfully installed")}catch(a){t.error("Error has occured!"),console.log("Error: ",a)}});import W from"path";import z from"fs-extra";function T(){let e=W.join("package.json");return z.readJSONSync(e)}process.on("SIGINT",()=>process.exit(0));process.on("SIGTERM",()=>process.exit(0));async function K(){let e=await T(),n=new H().name("farmui").description("Add natively farmed farmUI blocks ").version(e.version||"0.1.0","-v, --version","display the version number");n.addCommand(R),n.parse()}K();
+`;import u from"chalk";var t={error(...e){console.log(u.red(...e))},warn(...e){console.log(u.yellow(...e))},info(...e){console.log(u.cyan(...e))},success(...e){console.log(u.green(...e))},break(){console.log("")}};import{z as k}from"zod";import{detect as G}from"@antfu/ni";async function b(e){let n=await G({programmatic:!0,cwd:e});return n==="yarn@berry"?"yarn":n==="pnpm@6"?"pnpm":n==="bun"?"bun":n??"npm"}var w=[{name:"React",value:"react"},{name:"Vue",value:"vue"},{name:"Svelte",value:"svelte"},{name:"Html",value:"html"}];process.on("SIGINT",()=>process.exit(0));process.on("SIGTERM",()=>process.exit(0));var O="https://farmui-api.vercel.app/api/components",W=k.object({id:k.string(),cwd:k.string()});console.log(N("pink","blue")(I));var S=new U().name("add").description("add a new component or UI from farmui").argument("","id of the component from https://farmui.com/components").option("-c, --cwd ","the working directory. defaults to the current directory.",process.cwd()).action(async(e,n)=>{let g=W.parse({id:e,...n}),c=d.resolve(g.cwd),f=w[0].value;P(c)||(t.error(`There is no ${c} exists your paths.`),process.exit(0));let v="components",M=process.cwd()===g.cwd;try{if(!M)t.info(`We are dumping the components inside of ${c} `);else{let{dir:o}=await y({type:"text",name:"dir",message:"A directory to dump the components? ",hint:"components "});o&&(v=o)}let{fm:a}=await y({type:"select",name:"fm",message:"Which framework do you want to use with?",hint:"Space to select and Enter to submit.",instructions:!1,choices:w.map(o=>({title:o.name,value:o.value,selected:o.value==="react"}))});a&&(f=a),f!=="react"&&(t.error(`We are not currently supporting ${a} on https://farmui.com.`),t.info("Be a part of the community by adding an integration to your favorite framework, go for https://github.com/Kinfe123/farm-ui"),process.exit(0));let $=d.join(c,v),i=d.join($,"/farmui"),s=(await(await fetch(O)).json()).find(o=>o.id===g.id);if(s||(t.error("No such component exists with in this ID."),process.exit(0)),P(i)){let{proceed:o}=await y({type:"confirm",name:"proceed",message:"Ready to install components and dependencies. Proceed?",initial:!0});o||(t.info("Make sure you have the right path to dump the components"),process.exit(0))}else await R.mkdir(i,{recursive:!0});let r=[],j=s.files[0].root.name,A=s.files[0].root.contents[f].content,C=d.join(i,j),x=[];s[1]&&(x=s.files[1].child),r.push({comp_content:A,comp_path:C}),x.map(o=>{let m=o.name,_=o.contents[f].content,l=d.join(i,m);r.push({comp_content:_,comp_path:l})});let h=D("Dumping your components...");h.start();let p=s.dependencies;r?r.map(async({comp_content:o,comp_path:m})=>{await R.writeFile(`${m}.tsx`,o)}):t.warn("No component to add");let E=await b(c);if(p?.length&&await J(`${E}`,["install",...p],{cwd:process.cwd()}),h.stop(),p.length&&(t.info(`Dependencies - ${p.length} added`),p.map(o=>{t.success(` + ${o}`)})),r){let o=i.split("/"),m=o[o.length-2]+"/"+o[o.length-1];t.info(`Components - ${r.length} added inside of ${m}`),r.map(_=>{let l=_.comp_path.split("/"),F=l[l.length-1];t.success(` + ${F}`)})}h.succeed("Successfully installed")}catch(a){t.error("Error has occured!"),console.log("Error: ",a)}});import z from"path";import B from"fs-extra";function T(){let e=z.join("package.json");return B.readJSONSync(e)}process.on("SIGINT",()=>process.exit(0));process.on("SIGTERM",()=>process.exit(0));async function K(){let e=await T(),n=new H().name("farmui").description("Add natively farmed farmUI blocks ").version(e.version||"0.1.0","-v, --version","display the version number");n.addCommand(S),n.parse()}K();
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/packages/cli/dist/index.js.map b/packages/cli/dist/index.js.map
index 85857fb5..766f2be0 100644
--- a/packages/cli/dist/index.js.map
+++ b/packages/cli/dist/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/index.ts","../src/commands/add.ts","../src/utils/ascii-arts.ts","../src/utils/logger.ts","../src/utils/get-package-manager.ts","../src/utils/get-suppoted.ts","../src/utils/get-package-info.ts"],"sourcesContent":["import \"dotenv/config\"\nimport { Command } from \"commander\";\n\nimport { add } from \"./commands/add\";\nimport { getPackageInfo } from \"./utils/get-package-info\";\n\nprocess.on(\"SIGINT\", () => process.exit(0));\nprocess.on(\"SIGTERM\", () => process.exit(0));\n\nasync function main() {\n const packageInfo = await getPackageInfo();\n\n const program = new Command()\n .name(\"farmui\")\n .description(\"Add natively farmed farmUI blocks \")\n .version(\n packageInfo.version || \"0.1.0\",\n \"-v, --version\",\n \"display the version number\",\n );\n\n program.addCommand(add)\n\n program.parse();\n}\n\nmain();\n","import \"dotenv/config\";\nimport { existsSync, promises as fs } from \"fs\";\nimport path from \"path\";\nimport chalk from \"chalk\";\nimport gradient from \"gradient-string\";\nimport { toBlock, toBlockString } from \"terminal-block-fonts\";\nimport { Command } from \"commander\";\nimport ora from \"ora\";\nimport { execa } from \"execa\";\nimport prompts from \"prompts\";\nimport { FARMUI_GRAFFITI } from \"../utils/ascii-arts\";\nimport { logger } from \"../utils/logger\";\nimport { custom, z } from \"zod\";\nimport { getPackageManager } from \"../utils/get-package-manager\";\nimport { framework_supports } from \"../utils/get-suppoted\";\n\nprocess.on(\"SIGINT\", () => process.exit(0));\nprocess.on(\"SIGTERM\", () => process.exit(0));\n\nconst COMPONENT_REGISTERY_URL = \"https://farmui-api.vercel.app/api/components\";\ntype CompToAddProps = {\n comp_path: string;\n comp_content: string;\n};\nconst addCommandInput = z.object({\n id: z.string(),\n cwd: z.string(),\n});\n\nconsole.log(gradient(\"pink\", \"blue\")(FARMUI_GRAFFITI));\n\nexport const add = new Command()\n\n .name(\"add\")\n .description(\"add a new component or UI from farmui\")\n .argument(\"\", \"id of the component from https://farmui.com\")\n // .option(\"--id\", \"id of the component\")\n .option(\n \"-c, --cwd \",\n \"the working directory. defaults to the current directory.\",\n process.cwd()\n )\n .action(async (id, opts) => {\n const options = addCommandInput.parse({\n id,\n ...opts,\n });\n\n const custom_cwd = path.resolve(options.cwd);\n const default_fm = framework_supports[0];\n let framework = default_fm.value; // the default one we supoort.\n if (!existsSync(custom_cwd)) {\n logger.error(`There is no ${custom_cwd} exists your paths.`);\n process.exit(0);\n }\n let defaultDir = \"components\";\n\n const custom_cwd_flag = process.cwd() === options.cwd;\n // already found the id and next will be finding the component id\n try {\n if (!custom_cwd_flag) {\n logger.info(`We are dumping the component inside of ${custom_cwd} `);\n } else {\n const { dir } = await prompts({\n type: \"text\",\n name: \"dir\",\n message: `A directory to dump the components? `,\n hint: \"components \",\n });\n if (dir) {\n defaultDir = dir;\n }\n }\n const { fm } = await prompts({\n type: \"select\",\n name: \"fm\",\n message: \"Which framework do you want to use with?\",\n hint: \"Space to select and Enter to submit.\",\n instructions: false,\n choices: framework_supports.map((fm) => ({\n title: fm.name,\n value: fm.value,\n selected: fm.value === \"react\",\n })),\n });\n if (fm) {\n framework = fm;\n }\n if (framework !== \"react\") {\n logger.error(`We are not currently supporting ${fm} on farmui.com.`);\n logger.info(\n \"Be a part of the community by adding an integration to your favorite framework, go for https://github.com/Kinfe123/farm-ui\"\n );\n process.exit(0);\n }\n // should be prompting it for the component place to be stored\n const path_ = path.join(custom_cwd, defaultDir);\n const root_dir = path.join(path_, \"/farmui\");\n\n const comp_fetch = await fetch(COMPONENT_REGISTERY_URL!);\n let comp_db: any[] = await comp_fetch.json();\n const select_files_by_id = comp_db.find((x) => x.id === options.id);\n if (!select_files_by_id) {\n logger.error(\"No such component exists with in this ID.\");\n process.exit(0);\n }\n\n const exist = existsSync(root_dir);\n\n if (exist) {\n // logic for existed\n const { proceed } = await prompts({\n type: \"confirm\",\n name: \"proceed\",\n message: `Ready to install components and dependencies. Proceed?`,\n initial: true,\n });\n\n if (!proceed) {\n logger.info(\n \"Make sure you have the right path to dump the components\"\n );\n process.exit(0);\n }\n } else {\n await fs.mkdir(root_dir, { recursive: true });\n }\n const path_to_add: CompToAddProps[] = [];\n // for now , the content we will support will be react based , toll we have updated the ednpoint\n const root_comp_name = select_files_by_id.files[0].root.name;\n const root_comp_content =\n select_files_by_id.files[0].root.contents[framework].content;\n const root_comp_path = path.join(root_dir, root_comp_name);\n let child_comp = [];\n if (select_files_by_id[1]) {\n child_comp = select_files_by_id.files[1].child;\n }\n path_to_add.push({\n comp_content: root_comp_content,\n comp_path: root_comp_path,\n });\n\n const child_path: string[] = [];\n const depends_on: any[] = child_comp;\n depends_on.map((dep) => {\n const child_comp_name = dep.name;\n const child_comp_content = dep.contents[framework].content;\n const child_comp_path = path.join(root_dir, child_comp_name);\n path_to_add.push({\n comp_content: child_comp_content,\n comp_path: child_comp_path,\n });\n });\n const spinner = ora(`Dumping your components...`);\n spinner.start();\n const dependencies: string[] = select_files_by_id.dependencies;\n if (!path_to_add) {\n logger.warn(\"No component to add\");\n } else {\n path_to_add.map(async ({ comp_content, comp_path }) => {\n await fs.writeFile(`${comp_path}.tsx`, comp_content);\n });\n }\n const packageManager = await getPackageManager(custom_cwd);\n if (dependencies?.length) {\n await execa(`${packageManager}`, [\"install\", ...dependencies], {\n cwd: process.cwd(),\n });\n }\n spinner.stop();\n if (dependencies.length) {\n logger.info(`Dependencies - ${dependencies.length} added`);\n dependencies.map((dep) => {\n logger.success(` + ${dep}`);\n });\n }\n if (path_to_add) {\n const path_for_comp = root_dir.split(\"/\");\n const last_two =\n path_for_comp[path_for_comp.length - 2] +\n \"/\" +\n path_for_comp[path_for_comp.length - 1];\n\n logger.info(\n `Components - ${path_to_add.length} added inside of ${last_two}`\n );\n path_to_add.map((comps) => {\n const comp_names = comps.comp_path.split(\"/\");\n const comp_name = comp_names[comp_names.length - 1];\n logger.success(` + ${comp_name}`);\n });\n }\n spinner.succeed(\"Successfully installed\");\n } catch (err) {\n logger.error(\"Error has occured!\");\n console.log(\"Error: \", err);\n }\n });\n","export const FARMUI_GRAFFITI = `\n░▒▓████████▓▒░▒▓██████▓▒░░▒▓███████▓▒░░▒▓██████████████▓▒░░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ \n░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ \n░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ \n░▒▓██████▓▒░░▒▓████████▓▒░▒▓███████▓▒░░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ \n░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ \n░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ \n░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░░▒▓██████▓▒░░▒▓█▓▒░ v0.0.1 \n\n \n`","import chalk from \"chalk\"\n\nexport const logger = {\n error(...args: unknown[]) {\n console.log(chalk.red(...args))\n },\n warn(...args: unknown[]) {\n console.log(chalk.yellow(...args))\n },\n info(...args: unknown[]) {\n console.log(chalk.cyan(...args))\n },\n success(...args: unknown[]) {\n console.log(chalk.green(...args))\n },\n break() {\n console.log(\"\")\n },\n}\n","import { detect } from \"@antfu/ni\"\n\nexport async function getPackageManager(\n targetDir: string\n): Promise<\"yarn\" | \"pnpm\" | \"bun\" | \"npm\"> {\n const packageManager = await detect({ programmatic: true, cwd: targetDir })\n\n if (packageManager === \"yarn@berry\") return \"yarn\"\n if (packageManager === \"pnpm@6\") return \"pnpm\"\n if (packageManager === \"bun\") return \"bun\"\n\n return packageManager ?? \"npm\"\n}\n","export const framework_supports = [\n {\n name: \"React\",\n value: \"react\",\n\n },\n {\n name: \"Vue\",\n value: \"vue\",\n\n },\n {\n name: \"Svelte\",\n value: \"svelte\",\n\n },\n {\n name: \"Html\",\n value: \"html\",\n\n },\n]","import path from \"path\"\nimport fs from \"fs-extra\"\nimport { type PackageJson } from \"type-fest\"\n\nexport function getPackageInfo() {\n const packageJsonPath = path.join(\"package.json\")\n\n return fs.readJSONSync(packageJsonPath) as PackageJson\n}\n"],"mappings":"AAAA,MAAO,gB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Q,MAAM,CAChB,CAEAH,EAAK","names":["Command","existsSync","fs","path","gradient","Command","ora","execa","prompts","FARMUI_GRAFFITI","chalk","logger","args","z","detect","getPackageManager","targetDir","packageManager","framework_supports","COMPONENT_REGISTERY_URL","addCommandInput","z","gradient","FARMUI_GRAFFITI","add","Command","id","opts","options","custom_cwd","path","framework","framework_supports","existsSync","logger","defaultDir","custom_cwd_flag","dir","prompts","fm","path_","root_dir","select_files_by_id","x","proceed","fs","path_to_add","root_comp_name","root_comp_content","root_comp_path","child_comp","child_path","dep","child_comp_name","child_comp_content","child_comp_path","spinner","ora","dependencies","comp_content","comp_path","packageManager","getPackageManager","execa","path_for_comp","last_two","comps","comp_names","comp_name","err","path","fs","getPackageInfo","packageJsonPath","main","packageInfo","getPackageInfo","program","Command","add"]}
\ No newline at end of file
+{"version":3,"sources":["../src/index.ts","../src/commands/add.ts","../src/utils/ascii-arts.ts","../src/utils/logger.ts","../src/utils/get-package-manager.ts","../src/utils/get-suppoted.ts","../src/utils/get-package-info.ts"],"sourcesContent":["import \"dotenv/config\"\nimport { Command } from \"commander\";\n\nimport { add } from \"./commands/add\";\nimport { getPackageInfo } from \"./utils/get-package-info\";\n\nprocess.on(\"SIGINT\", () => process.exit(0));\nprocess.on(\"SIGTERM\", () => process.exit(0));\n\nasync function main() {\n const packageInfo = await getPackageInfo();\n\n const program = new Command()\n .name(\"farmui\")\n .description(\"Add natively farmed farmUI blocks \")\n .version(\n packageInfo.version || \"0.1.0\",\n \"-v, --version\",\n \"display the version number\",\n );\n\n program.addCommand(add)\n\n program.parse();\n}\n\nmain();\n","import \"dotenv/config\";\nimport { existsSync, promises as fs } from \"fs\";\nimport path from \"path\";\nimport gradient from \"gradient-string\";\nimport { Command } from \"commander\";\nimport ora from \"ora\";\nimport { execa } from \"execa\";\nimport prompts from \"prompts\";\nimport { FARMUI_GRAFFITI } from \"../utils/ascii-arts\";\nimport { logger } from \"../utils/logger\";\nimport { custom, z } from \"zod\";\nimport { getPackageManager } from \"../utils/get-package-manager\";\nimport { framework_supports } from \"../utils/get-suppoted\";\n\nprocess.on(\"SIGINT\", () => process.exit(0));\nprocess.on(\"SIGTERM\", () => process.exit(0));\n\nconst COMPONENT_REGISTERY_URL = \"https://farmui-api.vercel.app/api/components\";\ntype CompToAddProps = {\n comp_path: string;\n comp_content: string;\n};\nconst addCommandInput = z.object({\n id: z.string(),\n cwd: z.string(),\n});\n\nconsole.log(gradient(\"pink\", \"blue\")(FARMUI_GRAFFITI));\n\nexport const add = new Command()\n\n .name(\"add\")\n .description(\"add a new component or UI from farmui\")\n .argument(\n \"\",\n \"id of the component from https://farmui.com/components\"\n )\n // .option(\"--id\", \"id of the component\")\n .option(\n \"-c, --cwd \",\n \"the working directory. defaults to the current directory.\",\n process.cwd()\n )\n .action(async (id, opts) => {\n const options = addCommandInput.parse({\n id,\n ...opts,\n });\n\n const custom_cwd = path.resolve(options.cwd);\n const default_fm = framework_supports[0];\n let framework = default_fm.value; // the default one we supoort.\n if (!existsSync(custom_cwd)) {\n logger.error(`There is no ${custom_cwd} exists your paths.`);\n process.exit(0);\n }\n let defaultDir = \"components\";\n\n const custom_cwd_flag = process.cwd() === options.cwd;\n // already found the id and next will be finding the component id\n try {\n if (!custom_cwd_flag) {\n logger.info(`We are dumping the components inside of ${custom_cwd} `);\n } else {\n const { dir } = await prompts({\n type: \"text\",\n name: \"dir\",\n message: `A directory to dump the components? `,\n hint: \"components \",\n });\n if (dir) {\n defaultDir = dir;\n }\n }\n const { fm } = await prompts({\n type: \"select\",\n name: \"fm\",\n message: \"Which framework do you want to use with?\",\n hint: \"Space to select and Enter to submit.\",\n instructions: false,\n choices: framework_supports.map((fm) => ({\n title: fm.name,\n value: fm.value,\n selected: fm.value === \"react\",\n })),\n });\n if (fm) {\n framework = fm;\n }\n if (framework !== \"react\") {\n logger.error(\n `We are not currently supporting ${fm} on https://farmui.com.`\n );\n logger.info(\n \"Be a part of the community by adding an integration to your favorite framework, go for https://github.com/Kinfe123/farm-ui\"\n );\n process.exit(0);\n }\n // should be prompting it for directory the components to be stored (defaults to /components)\n const path_ = path.join(custom_cwd, defaultDir);\n const root_dir = path.join(path_, \"/farmui\");\n\n const comp_fetch = await fetch(COMPONENT_REGISTERY_URL!);\n let comp_db: any[] = await comp_fetch.json();\n const select_files_by_id = comp_db.find((x) => x.id === options.id);\n if (!select_files_by_id) {\n logger.error(\"No such component exists with in this ID.\");\n process.exit(0);\n }\n\n const exist = existsSync(root_dir);\n\n if (exist) {\n // logic for existing directory for componnts to be stored\n const { proceed } = await prompts({\n type: \"confirm\",\n name: \"proceed\",\n message: `Ready to install components and dependencies. Proceed?`,\n initial: true,\n });\n\n if (!proceed) {\n logger.info(\n \"Make sure you have the right path to dump the components\"\n );\n process.exit(0);\n }\n } else {\n await fs.mkdir(root_dir, { recursive: true });\n }\n const path_to_add: CompToAddProps[] = [];\n // for now , the content we will support will be react based , toll we have updated the ednpoint\n const root_comp_name = select_files_by_id.files[0].root.name;\n const root_comp_content =\n select_files_by_id.files[0].root.contents[framework].content;\n const root_comp_path = path.join(root_dir, root_comp_name);\n let child_comp = [];\n if (select_files_by_id[1]) {\n child_comp = select_files_by_id.files[1].child;\n }\n path_to_add.push({\n comp_content: root_comp_content,\n comp_path: root_comp_path,\n });\n\n const depends_on: any[] = child_comp;\n depends_on.map((dep) => {\n const child_comp_name = dep.name;\n const child_comp_content = dep.contents[framework].content;\n const child_comp_path = path.join(root_dir, child_comp_name);\n path_to_add.push({\n comp_content: child_comp_content,\n comp_path: child_comp_path,\n });\n });\n const spinner = ora(`Dumping your components...`);\n spinner.start();\n const dependencies: string[] = select_files_by_id.dependencies;\n if (!path_to_add) {\n logger.warn(\"No component to add\");\n } else {\n path_to_add.map(async ({ comp_content, comp_path }) => {\n await fs.writeFile(`${comp_path}.tsx`, comp_content);\n });\n }\n const packageManager = await getPackageManager(custom_cwd);\n if (dependencies?.length) {\n await execa(`${packageManager}`, [\"install\", ...dependencies], {\n cwd: process.cwd(),\n });\n }\n spinner.stop();\n if (dependencies.length) {\n logger.info(`Dependencies - ${dependencies.length} added`);\n dependencies.map((dep) => {\n logger.success(` + ${dep}`);\n });\n }\n if (path_to_add) {\n const path_for_comp = root_dir.split(\"/\");\n const last_two =\n path_for_comp[path_for_comp.length - 2] +\n \"/\" +\n path_for_comp[path_for_comp.length - 1];\n\n logger.info(\n `Components - ${path_to_add.length} added inside of ${last_two}`\n );\n path_to_add.map((comps) => {\n const comp_names = comps.comp_path.split(\"/\");\n const comp_name = comp_names[comp_names.length - 1];\n logger.success(` + ${comp_name}`);\n });\n }\n spinner.succeed(\"Successfully installed\");\n } catch (err) {\n logger.error(\"Error has occured!\");\n console.log(\"Error: \", err);\n }\n });\n","export const FARMUI_GRAFFITI = `\n░▒▓████████▓▒░▒▓██████▓▒░░▒▓███████▓▒░░▒▓██████████████▓▒░░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ \n░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ \n░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ \n░▒▓██████▓▒░░▒▓████████▓▒░▒▓███████▓▒░░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ \n░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ \n░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ \n░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░░▒▓██████▓▒░░▒▓█▓▒░ v1.0.0 \n\n \n`","import chalk from \"chalk\"\n\nexport const logger = {\n error(...args: unknown[]) {\n console.log(chalk.red(...args))\n },\n warn(...args: unknown[]) {\n console.log(chalk.yellow(...args))\n },\n info(...args: unknown[]) {\n console.log(chalk.cyan(...args))\n },\n success(...args: unknown[]) {\n console.log(chalk.green(...args))\n },\n break() {\n console.log(\"\")\n },\n}\n","import { detect } from \"@antfu/ni\"\n\nexport async function getPackageManager(\n targetDir: string\n): Promise<\"yarn\" | \"pnpm\" | \"bun\" | \"npm\"> {\n const packageManager = await detect({ programmatic: true, cwd: targetDir })\n\n if (packageManager === \"yarn@berry\") return \"yarn\"\n if (packageManager === \"pnpm@6\") return \"pnpm\"\n if (packageManager === \"bun\") return \"bun\"\n\n return packageManager ?? \"npm\"\n}\n","export const framework_supports = [\n {\n name: \"React\",\n value: \"react\",\n\n },\n {\n name: \"Vue\",\n value: \"vue\",\n\n },\n {\n name: \"Svelte\",\n value: \"svelte\",\n\n },\n {\n name: \"Html\",\n value: \"html\",\n\n },\n]","import path from \"path\"\nimport fs from \"fs-extra\"\nimport { type PackageJson } from \"type-fest\"\n\nexport function getPackageInfo() {\n const packageJsonPath = path.join(\"package.json\")\n\n return fs.readJSONSync(packageJsonPath) as PackageJson\n}\n"],"mappings":"AAAA,MAAO,gBACP,OAAS,WAAAA,MAAe,YCDxB,MAAO,gBACP,OAAS,cAAAC,EAAY,YAAYC,MAAU,KAC3C,OAAOC,MAAU,OACjB,OAAOC,MAAc,kBACrB,OAAS,WAAAC,MAAe,YACxB,OAAOC,MAAS,MAChB,OAAS,SAAAC,MAAa,QACtB,OAAOC,MAAa,UCPb,IAAMC,EAAkB;AAAA;AAAA;AAAA;AAAA;AA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AK,CAC5B,CAAC,GAECL,EAAa,CACf,IAAMiB,EAAgBtB,EAAS,MAAM,GAAG,EAClCuB,EACJD,EAAcA,EAAc,OAAS,CAAC,EACtC,IACAA,EAAcA,EAAc,OAAS,CAAC,EAExC7B,EAAO,KACL,gBAAgBY,EAAY,0BAA0BkB,GACxD,EACAlB,EAAY,IAAKmB,GAAU,CACzB,IAAMC,EAAaD,EAAM,UAAU,MAAM,GAAG,EACtCE,EAAYD,EAAWA,EAAW,OAAS,CAAC,EAClDhC,EAAO,QAAQ,MAAMiC,GAAW,CAClC,CAAC,EAEHZ,EAAQ,QAAQ,wBAAwB,CAC1C,OAASa,EAAP,CACAlC,EAAO,MAAM,oBAAoB,EACjC,QAAQ,IAAI,UAAWkC,CAAG,CAC5B,CACF,CAAC,EKvMH,OAAOC,MAAU,OACjB,OAAOC,MAAQ,WAGR,SAASC,GAAiB,CAC/B,IAAMC,EAAkBH,EAAK,KAAK,cAAc,EAEhD,OAAOC,EAAG,aAAaE,CAAe,CACxC,CNFA,QAAQ,GAAG,SAAU,IAAM,QAAQ,KAAK,CAAC,CAAC,EAC1C,QAAQ,GAAG,UAAW,IAAM,QAAQ,KAAK,CAAC,CAAC,EAE3C,eAAeC,GAAO,CACpB,IAAMC,EAAc,MAAMC,EAAe,EAEnCC,EAAU,IAAIC,EAAQ,EACzB,KAAK,QAAQ,EACb,YAAY,oCAAoC,EAChD,QACCH,EAAY,SAAW,QACvB,gBACA,4BACF,EAEFE,EAAQ,WAAWE,CAAG,EAEtBF,EAAQ,MAAM,CAChB,CAEAH,EAAK","names":["Command","existsSync","fs","path","gradient","Command","ora","execa","prompts","FARMUI_GRAFFITI","chalk","logger","args","z","detect","getPackageManager","targetDir","packageManager","framework_supports","COMPONENT_REGISTERY_URL","addCommandInput","z","gradient","FARMUI_GRAFFITI","add","Command","id","opts","options","custom_cwd","path","framework","framework_supports","existsSync","logger","defaultDir","custom_cwd_flag","dir","prompts","fm","path_","root_dir","select_files_by_id","x","proceed","fs","path_to_add","root_comp_name","root_comp_content","root_comp_path","child_comp","dep","child_comp_name","child_comp_content","child_comp_path","spinner","ora","dependencies","comp_content","comp_path","packageManager","getPackageManager","execa","path_for_comp","last_two","comps","comp_names","comp_name","err","path","fs","getPackageInfo","packageJsonPath","main","packageInfo","getPackageInfo","program","Command","add"]}
\ No newline at end of file
diff --git a/packages/cli/package.json b/packages/cli/package.json
index 5af26fb0..40c7ee06 100644
--- a/packages/cli/package.json
+++ b/packages/cli/package.json
@@ -1,6 +1,6 @@
{
"name": "@kinfe123/farm-ui",
- "version": "1.0.0",
+ "version": "1.0.1",
"description": "Add farmui components and building blocks",
"main": "index.js",
"publishConfig": {
@@ -61,6 +61,7 @@
"gradient-string": "^2.0.2",
"https-proxy-agent": "^6.2.0",
"lodash.template": "^4.5.0",
+ "lucide-react": "^0.378.0",
"node-fetch": "^3.3.0",
"ora": "^6.1.2",
"prompts": "^2.4.2",
diff --git a/packages/cli/src/commands/add.ts b/packages/cli/src/commands/add.ts
index 97dd79ce..320ec237 100644
--- a/packages/cli/src/commands/add.ts
+++ b/packages/cli/src/commands/add.ts
@@ -1,9 +1,7 @@
import "dotenv/config";
import { existsSync, promises as fs } from "fs";
import path from "path";
-import chalk from "chalk";
import gradient from "gradient-string";
-import { toBlock, toBlockString } from "terminal-block-fonts";
import { Command } from "commander";
import ora from "ora";
import { execa } from "execa";
@@ -33,7 +31,10 @@ export const add = new Command()
.name("add")
.description("add a new component or UI from farmui")
- .argument("", "id of the component from https://farmui.com")
+ .argument(
+ "",
+ "id of the component from https://farmui.com/components"
+ )
// .option("--id", "id of the component")
.option(
"-c, --cwd ",
@@ -59,7 +60,7 @@ export const add = new Command()
// already found the id and next will be finding the component id
try {
if (!custom_cwd_flag) {
- logger.info(`We are dumping the component inside of ${custom_cwd} `);
+ logger.info(`We are dumping the components inside of ${custom_cwd} `);
} else {
const { dir } = await prompts({
type: "text",
@@ -87,13 +88,15 @@ export const add = new Command()
framework = fm;
}
if (framework !== "react") {
- logger.error(`We are not currently supporting ${fm} on farmui.com.`);
+ logger.error(
+ `We are not currently supporting ${fm} on https://farmui.com.`
+ );
logger.info(
"Be a part of the community by adding an integration to your favorite framework, go for https://github.com/Kinfe123/farm-ui"
);
process.exit(0);
}
- // should be prompting it for the component place to be stored
+ // should be prompting it for directory the components to be stored (defaults to /components)
const path_ = path.join(custom_cwd, defaultDir);
const root_dir = path.join(path_, "/farmui");
@@ -108,7 +111,7 @@ export const add = new Command()
const exist = existsSync(root_dir);
if (exist) {
- // logic for existed
+ // logic for existing directory for componnts to be stored
const { proceed } = await prompts({
type: "confirm",
name: "proceed",
@@ -140,7 +143,6 @@ export const add = new Command()
comp_path: root_comp_path,
});
- const child_path: string[] = [];
const depends_on: any[] = child_comp;
depends_on.map((dep) => {
const child_comp_name = dep.name;
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 92705235..276fae21 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -322,6 +322,9 @@ importers:
lodash.template:
specifier: ^4.5.0
version: 4.5.0
+ lucide-react:
+ specifier: ^0.378.0
+ version: 0.378.0(react@18.3.1)
node-fetch:
specifier: ^3.3.0
version: 3.3.2