refactor: extract shared packages and clean up monorepo dependencies

- Add new packages: @lifeforge/configs, @lifeforge/federation,
  @lifeforge/log, @lifeforge/server-utils with their package.json
- Strip framework-specific deps (react, i18next, react-query, etc.)
  from shared/client/ui/server packages — these belong in individual apps
- Update workspace scripts to match renamed package directories
  (packages/log → @lifeforge/log, packages/server-utils → @lifeforge/server-utils)
- Add rollup-plugin-visualizer to client devDependencies
This commit is contained in:
melvinchia3636
2026-06-08 20:02:37 +08:00
parent 395dd045f4
commit 7f1b2f0593
9 changed files with 137 additions and 44 deletions

View File

@@ -23,43 +23,31 @@
"@dnd-kit/utilities": "^3.2.2",
"@iconify/react": "^6.0.2",
"@lifeforge/shared": "workspace:*",
"@lifeforge/federation": "workspace:*",
"@lifeforge/ui": "workspace:*",
"@tanstack/react-query": "^5.90.11",
"@types/node": "^24.7.2",
"@types/react-virtualized": "^9.22.3",
"@uidotdev/usehooks": "^2.4.1",
"babel-plugin-react-compiler": "^19.1.0-rc.2",
"clsx": "^2.1.1",
"copy-to-clipboard": "^3.3.3",
"crypto-js": "^4.2.0",
"daisyui": "^5.0.35",
"dayjs": "^1.11.13",
"dnd-core": "^16.0.1",
"eslint-plugin-react-compiler": "^19.1.0-rc.2",
"i18next": "^25.6.0",
"i18next-http-backend": "^2.7.3",
"lodash": "^4.17.21",
"lodash-es": "^4.17.22",
"opentype.js": "^1.3.4",
"postcss": "^8.5.3",
"pretty-bytes": "^7.1.0",
"qrcode.react": "^4.2.0",
"react": "^19.2.0",
"react-custom-scrollbars": "^4.2.1",
"react-dom": "^19.2.0",
"react-dropzone": "^14.3.8",
"react-error-boundary": "^6.0.0",
"react-grid-layout": "^1.5.2",
"react-i18next": "^15.5.1",
"react-router": "^7.9.4",
"react-toastify": "^11.0.5",
"react-virtualized": "^9.22.6",
"recharts": "^2.15.0",
"socket.io-client": "^4.8.1",
"tinycolor2": "^1.6.0",
"typescript": "^5.9.3",
"uuid": "^13.0.0",
"zod": "4.3.5"
"uuid": "^13.0.0"
},
"devDependencies": {
"@originjs/vite-plugin-federation": "^1.4.1",
@@ -71,6 +59,7 @@
"@types/tinycolor2": "^1.4.6",
"@vitejs/plugin-react": "^4.4.1",
"glob": "^13.0.0",
"rollup-plugin-visualizer": "^7.0.1",
"vite": "^7.0.5"
}
}

View File

@@ -22,16 +22,18 @@
],
"scripts": {
"forge": "bun run tools/src/index.ts",
"build-logger": "bun --cwd=packages/lifeforge-log run build",
"build-server-utils": "bun --cwd=packages/lifeforge-server-utils run build",
"build-configs": "bun --cwd=packages/configs run build",
"build-logger": "bun --cwd=packages/log run build",
"build-server-utils": "bun --cwd=packages/server-utils run build",
"build-shared": "bun --cwd=shared run build",
"build-ui": "bun --cwd=packages/ui run build",
"postinstall": "bun build-logger && bun build-server-utils && bun build-shared && bun build-ui"
"postinstall": "bun build-configs && bun build-logger && bun build-server-utils && bun build-shared && bun build-ui"
},
"keywords": [
"lifeforge"
],
"devDependencies": {
"@lifeforge/configs": "workspace:*",
"@eslint/js": "^9.26.0",
"@originjs/vite-plugin-federation": "^1.4.1",
"@trivago/prettier-plugin-sort-imports": "^5.2.2",

View File

@@ -0,0 +1,20 @@
{
"name": "@lifeforge/configs",
"version": "0.0.1",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"type": "module",
"module": "dist/index.js",
"typings": "dist/index.d.ts",
"scripts": {
"build": "vite build && tsc --emitDeclarationOnly"
},
"peerDependencies": {
"@originjs/vite-plugin-federation": "^1.4.1",
"@vitejs/plugin-react": "^4.4.1",
"vite": "^7.1.9"
},
"devDependencies": {
"typescript": "^5.9.3"
}
}

View File

@@ -0,0 +1,23 @@
{
"name": "@lifeforge/federation",
"version": "0.0.1",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"type": "module",
"module": "dist/index.js",
"typings": "dist/index.d.ts",
"scripts": {
"build": "tsc"
},
"dependencies": {
"@lifeforge/shared": "workspace:*",
"zod": "4.3.5"
},
"peerDependencies": {
"react": "^19.2.0"
},
"devDependencies": {
"@types/react": "^19.2.0",
"typescript": "^5.9.3"
}
}

34
packages/log/package.json Normal file
View File

@@ -0,0 +1,34 @@
{
"name": "@lifeforge/log",
"version": "0.1.0",
"description": "Unified logging package for LifeForge ecosystem",
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
},
"./cli": {
"types": "./dist/loggers/cliLogger.d.ts",
"import": "./dist/loggers/cliLogger.js"
}
},
"scripts": {
"build": "bun build ./src/index.ts ./src/loggers/cliLogger.ts --outdir=dist --target=node && bun tsc --project tsconfig.json",
"test": "vitest run",
"test:watch": "vitest"
},
"dependencies": {
"pino": "^9.6.0",
"pino-pretty": "^13.0.0",
"rotating-file-stream": "^3.2.7",
"chalk": "^5.4.0"
},
"devDependencies": {
"@types/node": "^25.0.6",
"typescript": "^5.9.0",
"vitest": "^4.0.0"
}
}

View File

@@ -0,0 +1,50 @@
{
"name": "@lifeforge/server-utils",
"version": "0.0.1",
"description": "Server SDK for LifeForge modules",
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"require": "./dist/index.js",
"import": "./dist/index.js",
"default": "./dist/index.js"
}
},
"scripts": {
"build": "rm -rf dist && bun build ./src/index.ts --outdir=dist --target=node && bun tsc --emitDeclarationOnly",
"types": "bun tsc --emitDeclarationOnly"
},
"dependencies": {
"chalk": "^5.6.2",
"crypto-js": "^4.2.0",
"express": "^4.21.2",
"form-data": "^4.0.0",
"groq-sdk": "^0.20.0",
"ical.js": "^2.1.0",
"lodash": "^4.17.21",
"multer": "^1.4.5-lts.1",
"openai": "^4.81.0",
"pdf2pic": "^3.1.5",
"@lifeforge/shared": "workspace:*",
"socket.io": "^4.8.3",
"tesseract.js": "^5.1.1",
"uuid": "^11.1.0",
"zod": "4.3.5",
"@lifeforge/log": "workspace:*"
},
"devDependencies": {
"@types/crypto-js": "^4.2.2",
"@types/express": "^4.17.23",
"@types/express-serve-static-core": "4",
"@types/lodash": "^4.17.21",
"@types/multer": "^1.4.13",
"typescript": "^5.8.3",
"vitest": "^4.1.7"
},
"peerDependencies": {
"pocketbase": "^0.26.2"
}
}

View File

@@ -39,45 +39,32 @@
"@radix-ui/react-checkbox": "^1.3.3",
"@radix-ui/react-dropdown-menu": "^2.1.16",
"@radix-ui/react-select": "^2.2.6",
"@tanstack/react-query": "^5.90.11",
"@uidotdev/usehooks": "^2.4.1",
"@uiw/react-color": "^2.9.0",
"@vanilla-extract/css": "^1.20.1",
"@vanilla-extract/recipes": "^0.5.7",
"@vanilla-extract/sprinkles": "^1.6.5",
"@vitejs/plugin-react": "^4.7.0",
"@yudiel/react-qr-scanner": "^2.3.1",
"clsx": "^2.1.1",
"color-sorter": "^6.2.0",
"crypto-js": "^4.2.0",
"culori": "^4.0.2",
"dayjs": "^1.11.18",
"dom-css": "^2.1.0",
"file-type-mime": "^0.4.7",
"i18next": "^25.6.0",
"i18next-http-backend": "^2.7.3",
"javascript-color-gradient": "^2.5.0",
"lodash": "^4.17.21",
"prop-types": "^15.8.1",
"raf": "^3.4.1",
"react": "^19.2.0",
"react-currency-input-field": "^3.10.0",
"react-datepicker": "^8.7.0",
"react-dom": "^19.2.0",
"react-dropzone": "^14.3.8",
"react-i18next": "^15.7.4",
"react-medium-image-zoom": "^5.4.0",
"react-number-format": "^5.4.5",
"react-otp-input": "^3.1.1",
"react-photo-album": "^2.4.1",
"react-router": "^7.9.4",
"react-toastify": "^11.0.5",
"react-tooltip": "^5.30.0",
"react-virtualized": "^9.22.6",
"rrule": "^2.8.1",
"tinycolor2": "^1.6.0",
"uuid": "^11.1.0",
"zod": "4.3.5",
"zustand": "^5.0.8"
},
"devDependencies": {

View File

@@ -35,13 +35,10 @@
"cors": "^2.8.5",
"crypto": "^1.0.1",
"crypto-js": "^4.2.0",
"dayjs": "^1.11.19",
"dotenv": "^16.5.0",
"express": "^4.21.2",
"express-rate-limit": "^7.4.1",
"groq-sdk": "^0.5.0",
"helmet": "^7.2.0",
"lodash": "^4.17.21",
"morgan": "^1.10.0",
"multer": "^1.4.5-lts.1",
"node-cache": "^5.1.2",
@@ -52,8 +49,7 @@
"socket.io": "^4.8.1",
"speakeasy": "^2.0.0",
"tesseract.js": "^6.0.1",
"uuid": "^9.0.1",
"zod": "4.3.5"
"uuid": "^9.0.1"
},
"devDependencies": {
"@eslint/js": "^9.31.0",

View File

@@ -21,21 +21,13 @@
"typescript": "^5.9.3"
},
"dependencies": {
"@tanstack/react-query": "^5.90.11",
"axios": "^1.12.2",
"clsx": "^2.1.1",
"crypto-js": "^4.2.0",
"culori": "^4.0.2",
"javascript-color-gradient": "^2.5.0",
"json-schema-to-ts": "^3.1.1",
"lodash": "^4.17.21",
"nuqs": "^2.7.1",
"react": "^19.2.0",
"react-i18next": "^15.1.1",
"react-router": "^7.9.4",
"react-toastify": "^11.0.5",
"socket.io-client": "^4.8.1",
"tinycolor2": "^1.6.0",
"zod": "4.3.5"
"socket.io-client": "^4.8.1"
}
}