Skip to content

Commit

Permalink
Merge pull request #1 from nightscout/master
Browse files Browse the repository at this point in the history
Whatever I want
  • Loading branch information
LvnInLevis committed Dec 17, 2019
2 parents ddbf1fc + 41ac93f commit 4feec06
Show file tree
Hide file tree
Showing 159 changed files with 12,188 additions and 2,109 deletions.
9 changes: 9 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ module.exports = {
"commonjs": true,
"es6": true,
"node": true,
"mocha": true,
"jquery": true
},
"rules": {
"no-unused-vars": [
"error",
{
"varsIgnorePattern": "should|expect"
}
]
}
};
32 changes: 32 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: CI test

on: [push]

jobs:
build:

runs-on: ubuntu-16.04

strategy:
matrix:
node-version: [10.x, 12.x]

steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm install
- name: Install MongoDB
run: |
wget -qO - https://www.mongodb.org/static/pgp/server-3.6.asc | sudo apt-key add -
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list
sudo apt-get update
sudo apt-get install -y mongodb-org
sudo apt-get install -y --allow-downgrades mongodb-org=3.6.14 mongodb-org-server=3.6.14 mongodb-org-shell=3.6.14 mongodb-org-mongos=3.6.14 mongodb-org-tools=3.6.14
- name: Start MongoDB
run: sudo systemctl start mongod
- name: Run tests
run: npm run-script test-ci
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ bundle/bundle.out.js
.idea/
*.iml
my.env
my.*.env

*.env
static/bower_components/
.*.sw?
.DS_Store
Expand All @@ -24,3 +24,9 @@ npm-debug.log
*.heapsnapshot

/tmp
/.vs
/cgm-remote-monitor.njsproj
/cgm-remote-monitor.sln
/obj/Debug
/bin
/*.bat
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ matrix:
include:
- 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: "12" # Latest Node is not supported, and recommend, but we'll test it to know incompatibility issues
<<: *node_js-steps
62 changes: 25 additions & 37 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,62 +25,52 @@
[![Build Status][build-img]][build-url]
[![Dependency Status][dependency-img]][dependency-url]
[![Coverage Status][coverage-img]][coverage-url]
[![Gitter chat][gitter-img]][gitter-url]
[![Stories in Ready][ready-img]][waffle]
[![Stories in Progress][progress-img]][waffle]
[![Discord chat][discord-img]][discord-url]

[build-img]: https://img.shields.io/travis/nightscout/cgm-remote-monitor.svg
[build-url]: https://travis-ci.org/nightscout/cgm-remote-monitor
[dependency-img]: https://img.shields.io/david/nightscout/cgm-remote-monitor.svg
[dependency-url]: https://david-dm.org/nightscout/cgm-remote-monitor
[coverage-img]: https://img.shields.io/coveralls/nightscout/cgm-remote-monitor/master.svg
[coverage-url]: https://coveralls.io/r/nightscout/cgm-remote-monitor?branch=master
[gitter-img]: https://img.shields.io/badge/Gitter-Join%20Chat%20%E2%86%92-1dce73.svg
[gitter-url]: https://gitter.im/nightscout/public
[ready-img]: https://badge.waffle.io/nightscout/cgm-remote-monitor.svg?label=ready&title=Ready
[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
[discord-img]: https://img.shields.io/discord/629952586895851530?label=discord%20chat
[discord-url]: https://discordapp.com/channels/629952586895851530/629952669967974410

## Installation for development

Nightscout is a Node.js application. The basic installation of the software for local purposes is:

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
2. Use `npm` to install Nightscout dependencies by invoking `npm install` in the project directory. Note the
dependency installation has to be done using 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
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.
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 Nightscout 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 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).
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.
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.
Note Nightscout 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

Expand All @@ -105,7 +95,7 @@ If in doubt, format your code with `js-beautify --indent-size 2 --comma-first -

## Create a prototype

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.
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.

## Submit a pull request

Expand All @@ -115,11 +105,9 @@ 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.
Please include a description of what the features do and rationalize why the changes are needed.
We assume all new Pull Requests are at least smoke tested by the author and all code in the PR actually works. 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.
Before releasing a a new version, we check with `npm audit` if our dependencies don't have known security issues.
If you add any new NPM module dependencies, you have to rationalize why they are needed - we prefer pull requests that reduce dependencies, not add them. Before releasing a a new version, we check with `npm audit` if our dependencies don't have known security issues.

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

Expand All @@ -142,7 +130,7 @@ We encourage liberal use of the comments, including images where appropriate.
## Co-ordination
Most cgm-remote-monitor hackers use github's ticketing system, along with Facebook cgm-in-the-cloud, and gitter.
We primarily use GitHub's ticketing system for discussing PRs and bugs, and [Discord][discord-url] for general development chatter.

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.

Expand All @@ -152,7 +140,7 @@ Every commit is tested by travis. We encourage adding tests to validate your de
## Other Dev Tips
* Join the [Gitter chat][gitter-url]
* Join the [Discord chat][discord-url].
* Get a local dev environment setup if you haven't already.
* Try breaking up big features/improvements into small parts. It's much easier to accept small PR's.
* Create tests for your new code as well as the old code. We are aiming for a full test coverage.
Expand Down Expand Up @@ -203,13 +191,13 @@ Also if you can't code, it's possible to contribute by improving the documentati
| Release coordination 0.11.x: | [@PieterGit] |
| Issue/Pull request coordination: | Please volunteer |
| Cleaning up git fork spam: | Please volunteer |
| Documentation writers: | [@andrew-warrington][@unsoluble] [@tynbendad] [@danamlewis] [@rarneson] |
| Documentation writers: | [@andrew-warrington] [@unsoluble] [@tynbendad] [@danamlewis] [@rarneson] |
### Plugin contributors
| Contribution area | List of developers | List of testers
| ------------------------------------- | -------------------- | -------------------- |
| [`alexa` (Amazon Alexa)](README.md#alexa-amazon-alexa)| Please volunteer | Please volunteer |
| [`alexa` (Amazon Alexa)](README.md#alexa-amazon-alexa)| [@inventor96] | Please volunteer |
| [`ar2` (AR2 Forecasting)](README.md#ar2-ar2-forecasting)| Please volunteer | Please volunteer |
| [`basal` (Basal Profile)](README.md#basal-basal-profile)| Please volunteer | Please volunteer |
| [`boluscalc` (Bolus Wizard)](README.md#boluscalc-bolus-wizard)| Please volunteer | Please volunteer |
Expand All @@ -224,7 +212,7 @@ Also if you can't code, it's possible to contribute by improving the documentati
| [`direction` (BG Direction)](README.md#direction-bg-direction)| Please volunteer | Please volunteer |
| [`errorcodes` (CGM Error Codes)](README.md#errorcodes-cgm-error-codes)| Please volunteer | Please volunteer |
| [`food` (Custom Foods)](README.md#food-custom-foods)| Please volunteer | Please volunteer |
| [`googlehome` (Google Home)](README.md#google-home) |[@mdomox] [@rickfriele] | [@mcdafydd] [@oteroos] [@jamieowendexcom] |
| [`googlehome` (Google Home/DialogFlow)](README.md#googlehome-google-homedialogflow)| [@mdomox] [@rickfriele] [@inventor96] | [@mcdafydd] [@oteroos] [@jamieowendexcom] |
| [`iage` (Insulin Age)](README.md#iage-insulin-age)| Please volunteer | Please volunteer |
| [`iob` (Insulin-on-Board)](README.md#iob-insulin-on-board)| Please volunteer | Please volunteer |
| [`loop` (Loop)](README.md#loop-loop)| Please volunteer | Please volunteer |
Expand All @@ -233,9 +221,9 @@ Also if you can't code, it's possible to contribute by improving the documentati
| [`profile` (Treatment Profile)](README.md#profile-treatment-profile)| Please volunteer | Please volunteer |
| [`pump` (Pump Monitoring)](README.md#pump-pump-monitoring)| Please volunteer | Please volunteer |
| [`rawbg` (Raw BG)](README.md#rawbg-raw-bg)| [@jpcunningh] | Please volunteer |
| [`sage` (Sensor Age)](README.md#sage-sensor-age)| @jpcunningh | Please volunteer |
| [`sage` (Sensor Age)](README.md#sage-sensor-age)| [@jpcunningh] | Please volunteer |
| [`simplealarms` (Simple BG Alarms)](README.md#simplealarms-simple-bg-alarms)| Please volunteer | Please volunteer |
| [`speech` (Speech)](README.md#speech-speech) | [@sulkaharo] | Please volunteer |
| [`speech` (Speech)](README.md#speech-speech)| [@sulkaharo] | Please volunteer |
| [`timeago` (Time Ago)](README.md#timeago-time-ago)| Please volunteer | Please volunteer |
| [`treatmentnotify` (Treatment Notifications)](README.md#treatmentnotify-treatment-notifications)| Please volunteer | Please volunteer |
| [`upbat` (Uploader Battery)](README.md#upbat-uploader-battery)| [@jpcunningh] | Please volunteer |
Expand All @@ -252,13 +240,13 @@ Languages with less than 90% coverage will be removed in a future Nightscout ver
| Čeština (`cs`) |Please volunteer|OK |
| Deutsch (`de`) |[@viderehh] [@herzogmedia] |OK |
| Dansk (`dk`) | [@janrpn] |OK |
| Ελληνικά `(el`)|Please volunteer|Needs attention: 68.5%|
| Ελληνικά (`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`)|[@OpossumGit]|Needs attention: 47.8% - committed 100% to dev|
| עברית (`he`)| [@jakebloom] |OK|
| Hrvatski (`hr`)|[@OpossumGit]|OK|
| Italiano (`it`)|Please volunteer|OK|
| 日本語 (`ja`)|[@LuminaryXion]|Working on this|
| 한국어 (`ko`)|Please volunteer|Needs attention: 80.6%|
Expand All @@ -279,7 +267,7 @@ Languages with less than 90% coverage will be removed in a future Nightscout ver
### List of all contributors
| Contribution area | List of contributors |
| ------------------------------------- | -------------------- |
| All active developers: | [@jasoncalabrese] [@jpcunningh] [@jweismann] [@komarserjio] [@mdomox] [@MilosKozak] [@PieterGit] [@rickfriele] [@sulkaharo]
| All active developers: | [@jasoncalabrese] [@jpcunningh] [@jweismann] [@komarserjio] [@mdomox] [@MilosKozak] [@PieterGit] [@rickfriele] [@sulkaharo] [@unsoluble]
| All active testers/documentors: | [@danamlewis] [@jamieowendexcom] [@mcdafydd] [@oteroos] [@rarneson] [@tynbendad] [@unsoluble]
| All active translators: | [@apanasef] [@jizhongwen] [@viderehh] [@herzogmedia] [@LuminaryXion] [@OpossumGit]
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ report:

test_onebyone:
python -c 'import os,sys,fcntl; flags = fcntl.fcntl(sys.stdout, fcntl.F_GETFL); fcntl.fcntl(sys.stdout, fcntl.F_SETFL, flags&~os.O_NONBLOCK);'
$(foreach var,$(wildcard tests/*.js),${MONGO_SETTINGS} ${MOCHA} --timeout 30000 --exit --bail -R tap $(var);)
for var in tests/*.js; do ${MONGO_SETTINGS} ${MOCHA} --timeout 30000 --exit --bail -R tap $$var; done | tap-set-exit

test:
${MONGO_SETTINGS} ${MOCHA} --timeout 30000 --exit --bail -R tap ${TESTS}
Expand All @@ -52,7 +52,7 @@ travis:
python -c 'import os,sys,fcntl; flags = fcntl.fcntl(sys.stdout, fcntl.F_GETFL); fcntl.fcntl(sys.stdout, fcntl.F_SETFL, flags&~os.O_NONBLOCK);'
# NODE_ENV=test ${MONGO_SETTINGS} \
# ${ISTANBUL} cover ${MOCHA} --report lcovonly -- --timeout 5000 -R tap ${TESTS}
$(foreach var,$(wildcard tests/*.js),${MONGO_SETTINGS} ${MOCHA} --timeout 30000 --exit --bail -R tap $(var);)
for var in tests/*.js; do ${MONGO_SETTINGS} ${MOCHA} --timeout 30000 --exit --bail -R tap $$var; done

docker_release:
# Get the version from the package.json file
Expand Down
Loading

0 comments on commit 4feec06

Please sign in to comment.