Refactor: Migrate packages/cli from MJS to TypeScript #3
Reference in New Issue
Block a user
Delete Branch "fix/1-migrate-cli-to-typescript"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Migrates the
packages/clipackage from vanilla MJS to TypeScript with full type safety and comprehensive test coverage.What Changed
urec.mjs→urec.ts,uconn.mjs→uconn.tstsconfig.jsonwith strict mode enabledsrc/types/protocol.d.tsfor external protocol typesdist/with source maps and type declarationsdist/output.mjssourcesWhy
Issue #1 requested TypeScript migration to improve:
Changes
New Files
packages/cli/tsconfig.json- TypeScript configuration with strict modepackages/cli/src/urec.ts- Migrated from urec.mjs with full type annotationspackages/cli/src/uconn.ts- Migrated from uconn.mjs with full type annotationspackages/cli/src/types/protocol.d.ts- Type declarations for protocolpackages/cli/__tests__/urec.test.ts- Comprehensive urec test suite (196 lines)packages/cli/__tests__/uconn.test.ts- Type safety tests for uconnpackages/cli/__tests__/build.test.ts- Build configuration testsModified Files
packages/cli/package.json- Added build script, updated bin entries, added @types/wsbun.lock- Updated dependenciesDeleted Files
packages/cli/src/urec.mjs- Replaced by urec.tspackages/cli/src/uconn.mjs- Replaced by uconn.tsVerification
✅ All 22 tests pass
✅ TypeScript compiles with strict mode (0 errors)
✅ Biome lint checks pass (0 errors)
✅ Both executables work correctly after build
✅ Zero
anytypes in codebase✅ Full backward compatibility maintained
Ref
Fixes #1