Set up monorepo infra: Yarn 4 workspaces, tsc -b + dumble build, vitest
Workspaces are vendor/* (Cordis framework vendored as source) and packages/* (@deepseek-ai/dsh-* harness packages). Dev/test/demo run unbuilt via tsx + root tsconfig paths; build = tsc -b (declarations) + dumble (JS bundles); tests = vitest + vite-tsconfig-paths.
This commit is contained in:
6
.gitignore
vendored
6
.gitignore
vendored
@@ -1 +1,7 @@
|
|||||||
CLAUDE.local.md
|
CLAUDE.local.md
|
||||||
|
node_modules/
|
||||||
|
lib/
|
||||||
|
*.tsbuildinfo
|
||||||
|
.yarn/
|
||||||
|
yarn-error.log
|
||||||
|
examples/*/*.jsonl
|
||||||
|
|||||||
1
.yarnrc.yml
Normal file
1
.yarnrc.yml
Normal file
@@ -0,0 +1 @@
|
|||||||
|
nodeLinker: node-modules
|
||||||
28
package.json
Normal file
28
package.json
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
"name": "@deepseek-ai/dsh-root",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"private": true,
|
||||||
|
"type": "module",
|
||||||
|
"packageManager": "yarn@4.14.1",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=24"
|
||||||
|
},
|
||||||
|
"workspaces": [
|
||||||
|
"vendor/*",
|
||||||
|
"packages/*"
|
||||||
|
],
|
||||||
|
"scripts": {
|
||||||
|
"build": "tsc -b tsconfig.build.json && tsx scripts/build.ts",
|
||||||
|
"typecheck": "tsc -b tsconfig.build.json",
|
||||||
|
"test": "vitest run",
|
||||||
|
"demo": "node --expose-internals --import tsx examples/echo-agent/start.ts"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/node": "^25.3.5",
|
||||||
|
"dumble": "^0.2.3",
|
||||||
|
"tsx": "^4.22.4",
|
||||||
|
"typescript": "^6.0.3",
|
||||||
|
"vite-tsconfig-paths": "^6.1.1",
|
||||||
|
"vitest": "^4.1.8"
|
||||||
|
}
|
||||||
|
}
|
||||||
29
scripts/build.ts
Normal file
29
scripts/build.ts
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
import { execFileSync } from 'node:child_process'
|
||||||
|
import { existsSync } from 'node:fs'
|
||||||
|
import { resolve } from 'node:path'
|
||||||
|
|
||||||
|
// Bundle JS for every workspace package with dumble (tsc -b has already
|
||||||
|
// produced the .d.ts files; dumble reads each package's tsconfig/package.json).
|
||||||
|
const packages = [
|
||||||
|
'vendor/cosmokit',
|
||||||
|
'vendor/schemastery',
|
||||||
|
'vendor/cordis',
|
||||||
|
'vendor/loader',
|
||||||
|
'vendor/include',
|
||||||
|
'vendor/group',
|
||||||
|
'vendor/timer',
|
||||||
|
'vendor/hmr',
|
||||||
|
'vendor/logger-console',
|
||||||
|
'packages/llm',
|
||||||
|
'packages/session',
|
||||||
|
'packages/system-prompt',
|
||||||
|
'packages/tools',
|
||||||
|
'packages/agent',
|
||||||
|
'packages/agent-loop',
|
||||||
|
]
|
||||||
|
|
||||||
|
const root = resolve(import.meta.dirname, '..')
|
||||||
|
for (const path of packages) {
|
||||||
|
if (!existsSync(resolve(root, path, 'tsconfig.json'))) continue
|
||||||
|
execFileSync('node_modules/.bin/dumble', [path], { cwd: root, stdio: 'inherit' })
|
||||||
|
}
|
||||||
17
tsconfig.base.json
Normal file
17
tsconfig.base.json
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "es2024",
|
||||||
|
"module": "esnext",
|
||||||
|
"moduleResolution": "bundler",
|
||||||
|
"declaration": true,
|
||||||
|
"emitDeclarationOnly": true,
|
||||||
|
"composite": true,
|
||||||
|
"incremental": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"allowImportingTsExtensions": true,
|
||||||
|
"strict": true,
|
||||||
|
"noImplicitAny": false,
|
||||||
|
"types": ["node"]
|
||||||
|
}
|
||||||
|
}
|
||||||
20
tsconfig.build.json
Normal file
20
tsconfig.build.json
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"files": [],
|
||||||
|
"references": [
|
||||||
|
{ "path": "./vendor/cosmokit" },
|
||||||
|
{ "path": "./vendor/schemastery" },
|
||||||
|
{ "path": "./vendor/cordis" },
|
||||||
|
{ "path": "./vendor/loader" },
|
||||||
|
{ "path": "./vendor/include" },
|
||||||
|
{ "path": "./vendor/group" },
|
||||||
|
{ "path": "./vendor/timer" },
|
||||||
|
{ "path": "./vendor/hmr" },
|
||||||
|
{ "path": "./vendor/logger-console" },
|
||||||
|
{ "path": "./packages/llm" },
|
||||||
|
{ "path": "./packages/session" },
|
||||||
|
{ "path": "./packages/system-prompt" },
|
||||||
|
{ "path": "./packages/agent" },
|
||||||
|
{ "path": "./packages/tools" },
|
||||||
|
{ "path": "./packages/agent-loop" }
|
||||||
|
]
|
||||||
|
}
|
||||||
23
tsconfig.json
Normal file
23
tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.base.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"paths": {
|
||||||
|
"cordis": ["./vendor/cordis/src"],
|
||||||
|
"cosmokit": ["./vendor/cosmokit/src"],
|
||||||
|
"schemastery": ["./vendor/schemastery/src"],
|
||||||
|
"@cordisjs/plugin-loader": ["./vendor/loader/src"],
|
||||||
|
"@cordisjs/plugin-include": ["./vendor/include/src"],
|
||||||
|
"@cordisjs/plugin-group": ["./vendor/group/src"],
|
||||||
|
"@cordisjs/plugin-timer": ["./vendor/timer/src"],
|
||||||
|
"@cordisjs/plugin-hmr": ["./vendor/hmr/src"],
|
||||||
|
"@cordisjs/plugin-logger-console": ["./vendor/logger-console/src"],
|
||||||
|
"@deepseek-ai/dsh-llm": ["./packages/llm/src"],
|
||||||
|
"@deepseek-ai/dsh-session": ["./packages/session/src"],
|
||||||
|
"@deepseek-ai/dsh-system-prompt": ["./packages/system-prompt/src"],
|
||||||
|
"@deepseek-ai/dsh-tools": ["./packages/tools/src"],
|
||||||
|
"@deepseek-ai/dsh-agent": ["./packages/agent/src"],
|
||||||
|
"@deepseek-ai/dsh-agent-loop": ["./packages/agent-loop/src"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"files": []
|
||||||
|
}
|
||||||
10
tsconfig.test.json
Normal file
10
tsconfig.test.json
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"noEmit": true,
|
||||||
|
"emitDeclarationOnly": false,
|
||||||
|
"composite": false,
|
||||||
|
"types": ["node"]
|
||||||
|
},
|
||||||
|
"include": ["vendor/*/src", "packages/*/src", "packages/*/tests", "examples"]
|
||||||
|
}
|
||||||
9
vitest.config.ts
Normal file
9
vitest.config.ts
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import tsconfigPaths from 'vite-tsconfig-paths'
|
||||||
|
import { defineConfig } from 'vitest/config'
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
plugins: [tsconfigPaths({ projects: ['./tsconfig.test.json'] })],
|
||||||
|
test: {
|
||||||
|
include: ['packages/*/tests/**/*.spec.ts'],
|
||||||
|
},
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user