michaelKurowski / lokim2

An internet messenger that cares about privacy.
4 stars 0 forks source link

Make build system that watch frontend and backend files #127

Open michaelKurowski opened 5 years ago

michaelKurowski commented 5 years ago

We need a build system that rebuilds backend or frontend in case if any changes occurred there. As for now, a developer might not remember to refresh/rebuild the app after making changes, and face with some problems during debugging caused by the fact that He website that he's viewing is still an old version of his app. It can add additional hours and frustration to the debugging process.

The task can be divided into 2 parts: 1) Frontend watcher As for now, once a developer performs a change in frontend database (src/server/frontEnd), He needs to manually run npm run build-dev to rebuild the app. We need a watcher that rebuilds the frontend when any of frontend files have been modified. As far as I remember, it should be possible to do with webpack, but the person that'll be taking care of this ticket will need to investigate is further as I don't remember the details.

2) Backend watcher Similiar to 1), when developer performs change in backend files (src/server, excluding src/server/frontEnd) then He needs to kill currently running LokIM server, and run npm start. Not sure with webpack, as we mainly use it to bundle frontend files, but nodemon should be helpful here.

User story

  1. I'm a developer, and I start to sit down to LokIM development.
  2. I run a command that will start watching LokIM codebase for changes.
  3. On the run it should rebuild frontend, and start LokIM backend.
  4. When I make changes to backend files, it should kill the running LokIM backend instance, and start it again.
  5. When I make changes to frontend files, it should rebuild frontend files, so backend will start serving new ones. It also preferably should refresh currently viewed instance of the app in the browser.

WARNING!!! The file watchers tend to be very resources-draining, and thus the person assigned to this task should find a solution that will be really optimized, to not slowdown another developer's machine.

Progress 1) - [ ] I've investigated the best way to perform the task 2) - [ ] I've implemented backend watcher 3) - [ ] I've implemented frontend watcher

Rejzor commented 5 years ago

I met yesterday gulp.js and I think that it might be right tool to perfrom those actions. I mean watching backend/frontend files and refresh whole app if it's neccessary. Maybe you got some ideas to other solutions ?

michaelKurowski commented 5 years ago

I think that webpack has an already optimized implementation of watching files. But it requires more research and possibly benchmarks comparison.