Skip to content

Updatable programs

Julian requested to merge updatable-programs into master

Created by: s-ol

From #24:

Find a way to propagate the updated mods into the programs. So far Neil is using an approach that I did not understand at the beginning but he explained it to me during the instructors bootcamp and it makes a lot of sense. The idea if having the programs with hardcoded modules makes a program resilient to changes. I would like to keep that idea but at the same time having an easy way to progragate the changes when needed.

This is a different approach than what I proposed there (adding 'soft' links to the module on the server and having UI to update inside mods), instead this is a more maintainer-friendly approach to the real problem: we (contributors) make changes to modules, but they aren't usually pushed into all the programs that would benefit from them.

So I propose to save all programs doubly:

  • as a JSON file, containing the full source of every module (as it is now)
  • as a JS file, which when run, outputs the JSON file. The JS file can reference modules by name to load the last version.

Then, when a module is updated, we can rerun the scripts to regenerate all programs that referenced that module. Anyone who has made modifications to an old program, or saved it for another reason, is not affected.

This PR contains an example conversion to a JS file. Some things to improve:

  • there is some boilerplate there to find modules. Maybe it would be nice to put this into a common place.
  • I had to inline the full source of 'ui/label' and 'ui/comment' because their text is stored in the source. On the one hand, that is clean because once you are in mods, it's "all there", but it means that we cannot e.g. propagate changes to the comment module style. Maybe for these we could have some kind of factory function in the JS files, e.g. make_label("label text...") and make_comment("comment text...")?

Merge request reports