Skip to content

Commit 98807de

Browse files
committed
added required deps map for deps that aren't specified in their component files
1 parent b28c680 commit 98807de

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

apps/www/scripts/registry.ts

+10
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ const DEPENDENCIES = new Map<string, string[]>([
99
["formsnap", ["zod", "sveltekit-superforms"]],
1010
["cmdk-sv", ["bits-ui"]]
1111
]);
12+
// these are required dependencies for particular components
13+
// where the dependencies are not specified in the import declarations of the component file
14+
const REQUIRED_COMPONENT_DEPS = new Map<string, string[]>([
15+
["calendar", ["@internationalized/date"]]
16+
]);
1217
const REGISTRY_DEPENDENCY = "@/";
1318

1419
type ArrayItem<T> = T extends Array<infer X> ? X : never;
@@ -106,7 +111,12 @@ async function buildUIRegistry(componentPath: string, componentName: string) {
106111
// only grab deps from the svelte files
107112
if (dirent.name === "index.ts") continue;
108113
const deps = await getDependencies(join(componentPath, dirent.name));
114+
109115
deps.dependencies.forEach((dep) => dependencies.add(dep));
116+
REQUIRED_COMPONENT_DEPS.get(componentName)?.forEach((dep) =>
117+
dependencies.add(dep)
118+
);
119+
110120
deps.registryDependencies.forEach((dep) =>
111121
registryDependencies.add(dep)
112122
);

apps/www/static/registry/styles/default/calendar.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"name": "calendar",
33
"dependencies": [
4-
"bits-ui"
4+
"bits-ui",
5+
"@internationalized/date"
56
],
67
"registryDependencies": [
78
"button"

apps/www/static/registry/styles/new-york/calendar.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"name": "calendar",
33
"dependencies": [
4-
"bits-ui"
4+
"bits-ui",
5+
"@internationalized/date"
56
],
67
"registryDependencies": [
78
"button"

0 commit comments

Comments
 (0)