143 lines
2.8 KiB
Markdown
143 lines
2.8 KiB
Markdown
# Workspace Shared Packages
|
|
|
|
**Status**: 🚧 **In Development**
|
|
**Purpose**: Shared packages and libraries for workspace projects
|
|
**Last Updated**: 2025-01-27
|
|
|
|
---
|
|
|
|
## Overview
|
|
|
|
This monorepo contains shared packages and libraries used across multiple projects in the workspace. It enables code reuse, consistent patterns, and simplified dependency management.
|
|
|
|
---
|
|
|
|
## Packages
|
|
|
|
### @workspace/shared-types
|
|
**Status**: 🚧 Planned
|
|
**Purpose**: Common TypeScript types and interfaces
|
|
**Usage**: Used across dbis_core, the_order, Sankofa, and others
|
|
|
|
### @workspace/shared-utils
|
|
**Status**: 🚧 Planned
|
|
**Purpose**: Common utility functions
|
|
**Usage**: Used in 20+ projects
|
|
|
|
### @workspace/shared-config
|
|
**Status**: 🚧 Planned
|
|
**Purpose**: Shared configuration schemas and validation
|
|
**Usage**: All projects with configuration
|
|
|
|
### @workspace/shared-constants
|
|
**Status**: 🚧 Planned
|
|
**Purpose**: Shared constants and enums
|
|
**Usage**: DBIS projects, DeFi projects
|
|
|
|
### @workspace/api-client
|
|
**Status**: 🚧 Planned
|
|
**Purpose**: Common API client utilities
|
|
**Usage**: Frontend projects, API consumers
|
|
|
|
### @workspace/validation
|
|
**Status**: 🚧 Planned
|
|
**Purpose**: Zod schemas and validators
|
|
**Usage**: Multiple backend services
|
|
|
|
### @workspace/blockchain
|
|
**Status**: 🚧 Planned
|
|
**Purpose**: Blockchain utilities and helpers
|
|
**Usage**: Blockchain projects
|
|
|
|
---
|
|
|
|
## Getting Started
|
|
|
|
### Prerequisites
|
|
- Node.js >= 18.0.0
|
|
- pnpm >= 8.0.0
|
|
|
|
### Installation
|
|
|
|
```bash
|
|
# Install dependencies
|
|
pnpm install
|
|
|
|
# Build all packages
|
|
pnpm build
|
|
|
|
# Run tests
|
|
pnpm test
|
|
|
|
# Lint all packages
|
|
pnpm lint
|
|
```
|
|
|
|
### Using Packages
|
|
|
|
In your project's `package.json`:
|
|
|
|
```json
|
|
{
|
|
"dependencies": {
|
|
"@workspace/shared-types": "workspace:*",
|
|
"@workspace/shared-utils": "workspace:*"
|
|
}
|
|
}
|
|
```
|
|
|
|
---
|
|
|
|
## Development
|
|
|
|
### Creating a New Package
|
|
|
|
1. Create package directory: `packages/package-name/`
|
|
2. Add `package.json` with proper name (`@workspace/package-name`)
|
|
3. Implement package code
|
|
4. Add to workspace configuration
|
|
5. Build and test
|
|
|
|
### Publishing
|
|
|
|
Packages are published to private npm registry (Verdaccio or GitHub Packages).
|
|
|
|
```bash
|
|
# Build package
|
|
cd packages/package-name
|
|
pnpm build
|
|
|
|
# Publish
|
|
pnpm publish --registry=<registry-url>
|
|
```
|
|
|
|
---
|
|
|
|
## Structure
|
|
|
|
```
|
|
workspace-shared/
|
|
├── packages/ # Shared packages
|
|
│ ├── shared-types/
|
|
│ ├── shared-utils/
|
|
│ ├── shared-config/
|
|
│ └── ...
|
|
├── apps/ # Shared applications (if any)
|
|
├── tools/ # Development tools
|
|
├── package.json # Root package.json
|
|
├── pnpm-workspace.yaml
|
|
└── turbo.json # Turborepo configuration
|
|
```
|
|
|
|
---
|
|
|
|
## Related Documents
|
|
|
|
- [Dependency Consolidation Plan](../docs/DEPENDENCY_CONSOLIDATION_PLAN.md)
|
|
- [Integration & Streamlining Plan](../INTEGRATION_STREAMLINING_PLAN.md)
|
|
|
|
---
|
|
|
|
**Last Updated**: 2025-01-27
|
|
|