feat: add --dev flag to watch and auto-reload sfx archive changes#1027
feat: add --dev flag to watch and auto-reload sfx archive changes#1027grifinas wants to merge 1 commit into9001:hovudstraumfrom
Conversation
when --dev is passed, starts a background thread that monitors the sfx archive file for modifications and automatically re-unpacks when changes are detected. Skips checksum validation during repack to allow for content updates.
|
I'll say I think the idea is kinda cool, but I don't think the sfx is the right place for this; I'm keeping the sfx-loader as lean as possible, since it is the only bit of code in the file that doesn't get compressed -- and when this addition is not even useful for end-users, then I feel this should be done otherwise. When I need to make changes "in the field" where I only have the sfx available, then my approach is as follows:
at this point, I no longer need to restart the sfx anymore, it is sufficient to edit the .js file and reload the browser, and eventually copy the .js out of /tmp when I'm done with it. however, when it comes to the .html files, then yes I do need to restart the sfx after editing one of the files, because they are only loaded into jinja on startup -- but these require editing so rarely that it hasn't been a notable inconvenience to me. I think this could be handled with an inotify-watcher on /tmp/pe-copyparty.1000 which would restart the sfx as necessary, but that's just an idea |
Fair, bit of a weird hill to die on IMO, but ok,
Yup started with that too. No git history, changes disappearing on PC restart and just a general long process were my motivations for adding this flag.
What makes you so sure that host machine supports inotify? Is there a python lib that supports it on all major OS'es? If you don't want final sfx to bloat, would the approach that circumvents the weird behavior of extracting to tmp dir be more amenable? E.g. |
|
Come to think of it, you have that |
to repeat the end of the quoted, "that was just an idea" -- you're reading too much into it :p but if we take a step back for a bit -- if you run straight from the git-repo with The only drawback of this approach is, similar to previously, needing to restart the process if html-files are edited, but no restarts are necessary for hot-reloading css/js files, which is what is generally modified anyways. Wouldn't that be a good approach, as it also entirely skips having to rebuild the sfx to see the changes? |
When --dev is passed, starts a background thread that monitors the sfx archive file for modifications and automatically re-unpacks when changes are detected. Skips checksum validation during repack to allow for content updates.
Motivation:
As a developer, i want to make JS/HTML changes without having to restart server. With this change, only build-sfx.sh needs to run for those cases.
Notes:
This PR complies with the DCO; https://developercertificate.org/