OpenSprinkler / OpenSprinkler-App

A mobile interface for the OpenSprinkler irrigation device. Designed to allow manual control, program management (preview, add, edit, and delete), initiation of a run-once program, viewing graphical and tabulated representations of log data, viewing device status, adjusting rain delay, and changing of OpenSprinkler settings.
https://opensprinkler.com
GNU Affero General Public License v3.0
169 stars 93 forks source link

chore(refactor): refactor app to reduce main.js size #159

Closed mellodev closed 5 days ago

mellodev commented 1 week ago

🚨 Changes Proposed


Huge refactor! please review carefully, please test locally and give feedback/input!

This is an attempt to clean up and slightly modernize the code base to make it easier to work on, test and potentially facilitate a migration to a modern frontend framework in the future. The main.js file is unwieldly at nearly 14000 lines, which makes it difficult to understand & work on, lags the IDE and prevents auto generation of unit tests (AI tools will fail to generate sufficient unit tests due to the size).

IMO the monolith main.js needs be broken down into smaller pieces, separating concerns whenever possible, then backfilling unit tests for functionality. This will set the stage for the looming future task of migrating the project to a modern frontend framework with ES6 functionality and a build tool like Parcel (or webpack). Given the current lack of unit tests, it seems dangerous to attempt any such migration (or major feature branch) right now.

💡 This PR aims to:


🦾 What I need help with


🎥 Demo Video or Screenshots


https://streamable.com/i0hy9c

🔢 Final line counts for js files:


image