Migrate app from JavaScript to TypeScript#893
Migrate app from JavaScript to TypeScript#893avargaskun wants to merge 9 commits intogetwud:mainfrom
Conversation
- Attempting to run regex on boolean field: container.image.tag.semver - Throwing instead of returning filtered list of tags
BUG: The logic calling `isDigestToWatch` should pass parsedImage but instead is passing the domain CHANGE: The label `wud.watch.digest` should be respected regardless of registry
- Renamed all .js files in app/ to .ts - Converted imports/exports to ESM syntax - Added typescript and ts-jest dependencies - Configured tsconfig.json and updated jest.config.cjs - Refactored tests to support ESM and removed babel-plugin-rewire usage - Updated Dockerfile to build TypeScript - Added type: "module" to package.json - Exported internal functions for testing with 'testable_' prefix - Use commonjs to ensure compatibility
|
@fmartinou - I hope you will consider merging. The switch to Typescript should make it safer to refactor code going forward. I kept the number of changed lines to a minimum. The change includes #874 which is needed to fix the unit tests to validate the change. |
- Remove `@ts-nocheck` from `app/registry/index.ts` and component base classes. - Create `Container` interface in `app/model/container.ts`. - Create `Watcher` abstract base class in `app/watchers/Watcher.ts`. - Update `Component`, `Trigger`, `Registry`, `Authentication` to be strongly typed. - Update `Docker` watcher to extend `Watcher` and use types. - Fix tests to align with new typing and initialization behavior.
|
@fmartinou first of all thanks for this amazing project. @avargaskun also thank you for this PR |
|
Hi @IARI , Thank you very much for your support. 🙏 Yes PRs regarding JavaScript to Typescript migration (both for frontend and backend parts) will eventually be merged. Unfortunately, over the last few months, I haven't been able to set aside enough time to be responsive on the project, which is why these PRs are dragging on and conflicts are starting to pop up... |
|
WUD-CE independently completed a full TypeScript + ESM migration across the entire codebase (app + UI, 392 files) as part of 9.0.0-ce, including Vitest 4 and Biome. Great to see upstream heading this direction too — thanks for the effort! |
Overview
This PR completes the migration of the
appdirectory from JavaScript to TypeScript, modernizing the codebase with improved type safety and developer experience. Additionally, this PR fixes the broken end-to-end tests and ensures they pass throughout the migration process.Key Changes
✨ TypeScript Migration
.jsfiles to.tswith proper ESM imports@ts-nocheckpragmas for gradual migration support🔧 Build & Tooling
npm run buildts-jestfor TypeScript test supportjest.config.cjsfor ESM-compatible test configuration/distdirectory📦 Development Dependencies
^5.9.3)@types/*packages for all major dependencies (Express, Docker, Bunyan, etc.)ts-jest(^29.4.6) andts-node(^10.9.2)babel-plugin-rewire(no longer needed with TypeScript)🐳 Docker Updates
🚀 End-to-End Testing
This PR resolves previously broken e2e tests in the
e2efolderTesting
All existing tests (unit and e2e) have been migrated and verified. The test suite now provides better type checking during test execution while maintaining full compatibility.
Breaking Changes
None - this is a transparent migration that maintains full backward compatibility.
Migration Strategy
@ts-nocheckcomments where needed