Skip to content

Commit 65372ab

Browse files
authored
Merge pull request nightscout#3953 from PieterGit/201809_npm_node_update
upgrade node to 8.12.0, upgrade npm packages (express, supertest, webpack, swagger-ui-dist) and fix memory problem
2 parents ee8ed70 + 969ac25 commit 65372ab

File tree

10 files changed

+3256
-3773
lines changed

10 files changed

+3256
-3773
lines changed

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8.11.x
1+
8.12.x

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
language: node_js
2-
os: osx
32
node_js:
3+
- "10"
44
- "8"
5+
os:
6+
- osx
57
before_install:
6-
- if [[ `npm --version` != "5.8.0" ]]; then npm install -g npm@latest; npm --version; fi
78
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi
89
# https://github.com/Homebrew/homebrew-core/issues/26358
910
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew unlink python; fi

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ Minimum browser requirements for viewing the site:
131131

132132
Windows installation software requirements:
133133

134-
- [Node.js](http://nodejs.org/) Latest Node 8 LTS (Node 8.11.3 or later). Use [Install instructions for Node](https://nodejs.org/en/download/package-manager/) or use `setup.sh`)
134+
- [Node.js](http://nodejs.org/) Latest Node 8 LTS (Node 8.12.0 or later). Use [Install instructions for Node](https://nodejs.org/en/download/package-manager/) or use `setup.sh`)
135135
- [MongoDB](https://www.mongodb.com/download-center?jmp=nav#community) 3.x or later. MongoDB 2.4 is only supported for Raspberry Pi.
136136

137137
As a non-root user clone this repo then install dependencies into the root of the project:

lib/storage/mongo-storage.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ function init (env, cb, forceNewConnection) {
2525

2626
console.log('Setting up new connection to MongoDB');
2727
var timeout = 30 * 1000;
28-
var options = { reconnectInterval: 10000, reconnectTries: 500, connectTimeoutMS: timeout, socketTimeoutMS: timeout };
28+
var options = { reconnectInterval: 10000, reconnectTries: 500, connectTimeoutMS: timeout,
29+
socketTimeoutMS: timeout, useNewUrlParser: true };
2930

3031
var connect_with_retry = function(i) {
3132
return MongoClient.connect(env.storageURI, options, function connected(err, client) {

npm-shrinkwrap.json

Lines changed: 3141 additions & 3653 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nightscout",
3-
"version": "0.11.0-dev-20180805",
3+
"version": "0.11.0-dev-20181022",
44
"description": "Nightscout acts as a web-based CGM (Continuous Glucose Montinor) to allow multiple caregivers to remotely view a patients glucose data in realtime.",
55
"license": "AGPL-3.0",
66
"author": "Nightscout Team",
@@ -48,11 +48,11 @@
4848
}
4949
},
5050
"engines": {
51-
"node": "8.11.x",
52-
"npm": "6.x || 5.8.x || 5.7.x || 5.6.x"
51+
"node": "8.12.x",
52+
"npm": "6.x"
5353
},
5454
"dependencies": {
55-
"ajv": "^6.5.1",
55+
"ajv": "^6.5.4",
5656
"async": "^0.9.2",
5757
"body-parser": "^1.18.3",
5858
"bootevent": "0.0.1",
@@ -62,54 +62,54 @@
6262
"d3": "^3.5.17",
6363
"ejs": "^2.6.1",
6464
"errorhandler": "^1.5.0",
65-
"event-stream": "^3.3.4",
65+
"event-stream": "^3.3.6",
6666
"expand-braces": "^0.1.2",
67-
"expose-loader": "^0.7.5",
68-
"express": "^4.16.3",
67+
"express": "^4.16.4",
6968
"express-minify": "^1.0.0",
70-
"file-loader": "^1.1.11",
7169
"flot": "^0.8.0-alpha",
7270
"jquery": "^3.3.1",
7371
"jquery-ui-bundle": "^1.12.1-migrate",
7472
"jquery.tooltips": "^1.0.0",
7573
"js-storage": "^1.0.4",
7674
"jsonwebtoken": "^8.3.0",
77-
"lodash": "^4.17.10",
75+
"lodash": "^4.17.11",
7876
"long": "^3.2.0",
7977
"mime": "^2.3.1",
8078
"minimed-connect-to-nightscout": "^1.1.1",
8179
"moment": "^2.22.2",
8280
"moment-timezone": "^0.5.21",
83-
"mongodb": "~3.0.11",
81+
"mongodb": "^3.1.8",
8482
"mongomock": "^0.1.2",
85-
"mqtt": "^2.18.3",
83+
"mqtt": "^2.18.8",
8684
"node-cache": "^4.2.0",
8785
"parse-duration": "^0.1.1",
8886
"prettyjson": "^1.2.1",
8987
"pushover-notifications": "^0.2.4",
9088
"random-token": "0.0.8",
91-
"request": "^2.87.0",
89+
"request": "^2.88.0",
9290
"sgvdata": "git://github.com/ktind/sgvdata.git#wip/protobuf",
9391
"share2nightscout-bridge": "git://github.com/nightscout/share2nightscout-bridge.git#wip/generalize",
9492
"shiro-trie": "^0.3.13",
9593
"simple-statistics": "^0.7.0",
9694
"socket.io": "^2.1.1",
97-
"style-loader": "^0.20.2",
98-
"swagger-ui-dist": "^3.18.0",
95+
"swagger-ui-dist": "^3.19.3",
9996
"traverse": "^0.6.6",
100-
"uglify-js": "^3.4.6",
97+
"uglify-js": "^3.4.9",
10198
"uuid": "^3.2.1"
10299
},
103100
"devDependencies": {
104101
"benv": "^3.3.0",
105102
"clear-require": "^2.0.0",
103+
"expose-loader": "^0.7.5",
104+
"file-loader": "^2.0.0",
106105
"istanbul": "^0.4.5",
107106
"mocha": "^5.2.0",
108107
"moment-locales-webpack-plugin": "^1.0.7",
109108
"should": "^13.2.3",
110-
"supertest": "^3.1.0",
111-
"webpack": "^4.16.4",
112-
"webpack-bundle-analyzer": "^2.13.1",
113-
"webpack-command": "^0.4.1"
109+
"style-loader": "^0.23.1",
110+
"supertest": "^3.3.0",
111+
"webpack": "^4.22.0",
112+
"webpack-bundle-analyzer": "^3.0.3",
113+
"webpack-cli": "^3.1.2"
114114
}
115115
}

swagger.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"info": {
99
"title": "Nightscout API",
1010
"description": "Own your DData with the Nightscout API",
11-
"version": "0.11.0-dev-20180805",
11+
"version": "0.11.0-dev-20181022",
1212
"license": {
1313
"name": "AGPL 3",
1414
"url": "https://www.gnu.org/licenses/agpl.txt"
@@ -1356,4 +1356,4 @@
13561356
}
13571357
}
13581358
}
1359-
}
1359+
}

swagger.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ servers:
44
info:
55
title: Nightscout API
66
description: Own your DData with the Nightscout API
7-
version: 0.11.0-dev-20180805
7+
version: 0.11.0-dev-20181022
88
license:
99
name: AGPL 3
1010
url: 'https://www.gnu.org/licenses/agpl.txt'

tests/pluginbase.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ require('should');
44
var benv = require('benv');
55

66
describe('pluginbase', function ( ) {
7-
this.timeout(40000); // TODO: see why this test takes longer on Travis to complete
7+
this.timeout(50000); // TODO: see why this test takes longer on Travis to complete
88

99
var headless = require('./fixtures/headless')(benv, this);
1010

webpack.config.js

Lines changed: 85 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -1,105 +1,98 @@
11
const path = require('path');
22
const webpack = require('webpack');
33
const MomentLocalesPlugin = require('moment-locales-webpack-plugin');
4+
const pluginArray = [];
5+
const sourceMapType = 'source-map';
46

7+
/*if (process.env.NODE_ENV !== 'development') {
8+
console.log('Development environment detected, enabling Bundle Analyzer');
9+
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
510
6-
var pluginArray = [];
11+
pluginArray.push(new BundleAnalyzerPlugin({
12+
// Can be `server`, `static` or `disabled`.
13+
// In `server` mode analyzer will start HTTP server to show bundle report.
14+
// In `static` mode single HTML file with bundle report will be generated.
15+
// In `disabled` mode you can use this plugin to just generate Webpack Stats JSON file by setting
16+
// `generateStatsFile` to `true`.
17+
analyzerMode: 'static',
18+
// Host that will be used in `server` mode to start HTTP server.
19+
analyzerHost: '127.0.0.1',
20+
// Port that will be used in `server` mode to start HTTP server.
21+
analyzerPort: 8888,
22+
// Path to bundle report file that will be generated in `static` mode.
23+
// Relative to bundles output directory.
24+
reportFilename: 'bundle_report.html',
25+
// Module sizes to show in report by default.
26+
// Should be one of `stat`, `parsed` or `gzip`.
27+
// See "Definitions" section for more information.
28+
defaultSizes: 'parsed',
29+
// Automatically open report in default browser
30+
openAnalyzer: true,
31+
// If `true`, Webpack Stats JSON file will be generated in bundles output directory
32+
generateStatsFile: false,
33+
// Name of Webpack Stats JSON file that will be generated if `generateStatsFile` is `true`.
34+
// Relative to bundles output directory.
35+
statsFilename: 'stats.json',
36+
// Options for `stats.toJson()` method.
37+
// For example you can exclude sources of your modules from stats file with `source: false` option.
38+
// See more options here: https://github.com/webpack/webpack/blob/webpack-1/lib/Stats.js#L21
39+
statsOptions: null,
40+
// Log level. Can be 'info', 'warn', 'error' or 'silent'.
41+
logLevel: 'info'
42+
}));
43+
}*/
744

8-
var sourceMapType = 'source-map';
9-
10-
if (process.env.NODE_ENV !== 'development') {
11-
12-
/*
13-
console.log('Development environment detected, enabling Bundle Analyzer');
14-
15-
var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
16-
17-
pluginArray.push(new BundleAnalyzerPlugin({
18-
// Can be `server`, `static` or `disabled`.
19-
// In `server` mode analyzer will start HTTP server to show bundle report.
20-
// In `static` mode single HTML file with bundle report will be generated.
21-
// In `disabled` mode you can use this plugin to just generate Webpack Stats JSON file by setting `generateStatsFile` to `true`.
22-
analyzerMode: 'static',
23-
// Host that will be used in `server` mode to start HTTP server.
24-
analyzerHost: '127.0.0.1',
25-
// Port that will be used in `server` mode to start HTTP server.
26-
analyzerPort: 8888,
27-
// Path to bundle report file that will be generated in `static` mode.
28-
// Relative to bundles output directory.
29-
reportFilename: 'bundle_report.html',
30-
// Module sizes to show in report by default.
31-
// Should be one of `stat`, `parsed` or `gzip`.
32-
// See "Definitions" section for more information.
33-
defaultSizes: 'parsed',
34-
// Automatically open report in default browser
35-
openAnalyzer: true,
36-
// If `true`, Webpack Stats JSON file will be generated in bundles output directory
37-
generateStatsFile: false,
38-
// Name of Webpack Stats JSON file that will be generated if `generateStatsFile` is `true`.
39-
// Relative to bundles output directory.
40-
statsFilename: 'stats.json',
41-
// Options for `stats.toJson()` method.
42-
// For example you can exclude sources of your modules from stats file with `source: false` option.
43-
// See more options here: https://github.com/webpack/webpack/blob/webpack-1/lib/Stats.js#L21
44-
statsOptions: null,
45-
// Log level. Can be 'info', 'warn', 'error' or 'silent'.
46-
logLevel: 'info'
47-
}));
48-
*/
49-
50-
}
51-
52-
var jq = new webpack.ProvidePlugin({
53-
$: "jquery",
54-
jQuery: "jquery",
55-
"window.jQuery": "jquery'",
56-
"window.$": "jquery"
57-
});
58-
59-
pluginArray.push(jq);
45+
pluginArray.push(new webpack.ProvidePlugin({
46+
$: 'jquery',
47+
jQuery: 'jquery',
48+
'window.jQuery': 'jquery',
49+
'window.$': 'jquery'
50+
}));
6051

6152
// Strip all locales except the ones defined in lib/language.js
6253
// (“en” is built into Moment and can’t be removed, 'dk' is not defined in moment)
63-
var momentLocales = new MomentLocalesPlugin({
64-
localesToKeep: ['bg', 'cs', 'de', 'el', 'es', 'fi', 'fr', 'he', 'hr', 'it', 'ko', 'nb', 'nl', 'pl', 'pt', 'ro', 'ru', 'sk', 'sv', 'zh_cn', 'zh_tw'],
65-
}) ;
66-
pluginArray.push(momentLocales);
67-
54+
pluginArray.push(new MomentLocalesPlugin({
55+
localesToKeep: ['bg', 'cs', 'de', 'el', 'es', 'fi', 'fr', 'he', 'hr', 'it', 'ko', 'nb', 'nl', 'pl', 'pt', 'ro', 'ru',
56+
'sk', 'sv', 'zh_cn', 'zh_tw'],
57+
}));
6858

6959
module.exports = {
70-
context: path.resolve(__dirname, '.'),
71-
entry: {
72-
app: './bundle/bundle.source.js'
73-
},
74-
output: {
75-
path: path.resolve(__dirname, './tmp'),
76-
publicPath: '/',
77-
filename: 'js/bundle.js',
78-
sourceMapFilename: "js/bundle.js.map",
60+
context: path.resolve(__dirname, '.'),
61+
entry: {
62+
app: './bundle/bundle.source.js'
63+
},
64+
output: {
65+
path: path.resolve(__dirname, './tmp'),
66+
publicPath: '/',
67+
filename: 'js/bundle.js',
68+
sourceMapFilename: 'js/bundle.js.map',
69+
},
70+
devtool: sourceMapType,
71+
plugins: pluginArray,
72+
module: {
73+
rules: [{
74+
test: /\.(jpe?g|png|gif)$/i,
75+
loader: 'file-loader',
76+
query: {
77+
name: '[name].[ext]',
78+
outputPath: 'images/'
79+
//the images will be emmited to public/assets/images/ folder
80+
//the images will be put in the DOM <style> tag as eg. background: url(assets/images/image.png);
81+
},
82+
exclude: /node_modules/
7983
},
80-
devtool: sourceMapType,
81-
plugins: pluginArray,
82-
module: {
83-
rules: [{
84-
test: /\.(jpe?g|png|gif)$/i,
85-
loader: "file-loader",
86-
query: {
87-
name: '[name].[ext]',
88-
outputPath: 'images/'
89-
//the images will be emmited to public/assets/images/ folder
90-
//the images will be put in the DOM <style> tag as eg. background: url(assets/images/image.png);
91-
}
92-
},
93-
{
94-
test: /\.css$/,
95-
loaders: ["style-loader", "css-loader"]
96-
}, {
97-
test: require.resolve('jquery'),
98-
use: [{
99-
loader: 'expose-loader',
100-
options: '$'
101-
}]
102-
}
103-
]
104-
}
84+
{
85+
test: /\.css$/,
86+
loaders: ['style-loader', 'css-loader'],
87+
exclude: /node_modules/
88+
},
89+
{
90+
test: require.resolve('jquery'),
91+
use: [{
92+
loader: 'expose-loader',
93+
options: '$'
94+
}]
95+
}
96+
]
97+
}
10598
};

0 commit comments

Comments
 (0)