Skip to content

Commit

Permalink
Merge pull request #7 from nightscout/master
Browse files Browse the repository at this point in the history
JellyBean
  • Loading branch information
alexandra255 authored Aug 22, 2019
2 parents 9ca3258 + f81298f commit ac9a287
Show file tree
Hide file tree
Showing 108 changed files with 13,218 additions and 7,215 deletions.
3 changes: 0 additions & 3 deletions .bowerrc

This file was deleted.

14 changes: 14 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
"plugins": [ ],
"extends": [
"eslint:recommended"
],
"parser": "babel-eslint",
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"node": true,
"jquery": true
}
};
16 changes: 16 additions & 0 deletions .jsbeautifyrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"indent_size": 2
, "indent_char": " "
, "comma_first": true
, "keep-array-indentation": true
, "space_after_named_function": true
, "space_after_anon_function": true
, "end_with_newline": true
, "brace_style": "collapse,preserve-inline"
, "space_in_brace": true
, "space-in-paren": false
, "break-chained-methods": false
, "max-preserve-newlines": 2
, "space-after-anon-function": false
, "indent-empty-lines": false
}
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.x
10.16.0
54 changes: 31 additions & 23 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,32 @@
language: node_js
node_js:
- "10"
- "8"
os:
- osx
before_install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi
# https://github.com/Homebrew/homebrew-core/issues/26358
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew unlink python; fi
# "brew install" can succeed but return 1 if it has "caveats".
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install mongodb || true; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew services start mongodb; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install docker || true; fi
sudo: required
dist: xenial

node_js-steps: &node_js-steps
language: node_js
before_install:
- if [[ `npm --version` != "6.4.1" ]]; then npm install -g npm@latest; npm --version; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi
# https://github.com/Homebrew/homebrew-core/issues/26358
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew unlink python; fi
# "brew install" can succeed but return 1 if it has "caveats".
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install mongodb || true; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew services start mongodb; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install docker || true; fi
script: make travis
after_success:
- nvm version
- if [[ ! -z "$DOCKER_USER" ]]; then docker login -u ${DOCKER_USER} -p ${DOCKER_PASS} && git checkout -- . && git clean -fd . && make docker_release; fi
after_script: make report
services:
- mongodb
- docker
matrix:
fast_finish: true
services:
- mongodb
- docker
script: make travis
after_success:
- nvm version
- if [[ ! -z "$DOCKER_USER" ]]; then docker login -u ${DOCKER_USER} -p ${DOCKER_PASS} && git checkout -- . && git clean -fd . && make docker_release; fi
after_script: make report
allow_failures:
node_js: "node"
include:
- node_js: "8"
<<: *node_js-steps
- node_js: "10"
<<: *node_js-steps
- node_js: "node" # Latest Node is not supported, and recommend, but we'll test it to know incompatibility issues
<<: *node_js-steps
88 changes: 42 additions & 46 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
**Table of Contents**

- [Contributing to cgm-remote-monitor](#contributing-to-cgm-remote-monitor)
- [Design](#design)
- [Design & new features](#design--new-features)
- [Develop on `dev`](#develop-on-dev)
- [Style Guide](#style-guide)
- [Create a prototype](#create-a-prototype)
- [Submit a pull request](#submit-a-pull-request)
- [Bug fixing](#bug-fixing)
- [Comments and issues](#comments-and-issues)
- [Co-ordination](#co-ordination)
- [Other Dev Tips](#other-dev-tips)
Expand All @@ -19,7 +20,6 @@

<!-- END doctoc generated TOC please keep comment here to allow auto update -->


# Contributing to cgm-remote-monitor

[![Build Status][build-img]][build-url]
Expand All @@ -41,18 +41,47 @@
[waffle]: https://waffle.io/nightscout/cgm-remote-monitor
[progress-img]: https://badge.waffle.io/nightscout/cgm-remote-monitor.svg?label=in+progress&title=In+Progress

## Design & new features
## Installation for development

If you intend to add a new feature, please allow the community to participate in the design process by creating an issue to discuss your design. For new features, the issue should describe what use cases the new feature intends to solve, or which existing use cases are being improved.
Nightscout is a Node.js application. The basic installation of the software for local purposes is:

Note Nighscout has a plugin architecture for adding new features. We expect most code for new features live inside a Plugin, so the code retains a clear separation of concerns. If the Plugin API doesn't implement all features you need to implement your feature, please discuss with us on adding those features to the API. Note new features should under almost no circumstances require changes to the existing plugins.
1. Clone the software to your local machine using git
2. Install Node from https://nodejs.org/en/download/
2. Use `npm` to install Nightscout dependencies by invokin `npm install` in the project directory. Note the
dependency installation has to be done usign a non-root user - _do not use root_ for development and hosting
the software!
3. Get a Mongo database by either installing Mongo locally, or get a free cloud account from mLab or Mongodb Atlas.
4. Configure nightscout by copying `my.env.template` to `my.env` and run it - see the next chapter in the instructions

## Develop on `dev`

We develop on the `dev` branch. All new pull requests should be targeted to `dev`. The `master` branch is only used for distributing the latest version of the tested sources.

You can get the dev branch checked out using `git checkout dev`.

Once checked out, install the dependencies using `npm install`, then copy the included `my.env.template`file to `my.env` and edit the file to include your settings (like the Mongo URL). Leave the `NODE_ENV=development` line intact. Once set, run the site using `npm run dev`. This will start Nigthscout in the development mode, with different code packaging rules and automatic restarting of the server using nodemon, when you save changed files on disk. The client also hot-reloads new code in, but it's recommended to reload the the website after changes due to the way the plugin sandbox works.

Note the template sets `INSECURE_USE_HTTP` to `true` to enable the site to work over HTTP in local development.

If you want to additionaly test the site in production mode, create a file called `my.prod.env` that's a copy of the dev file but with `NODE_ENV=production` and start the site using `npm run prod`.

## REST API

Nightscout implements a REST API for data syncronization. The API is documented using Swagger. To access the documentation
for the API, run Nightscout locally and load the documentation from /api-docs (or read the associated swagger.json and swagger.yaml
files locally).

Note all dates used to access the API and dates stored in the objects are expected to comply with the ISO-8601 format and
be deserializable by the Javascript Date class. Of note here is the dates can contain a plus sign which has a special meaning in
URL encoding, so when issuing requests that place dates to the URL, take special care to ensure the data is properly URL
encoded.

## Design & new features

If you intend to add a new feature, please allow the community to participate in the design process by creating an issue to discuss your design. For new features, the issue should describe what use cases the new feature intends to solve, or which existing use cases are being improved.

Note Nighscout has a plugin architecture for adding new features. We expect most code for new features live inside a Plugin, so the code retains a clear separation of concerns. If the Plugin API doesn't implement all features you need to implement your feature, please discuss with us on adding those features to the API. Note new features should under almost no circumstances require changes to the existing plugins.

## Style Guide

Some simple rules that will make it easier to maintain our codebase:
Expand All @@ -76,15 +105,7 @@ If in doubt, format your code with `js-beautify --indent-size 2 --comma-first -

## Create a prototype

<<<<<<< HEAD
Fork cgm-remote-monitor and create a branch.
You can create a branch using `git checkout -b wip/add-my-widget`.
This creates a new branch called `wip/add-my-widget`. The `wip`
stands for work in progress and is a common prefix so that we know
what to expect when reviewing many branches.
=======
Fork cgm-remote-monitor and create a branch. You can create a branch using `git checkout -b wip/add-my-widget`. This creates a new branch called `wip/add-my-widget`. The `wip` stands for work in progress and is a common prefix so that when know what to expect when reviewing many branches.
>>>>>>> master

## Submit a pull request

Expand All @@ -95,8 +116,6 @@ This can be done by checking your code `git commit -avm 'my improvements are her
Now that the commits are available on github, you can click on the compare buttons on your fork to create a pull request. Make sure to select [Nightscout's `dev` branch](https://github.com/nightscout/cgm-remote-monitor/tree/dev).

We assume all new Pull Requests are at least smoke tested by the author and all code in the PR actually works.
<<<<<<< HEAD

Please include a description of what the features do and rationalize why the changes are needed.

If you add any new NPM module dependencies, you have to rationalize why there are needed - we prefer pull requests that reduce dependencies, not add them.
Expand All @@ -106,26 +125,13 @@ When adding new features that add confugration options, please ensure the `READM
## Bug fixing

If you've fixed a bug, please consider adding a unit test to the `/tests` folder that reproduces the original bug without the change.

Try to identify the root cause of the issue and fix the issue. Pull requests that simply add null checks to hide issues are unlikely to be accepted.

This can be done by committing your code `git commit -avm 'my
improvements are here'`, and pushing it to the branch you created on your own
fork. This will probably look something like
`git push -u origin wip/add-my-widget`.
=======

Please include a description of what the features do and rationalize why the changes are needed.

If you add any new NPM module dependencies, you have to rationalize why there are needed - we prefer pull requests that reduce dependencies, not add them.

When adding new features that add confugration options, please ensure the `README` document is amended with information on the new configuration.

## Bug fixing

If you've fixed a bug, please consider adding a unit test to the `/tests` folder that reproduces the original bug without the change.

Try to identify the root cause of the issue and fix the issue. Pull requests that simply add null checks to hide issues are unlikely to be accepted.
>>>>>>> master

Please include instructions how to test the changes.

Expand All @@ -137,25 +143,11 @@ We encourage liberal use of the comments, including images where appropriate.

Most cgm-remote-monitor hackers use github's ticketing system, along with Facebook cgm-in-the-cloud, and gitter.

<<<<<<< HEAD
We use [git-flow](https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow), with `master` as our production, stable branch, and
`dev` is used to queue changes for upcoming releases. Everything else is
done on branches, hopefully with names that indicate what to expect.

Once `dev` has been reviewed and people feel it's time to release, we
follow the git-flow release process, which creates a new tag and bumps
the version correctly. See [sem-ver](https://semver.org/) for versioning strategy.

Every commit is tested by Travis CI. We encourage adding tests to
validate your design. We encourage discussing your use cases to help
everyone get a better understanding of your design.
=======
We use git-flow, with `master` as our production, stable branch, and `dev` is used to queue up for upcoming releases. Everything else is done on branches, hopefully with names that indicate what to expect.

Once `dev` has been reviewed and people feel it's time to release, we follow the git-flow release process, which creates a new tag and bumps the version correctly. See sem-ver for versioning strategy.

Every commit is tested by travis. We encourage adding tests to validate your design. We encourage discussing your use cases to help everyone get a better understanding of your design.
>>>>>>> master

## Other Dev Tips

Expand All @@ -177,8 +169,10 @@ Also if you can't code, it's possible to contribute by improving the documentati
[@apanasef]: https://github.com/apanasef
[@bewest]: https://github.com/bewest
[@danamlewis]: https://github.com/danamlewis
[@diabetlum]: https://github.com/diabetlum
[@herzogmedia]: https://github.com/herzogmedia
[@jamieowendexcom ]: https://github.com/jamieowendexcom
[@janrpn]: https://github.com/janrpn
[@jasoncalabrese]: https://github.com/jasoncalabrese
[@jizhongwen]: https://github.com/jizhongwen
[@jpcunningh]: https://github.com/jpcunningh
Expand All @@ -197,6 +191,7 @@ Also if you can't code, it's possible to contribute by improving the documentati
[@tynbendad]: https://github.com/tynbendad
[@unsoluble]: https://github.com/unsoluble
[@viderehh]: https://github.com/viderehh
[@OpossumGit]: https://github.com/OpossumGit

| Contribution area | List of contributors |
| ------------------------------------- | ---------------------------------- |
Expand Down Expand Up @@ -255,14 +250,14 @@ Languages with less than 90% coverage will be removed in a future Nightscout ver
| Български (`bg`) |Please volunteer| OK |
| Čeština (`cs`) |Please volunteer|OK |
| Deutsch (`de`) |[@viderehh] [@herzogmedia] |OK |
| Dansk (`dk`) |Please volunteer|OK |
| Dansk (`dk`) | [@janrpn] |OK |
| Ελληνικά `(el`)|Please volunteer|Needs attention: 68.5%|
| English (`en`)|Please volunteer|OK|
| Español (`es`) |Please volunteer|OK|
| Suomi (`fi`)|[@sulkaharo] |OK|
| Français (`fr`)|Please volunteer|OK|
| עברית (`he`)|Please volunteer|OK|
| Hrvatski (`hr`)|Please volunteer|Needs attention: 47.8%|
| Hrvatski (`hr`)|[@OpossumGit]|Needs attention: 47.8% - committed 100% to dev|
| Italiano (`it`)|Please volunteer|OK|
| 日本語 (`ja`)|[@LuminaryXion]|Working on this|
| 한국어 (`ko`)|Please volunteer|Needs attention: 80.6%|
Expand All @@ -274,6 +269,7 @@ Languages with less than 90% coverage will be removed in a future Nightscout ver
| Русский (`ru`)|[@apanasef]|OK|
| Slovenčina (`sk`)|Please volunteer|OK|
| Svenska (`sv`)|Please volunteer|OK|
| Türkçe (`tr`)|[@diabetlum]|OK|
| 中文(简体) (`zh_cn`) | [@jizhongwen]|OK|
| 中文(繁體) (`zh_tw`) | [@jizhongwen]|Needs attention: 25.0%
| 日本語 (`ja_jp`) | [@LuminaryXion]|
Expand All @@ -284,5 +280,5 @@ Languages with less than 90% coverage will be removed in a future Nightscout ver
| ------------------------------------- | -------------------- |
| All active developers: | [@jasoncalabrese] [@jpcunningh] [@jweismann] [@komarserjio] [@mdomox] [@MilosKozak] [@PieterGit] [@rickfriele] [@sulkaharo]
| All active testers/documentors: | [@danamlewis] [@jamieowendexcom] [@mcdafydd] [@oteroos] [@rarneson] [@tynbendad] [@unsoluble]
| All active translators: | [@apanasef] [@jizhongwen] [@viderehh] [@herzogmedia] [@LuminaryXion]
| All active translators: | [@apanasef] [@jizhongwen] [@viderehh] [@herzogmedia] [@LuminaryXion] [@OpossumGit]

10 changes: 5 additions & 5 deletions Dockerfile.example
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
FROM node:8.9.1
FROM node:10-alpine

MAINTAINER Nightscout Contributors

RUN apt-get update && \
apt-get -y dist-upgrade

RUN mkdir -p /opt/app
ADD . /opt/app
WORKDIR /opt/app
RUN chown -R node:node /opt/app
USER node

RUN npm install && \
npm run postinstall && \
npm run env
npm run env && \
npm audit fix

EXPOSE 1337

Expand Down
Loading

0 comments on commit ac9a287

Please sign in to comment.