FHell / COVID-Game

A simple explorable/visualization/game of the effect of covid countermeasures
https://fhell.github.io/COVID-Game/
BSD 2-Clause "Simplified" License
2 stars 0 forks source link

Add bundling through webpack. Project organization refactoring. #12

Closed elondaits closed 3 years ago

elondaits commented 3 years ago

This PR adds a lot of changes to the project organization, although it shouldn't modify the program's functionality or output at all.

The main changes are:

Critical consequences from accepting this PR:

Involuntary changes to the model

I tried to make these changes without affecting covid-game-V2.js... unfortunately I needed to do some minor modifications. These are:

At this point I didn't want to refactor the main.js either, but there was some problematic binding of HTML events that I had to turn around (e.g. event should be bound from JS -> HTML by using addEventListener, and not from HTML -> by doing onclick=..., because when you use JS modules all JS symbols are hidden from the HTML unless you explicitly make them global... which is messy).

Other notes FYI

Important

Please test the model a bit before merging. The changes I had to do to main.js could have some unintended consequences (hopefully no).

Also, check if you can run npm run build and everything works. You can delete everything in assets and see if the build script recreates the files there. SOMETIMES development tools have native dependencies and/or are affected by differences in the OS... I work in MacOS, so it's not impossible that the workflow needs some tweaking for Windows or Linux (most likely Windows).