From f32bcd596f9509c7aca3ab46dcb215e51ea7c3fc Mon Sep 17 00:00:00 2001 From: defiQUG Date: Mon, 9 Feb 2026 21:51:45 -0800 Subject: [PATCH] Initial commit: add .gitignore and README --- .github/workflows/ci.yml | 98 ++++++++++++++++++++++++++ .gitignore | 49 +++++++++++++ README.md | 107 +++++++++++++++++++++++++++++ package.json | 24 +++++++ packages/api-client/package.json | 29 ++++++++ packages/api-client/src/index.ts | 17 +++++ packages/shared-auth/package.json | 28 ++++++++ packages/shared-auth/src/index.ts | 19 +++++ packages/shared-types/package.json | 28 ++++++++ packages/shared-types/src/index.ts | 31 +++++++++ packages/shared-utils/package.json | 28 ++++++++ packages/shared-utils/src/index.ts | 17 +++++ pnpm-workspace.yaml | 4 ++ turbo.json | 27 ++++++++ 14 files changed, 506 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .gitignore create mode 100644 README.md create mode 100644 package.json create mode 100644 packages/api-client/package.json create mode 100644 packages/api-client/src/index.ts create mode 100644 packages/shared-auth/package.json create mode 100644 packages/shared-auth/src/index.ts create mode 100644 packages/shared-types/package.json create mode 100644 packages/shared-types/src/index.ts create mode 100644 packages/shared-utils/package.json create mode 100644 packages/shared-utils/src/index.ts create mode 100644 pnpm-workspace.yaml create mode 100644 turbo.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..fc306fe --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,98 @@ +name: DBIS Monorepo CI + +on: + push: + branches: [main, develop] + pull_request: + branches: [main, develop] + +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Build + run: pnpm build + + test: + name: Test + runs-on: ubuntu-latest + needs: build + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Test + run: pnpm test + + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Lint + run: pnpm lint + + type-check: + name: Type Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Type Check + run: pnpm type-check + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4c64e16 --- /dev/null +++ b/.gitignore @@ -0,0 +1,49 @@ +# Dependencies +node_modules/ +.pnpm-store/ +vendor/ + +# Package manager lock files (optional: uncomment to ignore) +# package-lock.json +# yarn.lock + +# Environment and secrets +.env +.env.local +.env.*.local +*.env.backup +.env.backup.* + +# Logs and temp +*.log +logs/ +*.tmp +*.temp +*.tmp.* + +# OS +.DS_Store +Thumbs.db + +# IDE +.vscode/ +.idea/ +*.swp +*.swo +*~ + +# Build / output +dist/ +build/ +.next/ +out/ +*.pyc +__pycache__/ +.eggs/ +*.egg-info/ +.coverage +htmlcov/ + +# Optional +.reports/ +reports/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..7e52db2 --- /dev/null +++ b/README.md @@ -0,0 +1,107 @@ +# DBIS Monorepo + +**Purpose**: Unified monorepo for all DBIS-related projects +**Status**: 🚧 Setup Complete - Ready for Migration + +--- + +## Overview + +This monorepo consolidates all DBIS-related projects into a single repository for improved code sharing, unified CI/CD, and streamlined development. + +--- + +## Structure + +``` +dbis_monorepo/ +├── packages/ # Shared packages +│ ├── shared-types # TypeScript types +│ ├── shared-utils # Utility functions +│ ├── shared-auth # Authentication utilities +│ └── api-client # API client +├── apps/ # Applications +│ └── (to be migrated) +├── tools/ # Development tools +│ └── (to be migrated) +├── infrastructure/ # Infrastructure as code +└── docs/ # Documentation +``` + +--- + +## Getting Started + +### Prerequisites + +- Node.js >= 18.0.0 +- pnpm >= 8.0.0 + +### Installation + +```bash +pnpm install +``` + +### Build + +```bash +pnpm build +``` + +### Test + +```bash +pnpm test +``` + +### Development + +```bash +pnpm dev +``` + +--- + +## Shared Packages + +### @dbis/shared-types +TypeScript types shared across DBIS projects. + +### @dbis/shared-utils +Utility functions shared across DBIS projects. + +### @dbis/shared-auth +Authentication utilities shared across DBIS projects. + +### @dbis/api-client +API client for DBIS services. + +--- + +## CI/CD + +Unified CI/CD is configured in `.github/workflows/ci.yml`: +- Build all packages +- Run tests +- Lint code +- Type check + +--- + +## Migration + +See `docs/DBIS_MIGRATION_CHECKLIST.md` for migration instructions. + +Use `scripts/migrate-dbis-project.sh` to help migrate projects. + +--- + +## Documentation + +- [Migration Plan](../docs/DBIS_MONOREPO_MIGRATION_PLAN.md) +- [Migration Checklist](../docs/DBIS_MIGRATION_CHECKLIST.md) + +--- + +**Status**: 🚧 Setup Complete - Ready for Project Migration diff --git a/package.json b/package.json new file mode 100644 index 0000000..2bc609d --- /dev/null +++ b/package.json @@ -0,0 +1,24 @@ +{ + "name": "dbis-monorepo", + "version": "1.0.0", + "private": true, + "description": "DBIS monorepo for all DBIS-related projects", + "scripts": { + "build": "turbo run build", + "test": "turbo run test", + "lint": "turbo run lint", + "type-check": "turbo run type-check", + "clean": "turbo run clean", + "dev": "turbo run dev" + }, + "devDependencies": { + "turbo": "^1.11.0", + "typescript": "^5.5.4" + }, + "engines": { + "node": ">=18.0.0", + "pnpm": ">=8.0.0" + }, + "packageManager": "pnpm@8.15.0" +} + diff --git a/packages/api-client/package.json b/packages/api-client/package.json new file mode 100644 index 0000000..ff92809 --- /dev/null +++ b/packages/api-client/package.json @@ -0,0 +1,29 @@ +{ + "name": "@dbis/api-client", + "version": "1.0.0", + "description": "API client for DBIS services", + "main": "./dist/index.js", + "types": "./dist/index.d.ts", + "scripts": { + "build": "tsc", + "test": "vitest", + "lint": "eslint src", + "type-check": "tsc --noEmit", + "clean": "rm -rf dist" + }, + "dependencies": { + "@workspace/api-client": "workspace:*", + "@dbis/shared-types": "workspace:*" + }, + "devDependencies": { + "typescript": "^5.5.4", + "vitest": "^1.2.0" + }, + "files": [ + "dist" + ], + "publishConfig": { + "access": "restricted" + } +} + diff --git a/packages/api-client/src/index.ts b/packages/api-client/src/index.ts new file mode 100644 index 0000000..9916924 --- /dev/null +++ b/packages/api-client/src/index.ts @@ -0,0 +1,17 @@ +/** + * @dbis/api-client + * API client for DBIS services + */ + +import { createApiClient } from '@workspace/api-client'; +import type { DBISConfig } from '@dbis/shared-types'; + +export function createDBISClient(config: DBISConfig) { + return createApiClient({ + baseURL: config.apiUrl, + headers: { + 'X-API-Key': config.apiKey, + }, + }); +} + diff --git a/packages/shared-auth/package.json b/packages/shared-auth/package.json new file mode 100644 index 0000000..9610a20 --- /dev/null +++ b/packages/shared-auth/package.json @@ -0,0 +1,28 @@ +{ + "name": "@dbis/shared-auth", + "version": "1.0.0", + "description": "Shared authentication utilities for DBIS projects", + "main": "./dist/index.js", + "types": "./dist/index.d.ts", + "scripts": { + "build": "tsc", + "test": "vitest", + "lint": "eslint src", + "type-check": "tsc --noEmit", + "clean": "rm -rf dist" + }, + "dependencies": { + "@workspace/shared-auth": "workspace:*" + }, + "devDependencies": { + "typescript": "^5.5.4", + "vitest": "^1.2.0" + }, + "files": [ + "dist" + ], + "publishConfig": { + "access": "restricted" + } +} + diff --git a/packages/shared-auth/src/index.ts b/packages/shared-auth/src/index.ts new file mode 100644 index 0000000..5ba6643 --- /dev/null +++ b/packages/shared-auth/src/index.ts @@ -0,0 +1,19 @@ +/** + * @dbis/shared-auth + * Shared authentication utilities for DBIS projects + */ + +// Re-export workspace shared auth +export * from '@workspace/shared-auth'; + +// DBIS-specific auth utilities +export function hasDBISRole(user: { roles: string[] }, role: string): boolean { + return user.roles.includes(role); +} + +export function requireDBISRole(user: { roles: string[] }, role: string): void { + if (!hasDBISRole(user, role)) { + throw new Error(`User does not have required role: ${role}`); + } +} + diff --git a/packages/shared-types/package.json b/packages/shared-types/package.json new file mode 100644 index 0000000..64f2242 --- /dev/null +++ b/packages/shared-types/package.json @@ -0,0 +1,28 @@ +{ + "name": "@dbis/shared-types", + "version": "1.0.0", + "description": "Shared TypeScript types for DBIS projects", + "main": "./dist/index.js", + "types": "./dist/index.d.ts", + "scripts": { + "build": "tsc", + "test": "vitest", + "lint": "eslint src", + "type-check": "tsc --noEmit", + "clean": "rm -rf dist" + }, + "dependencies": { + "@workspace/shared-types": "workspace:*" + }, + "devDependencies": { + "typescript": "^5.5.4", + "vitest": "^1.2.0" + }, + "files": [ + "dist" + ], + "publishConfig": { + "access": "restricted" + } +} + diff --git a/packages/shared-types/src/index.ts b/packages/shared-types/src/index.ts new file mode 100644 index 0000000..202455f --- /dev/null +++ b/packages/shared-types/src/index.ts @@ -0,0 +1,31 @@ +/** + * @dbis/shared-types + * Shared TypeScript types for DBIS projects + */ + +// Re-export workspace shared types +export * from '@workspace/shared-types'; + +// DBIS-specific types +export interface DBISConfig { + apiUrl: string; + apiKey: string; + environment: 'development' | 'staging' | 'production'; +} + +export interface DBISUser { + id: string; + email: string; + name: string; + roles: string[]; +} + +export interface DBISProject { + id: string; + name: string; + description: string; + status: 'active' | 'inactive' | 'archived'; + createdAt: Date; + updatedAt: Date; +} + diff --git a/packages/shared-utils/package.json b/packages/shared-utils/package.json new file mode 100644 index 0000000..e907480 --- /dev/null +++ b/packages/shared-utils/package.json @@ -0,0 +1,28 @@ +{ + "name": "@dbis/shared-utils", + "version": "1.0.0", + "description": "Shared utility functions for DBIS projects", + "main": "./dist/index.js", + "types": "./dist/index.d.ts", + "scripts": { + "build": "tsc", + "test": "vitest", + "lint": "eslint src", + "type-check": "tsc --noEmit", + "clean": "rm -rf dist" + }, + "dependencies": { + "@workspace/shared-utils": "workspace:*" + }, + "devDependencies": { + "typescript": "^5.5.4", + "vitest": "^1.2.0" + }, + "files": [ + "dist" + ], + "publishConfig": { + "access": "restricted" + } +} + diff --git a/packages/shared-utils/src/index.ts b/packages/shared-utils/src/index.ts new file mode 100644 index 0000000..7f40bce --- /dev/null +++ b/packages/shared-utils/src/index.ts @@ -0,0 +1,17 @@ +/** + * @dbis/shared-utils + * Shared utility functions for DBIS projects + */ + +// Re-export workspace shared utils +export * from '@workspace/shared-utils'; + +// DBIS-specific utilities +export function formatDBISDate(date: Date): string { + return date.toISOString().split('T')[0]; +} + +export function validateDBISEmail(email: string): boolean { + return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email) && email.endsWith('@dbis.example.com'); +} + diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml new file mode 100644 index 0000000..28fa9af --- /dev/null +++ b/pnpm-workspace.yaml @@ -0,0 +1,4 @@ +packages: + - 'packages/*' + - 'apps/*' + - 'tools/*' diff --git a/turbo.json b/turbo.json new file mode 100644 index 0000000..44c8357 --- /dev/null +++ b/turbo.json @@ -0,0 +1,27 @@ +{ + "$schema": "https://turbo.build/schema.json", + "pipeline": { + "build": { + "dependsOn": ["^build"], + "outputs": ["dist/**", ".next/**", "build/**"] + }, + "test": { + "dependsOn": ["build"], + "outputs": ["coverage/**"] + }, + "lint": { + "outputs": [] + }, + "type-check": { + "dependsOn": ["^build"], + "outputs": [] + }, + "clean": { + "cache": false + }, + "dev": { + "cache": false, + "persistent": true + } + } +}