Manage Devian TypeScript monorepo workspace structure with single root policy, npm scripts, and build conventions
Manage the Devian TypeScript monorepo with strict single workspace root policy and standardized npm workflows.
This skill enforces Devian v10's monorepo architecture where `framework-ts/` is the single source of truth for dependency management. You'll work with workspace scripts, prevent common multi-lockfile errors, and maintain consistent build/dev workflows across modules, apps, and tools.
```
framework-ts/
├── package.json # Workspace root (ONLY valid package.json)
├── package-lock.json # Single lockfile
├── node_modules/ # Single dependency tree
├── tsconfig.json # Shared TypeScript config
├── module/
│ └── devian/ # Core framework (@devian/core)
├── apps/
│ ├── game-client/ # Client application
│ └── game-server/ # Server application
└── tools/
├── builder/ # Build toolchain
└── archive/ # Project archival
```
**CRITICAL RULE:** All `npm install` commands MUST run from `framework-ts/` root.
```bash
cd framework-ts
npm install lodash
cd framework-ts/apps/game-client
npm install lodash # This violates single workspace policy
```
**Adding workspace-specific dependencies:**
```bash
cd framework-ts
npm install lodash -w game-client
```
The root `package.json` defines shortcut scripts for common tasks:
```bash
npm run builder -- ../input/input_common.json
npm run archive -- <args>
npm run dev:client
npm run start:server
```
**Direct workspace execution (alternative):**
```bash
npm -w builder run build -- ../input/input_common.json
npm -w game-client run dev
```
The root `tsconfig.json` provides `@devian/core` alias:
```typescript
// Any workspace can import core framework
import { DevianCore } from '@devian/core';
```
**Configuration reference:**
```json
{
"compilerOptions": {
"target": "ES2020",
"module": "ESNext",
"moduleResolution": "node",
"baseUrl": ".",
"paths": {
"@devian/core": ["./module/devian/src"]
}
}
}
```
Always use `npm ci` in automated environments for reproducible builds:
```bash
cd framework-ts
npm ci
```
If `package-lock.json` becomes inconsistent:
```bash
cd framework-ts
rm -rf node_modules package-lock.json
npm install
```
**When to use recovery:**
1. Create folder in `module/`, `apps/`, or `tools/`
2. Add `package.json` with unique name
3. Update root `workspaces` array (if pattern doesn't match)
4. Run `npm install` from root to link workspace
**Example `module/new-module/package.json`:**
```json
{
"name": "@devian/new-module",
"version": "1.0.0",
"type": "module",
"main": "./src/index.ts"
}
```
**Running tests across workspaces:**
```bash
npm run test --workspaces
```
**Building specific workspace:**
```bash
npm run build -w builder
```
**Listing all workspaces:**
```bash
npm query .workspace | jq -r '.[].name'
```
1. **Single lockfile policy:** Only `framework-ts/package-lock.json` is valid
2. **No nested node_modules:** Subfolders must not contain their own `node_modules/`
3. **Workspace scripts only:** Use root scripts or `-w` flag, never `cd` into subfolders for npm commands
4. **ES modules:** All packages use `"type": "module"` (no CommonJS)
5. **TypeScript target:** ES2020 baseline for all workspaces
**Error: "Cannot find module '@devian/core'"**
**Error: "Multiple package-lock.json files"**
**Error: "ENOWORKSPACES"**
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/devian-v10-workspace-management-0kbpgp/raw