Skip to content

Commit

Permalink
update Node requirements. This is a follow up from nightscout#7417 si…
Browse files Browse the repository at this point in the history
…nce @bewest already merged his branch to dev

add NodeJS 16.x support.
drop NodeJS 12.x support.It reached End-of-Life status on 30 April 2022
allow NodeJS 18.x support to run for CI
upgrade webpack and webpack-cli
update browserlist and browser documentation, config is now at .browserslistrc
update README.md for browsers and Node versions
fix typos in comments in lib/client/hashauth.js and webpack/webpack.config from nightscout#7440
  • Loading branch information
PieterGit committed Aug 15, 2022
1 parent df85fd2 commit fb4d467
Show file tree
Hide file tree
Showing 10 changed files with 17,386 additions and 610 deletions.
11 changes: 11 additions & 0 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Browsers we support
# See https://github.com/browserslist/browserslist for details

> 0.4%
ios_saf 10.3
ios_saf 13.7
ios_saf 14.8
not dead
not and_uc 12.12
not ie 11

2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x, 16.x]
node-version: [14.x, 16.x, 18.x]
mongodb-version: [4.2, 4.4]

steps:
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14.15.3
16.16.0
33 changes: 19 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Nightscout Web Monitor (a.k.a. cgm-remote-monitor)
======================================
==================================================

![nightscout horizontal](https://cloud.githubusercontent.com/assets/751143/8425633/93c94dc0-1ebc-11e5-99e7-71a8f464caac.png)

Expand Down Expand Up @@ -149,23 +149,28 @@ you're welcome to issue a documentation pull request with instructions on how to

## Recommended minimum browser versions for using Nightscout:

Older versions of the browsers might work, but are untested.
Our [browserslist](https://github.com/browserslist/browserslist) policy is documented in `.browserlistrc`.

- Android 4
- iOS 6
- Chrome 35
- Edge 17
- Firefox 61
- Opera 12.1
- Safari 6 (macOS 10.7)
- Internet Explorer: not supported

- Android Chrome: 104 or later (`and_chr`)
- Google Chrome: 102 or later (`chrome`)
- Microsoft Edge: 103 or later (`edge`)
- Mozilla Firefox: 102 or later (`firefox`)
- Apple Safari on iOS: 15.5 or later (`ios_saf`)
- Apple Safari on iOS also works for iOS 10.3.4, 12.2-12.5, 13.4-13.7, 14.x, 15.2-15.4 but is not recommended because it's not maintained by Apple (`ios_saf`)
- Opera Mini on Android: 63 or later (`op_mini`)
- Opera: 88 or later (`opera`)
- Apple Safari for macOS 10.15 Catalina or later: : 15.5 or later (`safari`)
- Samsung Internet on Android: 12 or later (`samsung`)
- Internet Explorer 11 : not supported

Older versions or other browsers might work, but are untested and unsupported.
Some features may not work with devices/browsers on the older end of these requirements.

## Windows installation software requirements:
## Installation software requirements:

- [Node.js](http://nodejs.org/) Latest Node 12 LTS. Node versions that do not have the latest security patches will not work. Use [Install instructions for Node](https://nodejs.org/en/download/package-manager/) or use `bin/setup.sh`)
- [MongoDB](https://www.mongodb.com/download-center?jmp=nav#community) 3.x or later. MongoDB 2.4 is only supported for Raspberry Pi.
- [Node.js](http://nodejs.org/) Latest Node v14 or v16 LTS. Node versions that do not have the latest security patches will not be supported. Use [Install instructions for Node](https://nodejs.org/en/download/package-manager/) or use `bin/setup.sh`)
- [MongoDB](https://www.mongodb.com/download-center?jmp=nav#community) 4.2 or 4.4.

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

Expand All @@ -184,7 +189,7 @@ $ npm install

- If deploying the software to Microsoft Azure, you must set ** in the app settings for *WEBSITE_NODE_DEFAULT_VERSION* and *SCM_COMMAND_IDLE_TIMEOUT* **before** you deploy the latest Nightscout or the site deployment will likely fail. Other hosting environments do not require this setting. Additionally, if using the Azure free hosting tier, the installation might fail due to resource constraints imposed by Azure on the free hosting. Please set the following settings to the environment in Azure:
```
WEBSITE_NODE_DEFAULT_VERSION=10.15.2
WEBSITE_NODE_DEFAULT_VERSION=16.16.0
SCM_COMMAND_IDLE_TIMEOUT=300
```
- See [install MongoDB, Node.js, and Nightscouton a single Windows system](https://github.com/jaylagorio/Nightscout-on-Windows-Server). if you want to host your Nightscout outside of the cloud. Although the instructions are intended for Windows Server the procedure is compatible with client versions of Windows such as Windows 7 and Windows 10.
Expand Down
2 changes: 1 addition & 1 deletion azuredeploy.json
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@
},
"WEBSITE_NODE_DEFAULT_VERSION": {
"type": "string",
"defaultValue": "8.11.1"
"defaultValue": "16.16.0"
}
},
"resources": [{
Expand Down
2 changes: 1 addition & 1 deletion lib/client/hashauth.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ hashauth.init = function init (client, $) {
client.browserUtils.reload();
}

// clear eveything just in case
// clear everything just in case
hashauth.apisecret = null;
hashauth.apisecrethash = null;
hashauth.authenticated = false;
Expand Down
16 changes: 12 additions & 4 deletions lib/server/bootevent.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ function boot (env, language) {

//////////////////////////////////////////////////
// Check Node version.
// Latest Node 10 to 14 LTS are recommended and supported.
// Latest Node LTS releases are recommended and supported.
// Current Node releases MAY work, but are not recommended. Will be tested in CI
// Older Node versions or Node versions with known security issues will not work.
///////////////////////////////////////////////////
function checkNodeVersion (ctx, next) {
Expand All @@ -35,14 +36,21 @@ function boot (env, language) {

const isLTS = process.release.lts ? true : false;

if (isLTS && (semver.satisfies(nodeVersion, '^16.0.0') || semver.satisfies(nodeVersion, '^14.0.0') || semver.satisfies(nodeVersion, '^12.0.0') || semver.satisfies(nodeVersion, '^10.0.0'))) {
//Latest Node 10 LTS and Node 12 LTS are recommended and supported.
//Require at least Node 8 LTS and Node 10 LTS without known security issues
if (isLTS && (semver.satisfies(nodeVersion, '^16.16.0') || semver.satisfies(nodeVersion, '^14.20.0'))) {
//Latest Node 14 LTS and Node 16 LTS are recommended and supported.
//Require at least Node 14 without known security issues
console.debug('Node LTS version ' + nodeVersion + ' is supported');
next();
return;
}

if (semver.satisfies(nodeVersion, '^18.7.0')) {
//Latest Node 18 is used for CI. It is not recommended nor supported.
console.debug('Node version ' + nodeVersion + ' should work, but is currently not supported');
next();
return;
}

console.log( 'ERROR: Node version ' + nodeVersion + ' is not supported. Please use a secure LTS version or upgrade your Node');
process.exit(1);

Expand Down
Loading

0 comments on commit fb4d467

Please sign in to comment.