Skip to content

cli readme.md docs added #81

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Aug 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ If you find this project useful, please consider [sponsoring me](https://github.

[![Sponsor](https://img.shields.io/badge/Sponsor-%F0%9F%92%96-pink)](https://github.com/sponsors/your-username) -->


## Maintainer

**Md Afsar Mahmud**
Expand Down
76 changes: 76 additions & 0 deletions src/cli/ README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Nurui CLI

Use the Nurui CLI to list and add components to your project.

---

## list

Use the `list` command to view all available components.

```bash
npx nurui list
```

Example output:

```
┌ Welcome to Nurui CLI
◇ 📦 Available components:

• gradient-button
• border-button
• shiny-card
• spotlight-card
• contact-form
• video-modal
• gradient-hero
• spotlight-hero
• animated-pricing
• project-showcase
└ ✨ End of list.
```

---

## add

Use the `add` command to add a component to your project.
Downloads the component and styles, creates `lib/utils`, and installs required dependencies.

```bash
npx nurui add <component-name>
```

Example:

```bash
npx nurui add gradient-button
```

> Note: The `add` command **requires** a component name.
> If you run `npx nurui add` without a name, the CLI prints usage and exits.

---

## How it works (behind the scenes)

When you run:

```bash
npx nurui add gradient-button
```

1. Fetches the component registry from GitHub (`registry-cli.json`).
2. Finds `gradient-button` in the registry.
3. Prompts you to choose **TypeScript (.tsx)** or **JavaScript (.jsx)**.
4. Downloads files from the repo:
- component files → `components/nurui/`
- styles (`.css`) → `components/nurui/styles/`

5. Ensures `lib/utils.ts` or `lib/utils.js` exists (adds `cn` helper using `clsx` + `tailwind-merge`).
6. If JavaScript selected, transpiles `.tsx` → `.jsx` (TypeScript + Prettier).
7. Detects your package manager (`yarn` / `pnpm` / `bun` / `npm`) and installs any required dependencies for that component.
8. Prints a success summary.