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.
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 4.x
with 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
To work on code in this repository within blip, first run this command in your viz/ directory:
$ npm link
This creates a "symlink" in the global folder {prefix}/lib/node_modules/<package>/ that links <package> to the viz/ directory.
Then, go to your local blip repository (assuming blip/ and viz/ are sister directories) and run:
$ npm link ../viz/
This creates a symbolic link from the global folder to the node_modules/ of the blip/ directory.
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.
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.
To run the unit tests in PhantomJS (as they run on Travis CI):
$ 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
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.
See the publishing section of the docs on docs.
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
mversion
tool with the-m
option to auto-commit the version bump and tag (e.g.,$ mversion patch -m
for 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 whoami
to 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, theyarn
install, linter, tests, and packaging webpack build will run since we have set those up through theprepare
andprepublishOnly
npm 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/viz
as a dependency!