Package Structure
Relevant source files This document describes the configuration of the@ui8kit/core package, including entry points, module exports, dependencies, and distribution setup. It explains how the package.json configuration supports multiple integration methods (NPM installation, per-component installation via buildy-ui CLI, git submodules, and direct source copying).
For information about the build process that generates distribution files, see Build System. For details on the component registry system, see Component Registry.
Package Metadata
The package is configured as an ES module library targeting modern JavaScript environments.| Property | Value | Purpose |
|---|---|---|
name | @ui8kit/core | Scoped NPM package identifier |
version | 0.1.8 | Semantic version (MAJOR.MINOR.PATCH) |
type | "module" | Declares ES module format (not CommonJS) |
license | GPL-3.0 | Open source license |
homepage | https://buildy.tw/ | Documentation and tooling site |
sideEffects | false | Enables tree-shaking optimization |
type: "module" declaration package.json8 ensures all .js files are treated as ES modules, requiring explicit .js extensions in import statements. The sideEffects: false flag package.json30 indicates the package contains pure modules without side effects, allowing bundlers to safely remove unused code.
Sources: package.json1-30
Module Entry Points and Exports
The package defines a single default export entry point with dual-format resolution:Entry Point Resolution
main field package.json31 provides backward compatibility for older tools, while the exports field package.json33-37 provides modern conditional exports. The types condition ensures TypeScript resolves type definitions correctly for both resolution strategies.
All components are exported from a single barrel file at src/index.tsx which is compiled to dist/index.js This provides a unified import surface:
Distribution Files
The package distributes only essential files, configured via thefiles field:
Distribution Manifest
files array package.json39-43 explicitly includes only the compiled dist/ directory and documentation files. Source files in src/, build scripts, and development configuration are excluded from the published package.
The .gitignore file .gitignore9-10 excludes dist/ from version control, as it contains generated artifacts. During NPM publication, the build process generates dist/ and includes it in the package tarball.
Sources: package.json39-43 .gitignore9-10
Dependencies
Dependencies are organized into three categories based on when and how they are required:Runtime Dependencies
| Dependency | Version | Used By | Purpose |
|---|---|---|---|
class-variance-authority | ^0.7.1 | All components | CVA-based variant system |
clsx | ^2.1.1 | All components | Conditional className construction |
lucide-react | ^0.525.0 | Sheet, Accordion, DashLayout | Icon rendering (X, ChevronDown, etc.) |
react-resizable-panels | ^3.0.6 | DashLayout | Resizable sidebar panels |
tailwind-merge | ^3.3.1 | All components | Deduplicates conflicting Tailwind classes |
lucide-react src/registry.json54-55 and DashLayout lists both lucide-react and react-resizable-panels src/registry.json266-267
Peer Dependencies
Development Dependencies
Development dependencies package.json59-66 are used only during library development and testing:| Dependency | Version | Purpose |
|---|---|---|
react | ^19.1.0 | Development and testing |
react-dom | ^19.1.0 | Development and testing |
bun-types | ^1.1.29 | Bun runtime types |
typescript | ^5.6.3 | TypeScript compilation |
@babel/parser | ^7.28.4 | CVA extractor script |
@babel/traverse | ^7.28.4 | CVA extractor script |
peerDependencies and devDependencies. The devDependencies versions are used for local development, while peerDependencies declare compatibility requirements for consumers.
Sources: package.json48-66 src/registry.json54-55 src/registry.json266-267
Build Scripts
Thescripts section defines commands for development and publication workflows:
Build Script Flow
| Script | Command | Purpose |
|---|---|---|
build | tsc -p tsconfig.json | Compiles TypeScript to dist/ |
type-check | tsc --noEmit | Validates types without generating files |
lint | eslint src --ext .ts,.tsx | Checks code quality |
lint:fix | eslint src --ext .ts,.tsx --fix | Auto-fixes linting issues |
scan | bunx buildy-ui@latest scan | Updates component registry metadata |
build:r | bunx buildy-ui@latest build | Builds registry package |
publish | cd packages/registry && npm version patch && npm publish | Publishes to NPM |
build script package.json22 is the primary compilation command, generating ES2022 modules and TypeScript declarations in dist/. The scan script package.json26 updates src/registry.json with component metadata, enabling per-component installation via npx buildy-ui add [component].
Sources: package.json21-28
Integration Methods Supported
The package structure supports four distinct integration methods, each using different aspects of the package configuration:Integration Method Matrix
Method 1: Full NPM Installation
Uses the complete package configuration:- Resolves entry points via
mainandexportsfields package.json31-37 - Installs files specified in
filesarray package.json39-43 - Installs all runtime dependencies package.json48-54
- Requires peer dependencies package.json55-58
node_modules/@ui8kit/core/
Method 2: Per-Component Installation
Uses the component registry:- Reads component metadata from
src/registry.jsonsrc/registry.json3-276 - Installs only specified component files to
components/ui/orlayouts/ - Installs component-specific dependencies (e.g.,
lucide-reactfor Sheet)
npx buildy-ui add [component]
Method 3: Git Submodule
Uses repository URL:- Clones repository via
repository.urlpackage.json45 - Provides access to full source tree in
src/ - Requires manual dependency management
packages/@ui8kit/core/ (typical monorepo pattern)
Method 4: Direct Source Copy
Uses source files directly:- Copies
src/components/or specific components - Requires manual dependency installation
- Enables custom modifications
src/ directory
Sources: package.json31-58 src/registry.json1-281
Repository Configuration
Therepository field enables source code discovery and git-based integrations:
- Links NPM package to GitHub repository
- Enables
npm repocommand to open repository - Supports git submodule integration via
git submodule add https://github.com/ui8kit/core.git - Provides source code visibility for transparency (GPL-3.0 license requirement)
Publish Configuration
ThepublishConfig section controls NPM publication behavior:
access: "public" setting package.json67-69 is required for scoped packages (@ui8kit/core) to be publicly accessible on the NPM registry. Without this configuration, scoped packages default to private access.
Sources: package.json67-69