Skip to content
Open
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
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ When adding or modifying components, please ensure that:
Before you create a Pull Request, please check whether your commits comply with
the commit conventions used in this repository.

When you create a commit we kindly ask you to follow the convention
When you create a commit, we kindly ask you to follow the convention
`category(scope or module): message` in your commit message while using one of
the following categories:

Expand Down
28 changes: 28 additions & 0 deletions packages/shadcn/src/registry/fetcher.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,34 @@ const server = setupServer(
name: "external",
type: "registry:ui",
})
}),
http.get(`${REGISTRY_URL}/styles/new-york/button.json`, () => {
return HttpResponse.json({
name: "button",
type: "registry:ui",
dependencies: ["@radix-ui/react-slot"],
files: [
{
path: "registry/new-york/ui/button.tsx",
content: "// button component content",
type: "registry:ui",
},
],
})
}),
http.get(`${REGISTRY_URL}/styles/new-york/card.json`, () => {
return HttpResponse.json({
name: "card",
type: "registry:ui",
dependencies: ["@radix-ui/react-slot"],
files: [
{
path: "registry/new-york/ui/card.tsx",
content: "// card component content",
type: "registry:ui",
},
],
})
})
)

Expand Down
13 changes: 12 additions & 1 deletion packages/shadcn/test/utils/updaters/update-files.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { existsSync, promises as fs } from "fs"
import path from "path"
import { afterAll, afterEach, describe, expect, test, vi } from "vitest"
import { afterAll, afterEach, beforeEach, describe, expect, test, vi } from "vitest"
import neutral from "../../fixtures/colors/neutral.json"
import slate from "../../fixtures/colors/slate.json"
import * as registryApi from "../../../src/registry/api"

import { getConfig } from "../../../src/utils/get-config"
import {
Expand Down Expand Up @@ -39,6 +42,14 @@ vi.mock("fs", async () => {

vi.mock("prompts")

beforeEach(() => {
vi.spyOn(registryApi, "getRegistryBaseColor").mockImplementation(
async (baseColor: string) => {
return baseColor === "slate" ? slate : neutral
}
)
})

afterEach(async () => {
vi.clearAllMocks()
// Restore the actual implementation of existsSync after clearing mocks
Expand Down
2 changes: 1 addition & 1 deletion skills/shadcn/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Initializes shadcn/ui in an existing project or creates a new project (when `--n

| Flag | Short | Description | Default |
| ----------------------- | ----- | --------------------------------------------------------- | ------- |
| `--template <template>` | `-t` | Template (next, start, vite, next-monorepo, react-router) | — |
| `--template <template>` | `-t` | Starter template (next, start, vite, next-monorepo, react-router) | — |
| `--preset [name]` | `-p` | Preset configuration (named, code, or URL) | — |
| `--yes` | `-y` | Skip confirmation prompt | `true` |
| `--defaults` | `-d` | Use defaults (`--template=next --preset=base-nova`) | `false` |
Expand Down