Skip to content
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

fix(next): ensure registry:ui components don't depend on themselves #1490

Merged
merged 7 commits into from
Nov 15, 2024
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
9 changes: 9 additions & 0 deletions sites/docs/scripts/build-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@ function writeFileWithDirs(

async function main() {
const registry = await buildRegistry();

const selfReferenced = registry.filter((item) => item.registryDependencies.includes(item.name));
const selfReferenceError = selfReferenced
.map((item) => `Registry item '${item.name}' depends on itself`)
.join("\n");
if (selfReferenceError) {
throw new Error(selfReferenceError);
}

const result = registrySchema.safeParse(registry);

if (!result.success) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
lang="ts"
generics="TData, TValue, TContext extends HeaderContext<TData, TValue> | CellContext<TData, TValue>"
>
import {
RenderComponentConfig,
RenderSnippetConfig,
} from "$lib/registry/default/ui/data-table/render-helpers.js";
import { RenderComponentConfig, RenderSnippetConfig } from "./render-helpers.js";
type Props = {
/** The cell or header field of the current cell's column definition. */
content?: TContext extends HeaderContext<TData, TValue>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import { ToggleGroup as ToggleGroupPrimitive } from "bits-ui";
import { getToggleGroupCtx } from "$lib/registry/default/ui/toggle-group/toggle-group.svelte";
import { getToggleGroupCtx } from "./toggle-group.svelte";
import { cn } from "$lib/utils.js";
import { type ToggleVariants, toggleVariants } from "$lib/registry/default/ui/toggle/index.js";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@
lang="ts"
generics="TData, TValue, TContext extends HeaderContext<TData, TValue> | CellContext<TData, TValue>"
>
import {
RenderComponentConfig,
RenderSnippetConfig,
} from "$lib/registry/new-york/ui/data-table/render-helpers.js";
import { RenderComponentConfig, RenderSnippetConfig } from "./render-helpers.js";

type Props = {
/** The cell or header field of the current cell's column definition. */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import { Select as SelectPrimitive, type WithoutChild } from "bits-ui";
import * as Select from "$lib/registry/new-york/ui/select/index.js";
import * as Select from "./index.js";
import { cn } from "$lib/utils.js";

let {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import { ToggleGroup as ToggleGroupPrimitive } from "bits-ui";
import { getToggleGroupCtx } from "$lib/registry/new-york/ui/toggle-group/toggle-group.svelte";
import { getToggleGroupCtx } from "./toggle-group.svelte";
import { cn } from "$lib/utils.js";
import { type ToggleVariants, toggleVariants } from "$lib/registry/new-york/ui/toggle/index.js";

Expand Down