A JavaScript module for interactive exploration of forecast evaluations.
You'll need to install Node.js and npm. Please see the installation instructions at https://docs.npmjs.com/downloading-and-installing-node-js-and-npm.
You must install the required Node.js packages via:
npm install --save-devThe dev-example folder has a minimal working example for local development, based on the flusight-dashboard. To use this example for development, use the following commands, starting from the root of the predevals repository:
npm run build
cp dist/predevals.bundle.js dev-example
python3 -m http.server 8000 -d dev-example/Then open http://127.0.0.1:8000/ in your web browser. As you make changes to src/predevals.js, rebuild and recopy the updated predevals.bundle.js into the dev-example folder and then refresh the page in your browser.
We use QUnit for our unit tests. To run the tests, execute the package.json test script: npm run test. You should see output at the bottom like this (the pass count grows as tests are added):
...
# pass 16
# skip 0
# todo 0
# fail 0We follow a -dev prerelease convention for the version field in package.json:
- Between releases,
maincarries a-devsuffix on the next expected version (e.g.1.2.1-devafter taggingv1.2.0). - Feature PRs do not touch the version. The bump (patch / minor / major per SemVer) is decided at release time based on what landed.
- The release PR drops
-devand sets the final version (e.g.1.2.0). - After release, a follow-up PR bumps to the next
-dev(e.g.1.2.1-dev).
Note
End users load the bundle from a Git tag via jsDelivr (the @v1 float resolves to the latest v1.x.y tag). The version field in package.json is not what gets served — it's a convention for developers to track the next release, so keep it in step with the tags.
We use webpack to package up all dependencies into a single dist/predevals.bundle.js file for end users. To do so, execute the package.json build script via the following command, which will update all files in dist/.
npm run buildYou'll then need to commit and push your updates (including dist/predevals.bundle.js) to GitHub.
For each version, create a new release of the package on GitHub using vX.Y.Z for the GitHub tag and release-vX.Y.Z for the release title. The release is now available for use via jsdelivr.