Skip to content

Restructure registry installation target into dedicated subfolders #6

@alamenai

Description

@alamenai

Description

When users install a component via npx shadcn@latest add https://www.terrae.dev/map.json, all files land flat in a single components/ui/map/ folder — components, types, hooks, and utilities side by side.

Two problems with this:

  1. Flat structure — as the library grows, mixing components, hooks, types, and utilities in one folder becomes hard to navigate.
  2. Generic folder namemap/ can conflict with other libraries. We should use the brand name terrae/ instead.
  3. Wrong location for non-components — hooks, types, and utilities are not UI components and shouldn't live inside components/ui/.

Current structure

components/ui/map/
├── map.tsx
├── compass.tsx
├── marker.tsx
├── popup.tsx
├── types.ts
├── hooks.ts
├── map-library.ts
└── ...

Proposed structure

components/ui/terrae/
├── map.tsx
├── compass.tsx
├── marker.tsx
└── popup.tsx

hooks/terrae/
└── use-map.ts

lib/terrae/
└── map-library.ts

types/terrae/
└── types.ts

This follows the standard Next.js/shadcn convention:

  • components/ui/terrae/ — only actual React components
  • hooks/terrae/ — aligns with where shadcn projects already put hooks
  • lib/terrae/ — aligns with the existing lib/utils.ts pattern
  • types/terrae/ — pure type definitions

Each folder is namespaced under terrae/ to avoid conflicts with other libraries.

Impact

This requires updating the target field in every registry JSON file under public/. For example in map.json:

- "target": "components/ui/map/map.tsx"
+ "target": "components/ui/terrae/map.tsx"

- "target": "components/ui/map/types.ts"
+ "target": "types/terrae/types.ts"

- "target": "components/ui/map/hooks.ts"
+ "target": "hooks/terrae/use-map.ts"

- "target": "components/ui/map/map-library.ts"
+ "target": "lib/terrae/map-library.ts"

All internal imports within components also need to be updated to reflect the new paths.

Affected Component

All components — this is a cross-cutting structural change to the registry.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions