Tidepool data visualization for diabetes device data.
This README is focused on just the nuts & bolts of getting the code in this repository ready to develop locally in blip or with React Storybook. For more detailed information about the code in this repository, please see the developer guide.
Table of contents
- Getting started
After cloning this repository to your local machine, first make sure that you have at least node
6.x and npm
4.x installed. If you have a different major version of node installed, consider using nvm to manage and switch between multiple node (& npm) installations. If you have npm
3.x installed (as it is by default with node
6.x), then you can update to the latest npm
npm install -g npm@4.
It's not an absolute requirement, but it is preferable to have Yarn installed, as it provides dependency management features above and beyond what npm provides. Just follow Yarn's installation instructions (hint: for Mac users with Homebrew installed, it's just
brew install yarn).
Once your environment is setup with node
6.x and npm
3.x install the dependencies with Yarn:
$ yarn install
Or with npm if you're choosing not to use Yarn:
$ npm install
Running locally with blip
To work on code in this repository within blip, first do the following from your local blip repository (assuming blip/ and viz/ are sister directories):
$ npm link ../viz/
In this repository, start the build in watch mode:
$ npm start
Finally, back in your local blip repository, follow the instructions for starting blip locally.
Running locally in React Storybook
If you're working at the component or view level outside of blip, you can work on component and view rendering code with React Storybook.
If you're working on the diabetes data model rendering components, run:
$ npm run typestories
If you're working on any other components or views, run:
$ npm run stories
For more about the use of React Storybook in this repo, see use of React Storybook.
Running the tests
$ npm test
To have the tests run continuously with source and test code changes rebundled as you work:
$ npm run test-watch
To run the unit tests in your local Chrome browser (recommended for Tidepool developers before merging or publishing a release):
$ npm run browser-tests
Running the linter
To run the code linter from the command line:
$ npm run lint
Generally speaking, Tidepool developers configure linting to run continuously in their text editor of choice, and we recommend this approach for development. You can easily find instructions online for running ESLint continuously in all of the popular text editors—SublimeText, Atom, Visual Studio Code, etc.
Publishing examples to GitHub Pages with React Storybook
See the publishing section of the docs on docs.
Building and publishing to
When a new feature(s) is/are complete (i.e., branch is synchronized with master, reviewed with a sign-off from another developer), it's time to publish the package to npm! Since this is one of our most recently created repositories, any member of the "developers" team in the
@tidepool npm organization will be able to publish the package using his or her npm login. Steps to publishing are as follows:
- create a tag on the approved pull request using the
mversiontool with the
-moption to auto-commit the version bump and tag (e.g.,
$ mversion patch -mfor a patch version bump)
- push the new commit and tag to the GitHub remote with
$ git push origin <branch-name>and
$ git push origin --tags
- check that the tag build has passed on TravisCI
$ npm whoamito check if you are logged in as yourself; if you are, skip to 7.
- if you are logged in as
tidepool-robot, log out with
$ npm logout
- then log in as yourself with
$ npm login
- publish the new version with
$ npm publish; before the actual publish happens, the
yarninstall, linter, tests, and packaging webpack build will run since we have set those up through the
prepublishOnlynpm hooks in the package.json
- merge the approved pull request to master
- remember to bump the version appropriately in the package.json for the app (e.g., blip) requiring
@tidepool/vizas a dependency!