@create-ui/cli 0.5.4 → 0.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-22VYY2DL.js +3 -0
- package/dist/{chunk-MK3CCMH4.js.map → chunk-22VYY2DL.js.map} +1 -1
- package/dist/{chunk-UVIUVCLG.js → chunk-TGYTOZ2K.js} +6 -6
- package/dist/{chunk-UVIUVCLG.js.map → chunk-TGYTOZ2K.js.map} +1 -1
- package/dist/chunk-ZI2BN2TD.js +18 -0
- package/dist/chunk-ZI2BN2TD.js.map +1 -0
- package/dist/icons/index.d.ts +3 -3
- package/dist/icons/index.js +1 -1
- package/dist/icons/index.js.map +1 -1
- package/dist/index.d.ts +360 -360
- package/dist/index.js +16 -16
- package/dist/index.js.map +1 -1
- package/dist/mcp/index.js +1 -1
- package/dist/registry/index.d.ts +2 -2
- package/dist/registry/index.js +1 -1
- package/dist/schema/index.d.ts +715 -715
- package/dist/skills/createui/SKILL.md +54 -53
- package/dist/skills/createui/agents/openai.yml +1 -1
- package/dist/skills/createui/cli.md +25 -93
- package/dist/skills/createui/customization.md +48 -31
- package/dist/skills/createui/evals/evals.json +12 -11
- package/dist/skills/createui/mcp.md +6 -32
- package/dist/skills/createui/rules/composition.md +112 -101
- package/dist/skills/createui/rules/forms.md +31 -24
- package/dist/skills/createui/rules/icons.md +41 -25
- package/dist/skills/createui/rules/styling.md +5 -9
- package/dist/utils/index.d.ts +1 -3
- package/dist/utils/index.js +1 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-EWAP55CF.js +0 -18
- package/dist/chunk-EWAP55CF.js.map +0 -1
- package/dist/chunk-MK3CCMH4.js +0 -3
- package/dist/skills/createui/contributing.md +0 -213
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
# Contributing to the Create UI Monorepo
|
|
2
|
-
|
|
3
|
-
This guide is for contributors working **inside** the Create UI monorepo — adding or editing
|
|
4
|
-
registry components, the CLI, or the documentation site. If you only want to consume Create UI in
|
|
5
|
-
your own app, see [`cli.md`](./cli.md) instead.
|
|
6
|
-
|
|
7
|
-
## Contents
|
|
8
|
-
|
|
9
|
-
- [Monorepo layout](#monorepo-layout)
|
|
10
|
-
- [Dev, build & quality commands](#dev-build--quality-commands)
|
|
11
|
-
- [Tests](#tests)
|
|
12
|
-
- [The registry](#the-registry)
|
|
13
|
-
- [Authoring a component](#authoring-a-component)
|
|
14
|
-
- [Scaffolding & validation](#scaffolding--validation)
|
|
15
|
-
- [Testing the CLI locally](#testing-the-cli-locally)
|
|
16
|
-
- [Website: three-layer architecture](#website-three-layer-architecture)
|
|
17
|
-
- [Component rules recap](#component-rules-recap)
|
|
18
|
-
- [Commit convention](#commit-convention)
|
|
19
|
-
|
|
20
|
-
## Monorepo layout
|
|
21
|
-
|
|
22
|
-
Create UI is a **pnpm 9.0.6 + Turbo** monorepo with two workspaces:
|
|
23
|
-
|
|
24
|
-
| Workspace | What it is | Stack |
|
|
25
|
-
|---|---|---|
|
|
26
|
-
| `apps/v4` | Documentation site & component showcase | Next.js 16 (App Router), React 19, Tailwind CSS v4 |
|
|
27
|
-
| `packages/createui` | The `createui` CLI published to npm | Commander.js, tsup (ESM-only) |
|
|
28
|
-
|
|
29
|
-
The site is also where the **registry** lives (`apps/v4/registry/`). The CLI reads that registry —
|
|
30
|
-
in the monorepo it points at the local dev server (`http://localhost:4000/r`).
|
|
31
|
-
|
|
32
|
-
## Dev, build & quality commands
|
|
33
|
-
|
|
34
|
-
Run all commands from the repo root. Package manager is **pnpm** — do not use npm or yarn.
|
|
35
|
-
|
|
36
|
-
```bash
|
|
37
|
-
# Develop
|
|
38
|
-
pnpm dev # everything, in parallel via Turbo
|
|
39
|
-
pnpm v4:dev # docs/showcase site only (port 4000)
|
|
40
|
-
pnpm createui:dev # CLI only, in watch mode
|
|
41
|
-
|
|
42
|
-
# Build
|
|
43
|
-
pnpm build # all workspaces
|
|
44
|
-
pnpm v4:build # site only
|
|
45
|
-
pnpm createui:build # CLI only
|
|
46
|
-
|
|
47
|
-
# Quality
|
|
48
|
-
pnpm check # lint + typecheck + format:check (run this before opening a PR)
|
|
49
|
-
pnpm lint # ESLint
|
|
50
|
-
pnpm lint:fix # ESLint with --fix
|
|
51
|
-
pnpm typecheck # TypeScript
|
|
52
|
-
pnpm format:write # Prettier write
|
|
53
|
-
pnpm format:check # Prettier check
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
## Tests
|
|
57
|
-
|
|
58
|
-
The test suite needs the v4 dev server running; `pnpm test` handles that for you.
|
|
59
|
-
|
|
60
|
-
```bash
|
|
61
|
-
pnpm test # starts the v4 dev server, then runs Vitest
|
|
62
|
-
pnpm test:dev # runs Vitest against an already-running server (no startup)
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
## The registry
|
|
66
|
-
|
|
67
|
-
Every UI component is defined under `apps/v4/registry/` and served to users through the CLI.
|
|
68
|
-
|
|
69
|
-
```
|
|
70
|
-
apps/v4/registry/
|
|
71
|
-
ui/ core UI components (button, select, dialog, …)
|
|
72
|
-
examples/ demos shown in the docs
|
|
73
|
-
blocks/ larger composed blocks
|
|
74
|
-
hooks/ custom React hooks
|
|
75
|
-
lib/ utilities (e.g. cn())
|
|
76
|
-
internal/ internal-only components (not exposed to users)
|
|
77
|
-
components/ shared registry components
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
Each subdirectory has a `_registry.ts` that exports a metadata array, and every array is aggregated
|
|
81
|
-
in `apps/v4/registry/registry.ts`.
|
|
82
|
-
|
|
83
|
-
In-repo registry entries **omit `content`** — `pnpm registry:build` injects each file's source when
|
|
84
|
-
it generates `apps/v4/public/r/<name>.json`. Real entry shapes:
|
|
85
|
-
|
|
86
|
-
```ts
|
|
87
|
-
// apps/v4/registry/ui/_registry.ts
|
|
88
|
-
{
|
|
89
|
-
name: "button",
|
|
90
|
-
type: "registry:ui",
|
|
91
|
-
dependencies: ["class-variance-authority", "radix-ui"],
|
|
92
|
-
files: [{ path: "ui/button.tsx", type: "registry:ui" }],
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
{
|
|
96
|
-
name: "select",
|
|
97
|
-
type: "registry:ui",
|
|
98
|
-
registryDependencies: ["field", "dropdown-menu"],
|
|
99
|
-
files: [{ path: "ui/select.tsx", type: "registry:ui" }],
|
|
100
|
-
}
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
The `type` values, file objects (`{ path, type, content?, target? }`), and item fields are defined by
|
|
104
|
-
the registry-item schema (`$schema: https://createui.co/schema/registry-item.json`). Use
|
|
105
|
-
`dependencies` for npm packages and `registryDependencies` for other registry items the component
|
|
106
|
-
needs.
|
|
107
|
-
|
|
108
|
-
## Authoring a component
|
|
109
|
-
|
|
110
|
-
1. Create `apps/v4/registry/ui/<name>.tsx`:
|
|
111
|
-
- use **`cva`** for variants and **`cn()`** (from `@/registry/lib/utils`) to merge classes
|
|
112
|
-
- put `data-slot="<name>"` on the root element
|
|
113
|
-
- support polymorphism with **`asChild`** via the Radix `Slot`
|
|
114
|
-
- type props as `React.ComponentProps<"el"> & VariantProps<typeof variants> & { … }`
|
|
115
|
-
- use a **named export** (`export { Name }`)
|
|
116
|
-
2. Add an entry to `apps/v4/registry/ui/_registry.ts` (shape above).
|
|
117
|
-
3. Add a demo under `apps/v4/registry/examples/<name>-demo.tsx` and register it in
|
|
118
|
-
`apps/v4/registry/examples/_registry.ts`.
|
|
119
|
-
4. Run **`pnpm registry:build`** to rebuild the registry (it also runs `lint:fix` + format and
|
|
120
|
-
regenerates the `public/r/*.json` files).
|
|
121
|
-
|
|
122
|
-
> Filenames are **kebab-case**; exports are PascalCase named exports. There is **no** `pnpm tokens:build` —
|
|
123
|
-
> tokens live in `apps/v4/styles/globals.css` and are edited directly.
|
|
124
|
-
|
|
125
|
-
## Scaffolding & validation
|
|
126
|
-
|
|
127
|
-
```bash
|
|
128
|
-
pnpm scaffold <name> # create a component + example + registry entry
|
|
129
|
-
pnpm scaffold <name> --existing # generate an example from an existing component (parses CVA)
|
|
130
|
-
pnpm scaffold <name> --dry-run # preview output without writing files
|
|
131
|
-
pnpm scaffold <name> --force # overwrite existing files
|
|
132
|
-
|
|
133
|
-
pnpm validate:registries # validate every _registry.ts against the schema
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
## Testing the CLI locally
|
|
137
|
-
|
|
138
|
-
The root `pnpm createui` script runs the **local CLI build** against `http://localhost:4000/r`, so
|
|
139
|
-
start the site first:
|
|
140
|
-
|
|
141
|
-
```bash
|
|
142
|
-
pnpm v4:dev # serves the local registry at http://localhost:4000/r
|
|
143
|
-
pnpm createui add -c ~/path/to/app # run the local CLI against a target app
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
`-c` (`--cwd`) points at the project you want to add components to.
|
|
147
|
-
|
|
148
|
-
## Website: three-layer architecture
|
|
149
|
-
|
|
150
|
-
Site work follows a strict three-layer model:
|
|
151
|
-
|
|
152
|
-
```
|
|
153
|
-
registry/ui/ primitives — SACROSANCT, never edited by site work
|
|
154
|
-
↓ composed by
|
|
155
|
-
components/site/ shared composites (reused across ≥2 route groups)
|
|
156
|
-
↓ composed by
|
|
157
|
-
app/(group)/_components/ route-local composites (used by one route group)
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
A new composite belongs in `components/site/` only if it is reused across **two or more** route
|
|
161
|
-
groups; otherwise it lives in the route group's `_components/`. If a primitive is missing, **ask
|
|
162
|
-
first** — never edit `registry/ui/` to make a page work.
|
|
163
|
-
|
|
164
|
-
The authoritative website guides live in **`mds/website/`** — start at
|
|
165
|
-
[`mds/website/BRIEF.md`](../../mds/website/BRIEF.md) (it is written in Turkish). Consult those guides
|
|
166
|
-
for any website task; do not duplicate them here.
|
|
167
|
-
|
|
168
|
-
## Component rules recap
|
|
169
|
-
|
|
170
|
-
These conventions keep every component consistent (see [`rules/styling.md`](./rules/styling.md),
|
|
171
|
-
[`rules/composition.md`](./rules/composition.md), and [`rules/icons.md`](./rules/icons.md) for the
|
|
172
|
-
full rules):
|
|
173
|
-
|
|
174
|
-
- **`data-slot`** on the root element (and on meaningful sub-parts) for semantic styling hooks.
|
|
175
|
-
- **`cn()`** for all class merging — never string-concatenate classes.
|
|
176
|
-
- **`cva`** for variant-based styling; hoist the variants object out of the component.
|
|
177
|
-
- **Semantic tokens** for color: `bg-primary-base`, `text-error-base`, `bg-weak`, `text-body` —
|
|
178
|
-
never `bg-background` / `text-foreground`-style names.
|
|
179
|
-
- **Radix UI** primitives for accessibility; polymorphism via **`asChild`** + Radix `Slot` only.
|
|
180
|
-
- **Focus is `outline-*`**, never `ring-*` (e.g. `focus-visible:outline-primary-700`).
|
|
181
|
-
- Intersection prop types: `React.ComponentProps<"button"> & VariantProps<…> & { … }`.
|
|
182
|
-
- **kebab-case** filenames, **named** exports.
|
|
183
|
-
|
|
184
|
-
A correct root element looks like:
|
|
185
|
-
|
|
186
|
-
```tsx
|
|
187
|
-
// Incorrect — ring focus, non-semantic token, anonymous default export
|
|
188
|
-
<button className={`${base} focus-visible:ring-2 bg-primary`}>{children}</button>
|
|
189
|
-
|
|
190
|
-
// Correct — data-slot, cn(), outline focus, semantic token
|
|
191
|
-
<Comp
|
|
192
|
-
data-slot="button"
|
|
193
|
-
className={cn(buttonVariants({ variant, appearance, size, className }))}
|
|
194
|
-
{...props}
|
|
195
|
-
/>
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
When you reference a component in an example, **read its source** at
|
|
199
|
-
`apps/v4/registry/ui/<name>.tsx` first — never guess props. For instance, `Button` takes
|
|
200
|
-
`variant` (`primary` | `neutral-solid` | `neutral-light` | `danger` | `success` | `inverse-solid` |
|
|
201
|
-
`inverse-light`), `appearance` (`solid` | `outline` | `ghost` | `soft`), `size`, `shape`, `loading`,
|
|
202
|
-
`iconOnly`, `leadingIcon`, `trailingIcon`, and `asChild` — there is no `variant="outline"` or
|
|
203
|
-
`variant="destructive"`.
|
|
204
|
-
|
|
205
|
-
## Commit convention
|
|
206
|
-
|
|
207
|
-
Conventional commits: `category(scope): message`.
|
|
208
|
-
|
|
209
|
-
Categories: `feat`, `fix`, `refactor`, `docs`, `build`, `test`, `ci`, `chore`.
|
|
210
|
-
|
|
211
|
-
```
|
|
212
|
-
feat(components): add loading prop to the button component
|
|
213
|
-
```
|