Skip to content

zForDevelopers – Dependencies

mossy426 edited this page Jul 28, 2021 · 1 revision

MicrobeTrace

The core version of MicrobeTrace is and should always remain a fully client-side application. That is, none of the user's data is ever transmitted back to the outside world. (MicrobeTrace does run Google Analytics, which gives some superficial information about the users, but that tells us exactly nothing about their data.) To simplify deployment, we include copies of all the dependencies in bundles that are committed to the repository (see dist/bundle.*). This gives us the ability to deploy MicrobeTrace very, very easily (e.g. to Github Pages without relying on a CDN).

To add or update a dependency, what you'll need to do is recreate the bundles. To do that, add your dependency as a dev dependency (i.e. npm add <cool-new-library-you-need> --save-dev). Now you have a decision to make: which of the two bundles does the library you just added belong in? Why are there two different dependency bundles, you ask? Some libraries (jquery, bootstrap) are needed by MicrobeTrace immediately for rendering its default layout, and some libraries (Plotly) can be loaded later because it will take the user at least as much time to access them as it will the browser to download them. So the primary libraries are loaded immediately with the DOM, and the secondary libraries are deferred until all the higher-priority assets are available. Anyway, getting back to development...

Add the project-relative path to the file you want loaded by the browser in the appropriate list of the scripts/bundle.sh script and run it, like so:

npm run bundle

Which simply invokes the scripts/bundle.sh script. Since this is a bash script, if you're on Windows you'll need to do this in Windows Subsystem for Linux. This will generate new dist/bundle files. Commit these along with your updated package.json and package-lock.json files.

Clone this wiki locally