Skip to content

Commit 431248b

Browse files
committed
chore: test integration with shadcn CLI on production
1 parent a6f9a06 commit 431248b

File tree

261 files changed

+6069
-1726
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

261 files changed

+6069
-1726
lines changed

CONTRIBUTING.md

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@ All commands are declared in `package.json`.
5656
| `pnpm lint` | Run Biome (`biome check .`) to lint and format the codebase. |
5757
| `pnpm lint:fix` | Apply Biome auto-fixes. |
5858
| `pnpm typecheck` | Type-check the Next.js app (`tsconfig.json`). |
59-
| `pnpm typecheck:ui` | Strict type-check the UI components (`tsconfig.ui.json`). |
6059
| `pnpm prepare` | Installs Husky Git hooks (executed automatically by package managers that honour the `prepare` script). |
6160

6261
Useful helper scripts:
6362

6463
- `scripts/sync-css-tokens.sh`: Copies design tokens from `app/global.css` into `public/registry/css/index.css` for CLI consumption.
65-
- `scripts/build-components.sh`: Regenerates `public/registry/components.json` by Base64-encoding source components. Automatically fixes icon import paths before encoding.
64+
- `scripts/sync-icons.sh`: Synchronizes `registry/ui/icons.ts` with `public/registry/icons/icons.ts` for CLI consumption.
65+
- `scripts/build-components.sh`: Regenerates `public/registry/components.json` by Base64-encoding source components. Automatically fixes import paths before encoding.
6666

6767
Both scripts run automatically before every commit (see below), but you can execute them manually whenever you need to refresh the registry outputs.
6868

@@ -74,29 +74,22 @@ We use Husky to keep the registry in sync:
7474
.husky/pre-commit
7575
└── bash ./scripts/sync-css-tokens.sh
7676
bash ./scripts/build-components.sh
77-
git add public/registry/components.json public/registry/css/index.css
77+
bash ./scripts/sync-icons.sh
78+
git add public/registry/components.json public/registry/css/index.css public/registry/icons/icons.ts
7879
```
7980

8081
- **Never bypass the hook** unless you know exactly what you are doing—registry files must stay aligned with the source.
8182
- If you run into issues during development you can run the same scripts manually to diagnose problems.
8283

8384
## Component Architecture
8485

85-
All distributable components live in `app/components/ui`. A typical component folder looks like this:
86-
87-
```
88-
button/
89-
├── button.tsx // main component implementation
90-
├── button-demos.tsx // small interactive snippets used in docs
91-
└── index.ts // re-export surface
92-
```
86+
All distributable components live in `registry/ui` with component demos in `demos/`
9387

9488
Key conventions:
9589

9690
- **Client components**: Most UI elements opt into the React Client Component model (`'use client';`) because they rely on interactivity or hooks from `@ariakit/react`.
9791
- **Accessible primitives**: Wrap primitives from `@ariakit/react` (dialogs, tooltips, tabs, etc.). Follow their accessibility contract and expose ergonomic props on top.
9892
- **Variants & styling**: Use `class-variance-authority` (`cva`) alongside the `cn` helper (`lib/utils.ts`) to express visual variants. Token-aware Tailwind utility classes (`bg-card`, `text-foreground`, `shadow-lg`, etc.) ensure consistent styling.
99-
- **Exports**: `index.ts` should export every symbol that CLI consumers need, including demos that power documentation.
10093
- **Demos**: Keep `*-demos.tsx` small and focused. They render within documentation pages and help both design and a11y reviews.
10194

10295
When adding or refactoring components:
@@ -132,8 +125,8 @@ The Nocta CLI fetches everything it needs from `public/registry`:
132125

133126
`scripts/build-components.sh` controls the JSON artefact:
134127

135-
1. Collects every `.tsx` file under `app/components/ui/**` (excluding `*-demos.tsx`).
136-
2. Applies a Perl-based fix so icon imports (`@/app/components/ui/icons/icons`) are rewritten to the flat components structure that CLI writtes in.
128+
1. Collects every `.tsx` file under `registry/ui/**`.
129+
2. Applies a Perl-based fix so imports (`@/registry/ui/[componentName]`) are rewritten to (`@/components/ui/[componentName]`)n.
137130
3. Base64-encodes the content and writes the map.
138131

139132
Whenever you add, rename, or delete components, run this script (or rely on the pre-commit hook) so the CLI stays in sync.
@@ -153,11 +146,11 @@ Component docs live in `content/docs`. Each component usually has an MDX file at
153146
When introducing a new component:
154147

155148
1. Add or update the MDX documentation under `content/docs`. Use the existing pages as references for structure and tone.
156-
2. Import your demo components from `app/components/ui/<component>/<component>-demos.tsx`.
149+
2. Import your demo components from `demos/`.
157150
3. Register the documentation page in `content/docs/meta.json` under the appropriate category heading (e.g. `"---Form---"`). This controls sidebar grouping.
158151
4. Run `pnpm dev` and verify the documentation renders correctly.
159152

160-
> Remember to keep `mdx-components.tsx`, `content/docs/meta.json`, and `public/registry/registry.json` aligned so the docs, CLI, and registry all agree on the new component’s name and category.
153+
> Remember to keep `content/docs/meta.json`, and `public/registry/registry.json` aligned so the CLI, and registry all agree on the new component’s name and category.
161154
162155
## Accessibility (a11y) Expectations
163156

@@ -176,8 +169,8 @@ Accessibility is a core value of the library. Follow these practices:
176169
Before opening a PR, please:
177170

178171
1. Run `pnpm lint` and ensure Biome passes.
179-
2. Run `pnpm typecheck` and `pnpm typecheck:ui`.
180-
3. Run (or rely on pre-commit to run) `scripts/sync-css-tokens.sh` and `scripts/build-components.sh` if you touched tokens or components.
172+
2. Run `pnpm typecheck``.
173+
3. Run (or rely on pre-commit to run) `scripts/sync-css-tokens.sh`, `scripts/sync-css-icons.sh` `scripts/build-components.sh` if you touched tokens, icons or components.
181174
4. Manually verify a11y-critical interactions in the docs site (keyboard + screen reader spot checks).
182175
5. Update or add MDX docs and demos where relevant.
183176
6. Include screenshots or GIFs in the PR description when visual changes are significant.

app/(home)/_components/cta.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { GitHubLogoIcon } from '@radix-ui/react-icons';
22
import Link from 'next/link';
33
import type React from 'react';
4-
import { Button } from '@/app/components/ui/button';
4+
import { Button } from '@/registry/ui/button';
55

66
export default function CTA(): React.ReactElement {
77
return (

app/(home)/_components/faq.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
AccordionContent,
44
AccordionItem,
55
AccordionTrigger,
6-
} from '@/app/components/ui/accordion';
6+
} from '@/registry/ui/accordion';
77

88
const faq = [
99
{

app/(home)/_components/github-stars-button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { GitHubLogoIcon } from '@radix-ui/react-icons';
22
import Link from 'next/link';
3-
import { Button } from '@/app/components/ui/button';
3+
import { Button } from '@/registry/ui/button';
44
import { fetchGitHubStars } from '@/lib/github';
55

66
const GITHUB_REPO_URL = 'https://github.com/nocta-ui/nocta-ui';

app/(home)/_components/hero.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Link from 'next/link';
2-
import { Badge } from '@/app/components/ui/badge';
3-
import { Button } from '@/app/components/ui/button';
2+
import { Badge } from '@/registry/ui/badge';
3+
import { Button } from '@/registry/ui/button';
44
import { GithubStarsButton } from './github-stars-button';
55

66
export default function Hero() {

app/components/ui/accordion/index.ts

Lines changed: 0 additions & 17 deletions
This file was deleted.

app/components/ui/alert/alert-demos.tsx

Lines changed: 0 additions & 129 deletions
This file was deleted.

app/components/ui/alert/index.ts

Lines changed: 0 additions & 12 deletions
This file was deleted.

app/components/ui/area-chart/index.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.

app/components/ui/avatar/index.ts

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)