Skip to main content

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. The 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

The 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:
Sources: package.json31-37

Distribution Files

The package distributes only essential files, configured via the files field:

Distribution Manifest

The 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

Runtime dependencies package.json48-54 are bundled with the package and installed automatically: These dependencies appear in src/registry.json component metadata. For example, Sheet lists lucide-react src/registry.json54-55 and DashLayout lists both lucide-react and react-resizable-panels src/registry.json266-267

Peer Dependencies

Peer dependencies package.json55-58 must be provided by the consuming application:
The version range supports both React 18 and 19, providing flexibility for applications during the React 19 migration period. The library does not bundle React, avoiding version conflicts and duplicate React instances.

Development Dependencies

Development dependencies package.json59-66 are used only during library development and testing: React and ReactDOM appear in both 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

The scripts section defines commands for development and publication workflows:

Build Script Flow

The 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: Installed location: node_modules/@ui8kit/core/

Method 2: Per-Component Installation

Uses the component registry:
  • Reads component metadata from src/registry.json src/registry.json3-276
  • Installs only specified component files to components/ui/ or layouts/
  • Installs component-specific dependencies (e.g., lucide-react for Sheet)
Command: npx buildy-ui add [component]

Method 3: Git Submodule

Uses repository URL:
  • Clones repository via repository.url package.json45
  • Provides access to full source tree in src/
  • Requires manual dependency management
Installed location: 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
Installed location: Application’s src/ directory Sources: package.json31-58 src/registry.json1-281

Repository Configuration

The repository field enables source code discovery and git-based integrations:
This configuration package.json44-47:
  • Links NPM package to GitHub repository
  • Enables npm repo command 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)
Sources: package.json44-47

Publish Configuration

The publishConfig section controls NPM publication behavior:
The 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