/chrome-uploader

A Chrome app for uploading diabetes device data to Tidepool's backend

Primary LanguageJavaScriptBSD 2-Clause "Simplified" LicenseBSD-2-Clause

Tidepool Uploader

Build Status

This is a Chrome App that acts as an uploader client for Tidepool. It is intended to allow you to plug devices into the USB port and automatically load the data stored on them up to the Tidepool cloud.

How to set it up

  1. Clone this repository.
  2. Run npm install
  3. Set the config for the environment you want to target (see Config below)
  4. Run npm start (This will bundle the application with webpack and watch for changes. When it stops printing output you can continue to the next step.)
  5. Open Chrome. Go to chrome://extensions and turn on Developer mode (checkbox on the top line).
  6. Click "Load Unpacked Extension".
  7. Choose the directory where you cloned the repository and click OK.
  8. To run it, you can choose "Launch" from the chrome://extensions page. You can also run it from the Chrome App Launcher, which Chrome may install for you whether you want it or not.
  9. If you're developing, you may find that the only way it runs properly is to hit the "Reload" link in chrome://extensions after each change to the source. You will definitely need to reload any time you change the manifest.

Config

Configuration values (for example the URL of the Tidepool Platform) are set via environment variables. If you need to add a config value, modify the .config.js file. If you need to read a config value inside the app, use var config = require('./lib/config'). To set config values (do this before building the app), you can use Shell scripts that export environment variables (see config/local.sh for an example that exports the appropriate variables when running the whole Tidepool platform locally using runservers), for example:

$ source config/local.sh
$ npm start

Debug Mode

The environment variable DEBUG_ERROR (boolean) controls whether or not errors are caught and an error message displayed in the UI (the production setting) or whether they are thrown in the console (much more useful for local development because then the file name and line number of the error are easily accessible, along with a stack trace). Debug mode is turned on by default in config/debug.sh.

How to run the tests

npm test

Publishing (to the devel/staging testing & development Chrome store account or production)

Assuming you've already merged any changes to master and are on master locally...

  1. Start with a fresh Terminal window and cd into the chrome-uploader repo. (Alternatively, just make certain you haven't set any environment variables locally; but jebeck likes to start fresh to be absolutely certain of this.)
  2. Use the command mversion minor -m to bump the version number and create a tag. (You will need to npm install -g mversion if you don't have mversion installed already.)
  3. Push the new tag commit and tag up to GitHub with git push origin master and git push origin --tags.
  4. Checkout your new tag, using git checkout tags/<tag_name>.
  5. Remove your node modules with rm -rf node_modules/. (This may not always be necessary, but it's good to be safe in case anything has changed.)
  6. Make sure you are using node v0.12.0 and install fresh dependencies with npm install.
  7. Build the dist.zip file with npm run build. Look for the "Using the default environment, which is now production" message at the beginning of the build process. (You can check the success of a build (prior to publishing) by pointing 'Load unpacked extension' from chrome://extensions to the dist/ subdir.)
  8. Follow instructions in secrets for actually publishing to the Chrome store.
  9. Fill out the release notes for the tag on GitHub. If the tag is known to not be a release candidate, mark as a pre-release.