refactor: migrate packages/server from MJS to TypeScript #4

Merged
xiaonuo merged 3 commits from fix/2-migrate-server-to-typescript into main 2026-05-28 14:54:01 +00:00

3 Commits

Author SHA1 Message Date
xiaoju 3a75cc9136 chore: remove old .mjs files after TypeScript migration
CI / check (pull_request) Successful in 4m39s
小橘 <xiaoju@shazhou.work>
2026-05-28 14:53:48 +00:00
xiaoju ea10718125 fix(server): apply biome formatting and replace console.log with logger
- Applied biome auto-fix to resolve all 5 formatting/linting errors
- Fixed import sorting in index.ts, protocol.ts, and migration.test.ts
- Fixed typeof expression parentheses in protocol.ts
- Created logger.ts utility with createLogger function
- Replaced console.log with logger.info for production code
- All biome checks passing, TypeScript compilation successful
- All 28 tests passing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-28 14:53:39 +00:00
xiaoju 3bee04f331 feat(server): migrate packages/server from MJS to TypeScript
- Created tsconfig.json with strict mode enabled
- Added comprehensive type definitions in types.ts
- Migrated protocol.mjs to protocol.ts with const assertions
- Migrated index.mjs to index.ts with full type annotations
- Updated package.json with TypeScript build script and type exports
- Added @types/express and @types/ws devDependencies
- Created comprehensive test suite with 28 tests covering:
  - Type safety and strict null checks
  - Protocol constants with literal types
  - Build configuration validation
  - Module exports and imports
  - Data structure validation
  - Type safety enforcement
- All tests passing, build succeeds with no errors
- Zero implicit any types, full type safety

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-28 14:53:39 +00:00