starwards-monorepo
БесплатноБез исполняемых скриптовНе проверенnpm workspace monorepo workflow for Starwards - build order, module dependencies, watch mode, testing across modules, and avoiding common monorepo pitfalls…
от starwards★ 44 звезды на GitHubОб этом скилле
Starwards Monorepo Workflow
Overview
Starwards uses npm workspaces with interdependent modules. Understanding build order, dependencies, and workflow prevents wasted time.
Core principle: Core builds first. Others depend on it.
Monorepo Structure
starwards/
├── package.json # Root workspace config
├── modules/
│ ├── core/ # Game logic, shared types
│ │ ├── src/ # TypeScript source
│ │ ├── cjs/ # Built CommonJS (gitignored)
│ │ └── package.json # @starwards/core
│ ├── server/ # Colyseus rooms, game server
│ │ ├── src/
│ │ ├── cjs/ # Built server code
│ │ └── package.json # @starwards/server
│ ├── browser/ # React UI, PixiJS rendering
│ │ ├── src/
│ │ ├── dist/ # Webpack bundle
│ │ └── package.json # @starwards/browser
│ ├── node-red/ # Node-RED integration
│ │ ├── src/
│ │ ├── dist/
│ │ └── package.json # @starwards/node-red
│ └── e2e/ # Playwright tests
│ └── test/
└── node_modules/ # Shared dependencies (hoisted)
Module Dependencies
core (no deps)
├─→ server (depends on core)
├─→ browser (depends on core)
├─→ node-red (depends on core)
└─→ e2e (depends on all)
Critical: Core must build before others.
Build Commands
From Root Directory
# Build all modules (correct order)
npm run build
# Runs: core → bots → (server, browser, node-red, mcp in parallel)
# Build specific module
npm run build:core
npm run build:bots
npm run build:browser
npm run build:server
npm run build:node-red
# Clean all build artifacts
npm run clean
# Removes: cjs/, dist/ from all modules
# Fresh build
npm run clean && npm run build
From Module Directory
# Build just this module
cd modules/core && npm run build
cd modules/browser && npm run build
# Watch mode (rebuild on file change)
cd modules/core && npm run build:watch
When to use:
- Root commands: CI/CD, fresh builds, building everything
- Module commands: Active development of that module
Development Workflow (3 Terminals)
Terminal 1: Core Watch Mode
cd modules/core && npm run build:watch
Purpose: Automatically rebuild core when files change
When running: Any time you're editing core/ files
Status: Keep running in background
Troubleshooting:
- Not rebuilding? Check console for errors
- Server not seeing changes? Core build may have failed
Terminal 2: Webpack Dev Server
cd modules/browser && npm start
Purpose: Hot-reload browser UI
Serves: http://localhost:3000
When running: When developing browser/ UI
Troubleshooting:
- Port 3000 taken?
lsof -ti:3000 | xargs kill -9 - Webpack overlay shows [object Object]? Check browser console (F12)
- Changes not appearing? Check if core watch is running
Terminal 3: API Server
node -r ts-node/register/transpile-only modules/server/src/dev.ts
Purpose: Run game server with Colyseus
Serves: http://localhost:8080
When running: Always (browser needs API)
Troubleshooting:
- Server crashes? Check if core is built
- Changes not appearing? Restart this terminal (server doesn't auto-reload)
Workflow Summary
- Start Terminal 1 (core watch)
- Start Terminal 2 (webpack dev server)
- Start Terminal 3 (API server)
- Edit code
- Browser auto-reloads (Terminal 2 hot-reload)
- Core changes → rebuild (Terminal 1 watches)
- Server changes → manually restart Terminal 3
Testing in Monorepo
All Tests
# From root: Run all module tests
npm test
# Runs: core tests, server tests, node-red tests
# Specific module
npm test -- --projects=core
npm test -- --projects=server
npm test -- --projects=node-red
# Specific file
npm test -- modules/core/test/shield.spec.ts
E2E Tests
# E2E tests require ALL modules built
npm run build # Build everything first
npm run test:e2e # Then run E2E
# Update snapshots
npm run test:e2e -- --update-snapshots
Why build first: E2E tests start real server, which needs built modules.
Watch Mode During Development
# Watch all tests
npm test -- --watch
# Watch specific module
cd modules/core && npm test -- --watch
Tip: Run in 4th terminal while developing.
Common Workflows
Adding New Core Feature
# 1. Ensure core watch running
cd modules/core && npm run build:watch # Terminal 1
# 2. Write test (TDD)
# modules/core/test/shield.spec.ts
# 3. Run test (should fail RED)
npm test -- modules/core/test/shield.spec.ts
# 4. Implement feature
# modules/core/src/ship/shield.ts
# (watch rebuilds automatically)
# 5. Test passes GREEN
npm test -- modules/core/test/shield.spec.ts
# 6. Verify dependents still work
npm test # All tests
npm run test:e2e # E2E tests
Adding New UI Widget
#
Установить starwards-monorepo в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл starwards-monorepo?
npm workspace monorepo workflow for Starwards - build order, module dependencies, watch mode, testing across modules, and avoiding common monorepo pitfalls; core builds first always
Как установить скилл starwards-monorepo?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл starwards-monorepo запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic