clarify support for node 12 and 14

* run node 12, 14, and 16 (next to be supported) on CI. This will catch
  node version-specific problems like that solved in dad9bdc.
* mention 12 and 14 in build instructions and link to instructions for
  installing that version.
* follow this in Dockerfile, installing version 14. This addresses
  a "Cannot find module 'worker_threads'" error introduced in
  39a63e0, which (inadvisedly) upgraded gzipper 4->5 in addition to
  the material-ui upgrade.
* use utf-8 encoding rather than ascii in live part parser. Those
  builds apparently don't support ascii. iThey must use "small-icu" or
  have ICU disabled, as described here:
  https://nodejs.org/api/util.html#util_encodings_supported_when_node_js_is_built_with_the_small_icu_option
This commit is contained in:
Scott Lamb 2021-08-11 22:27:36 -07:00
parent 6426745c8c
commit 164c8c5b21
5 changed files with 24 additions and 18 deletions

View File

@ -8,13 +8,10 @@ env:
jobs:
rust:
name: Test Rust server code
name: Rust ${{ matrix.rust }}
strategy:
matrix:
rust:
- stable
- 1.52
- nightly
rust: [ "stable", "1.52", "nightly" ]
include:
- rust: nightly
extra_args: "--features nightly --benches"
@ -47,17 +44,16 @@ jobs:
if: matrix.rust == 'stable'
run: cd server && cargo fmt --all -- --check
js:
name: Build, test, lint, and check formatting of Javascript frontend
name: Node ${{ matrix.node }}
strategy:
matrix:
node: [ "12", "14", "16", "18" ]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: "14"
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
node-version: ${{ matrix.node }}
- run: cd ui && npm ci
- run: cd ui && npm run build
- run: cd ui && npm run test

View File

@ -14,6 +14,8 @@ exec > >(tee -i /docker-build-debug/build-ui/output) 2>&1
date
uname -a
node --version
npm --version
time npm ci
time npm run build

View File

@ -32,7 +32,6 @@ packages+=(
curl
pkgconf
locales
npm
sudo
sqlite3
tzdata
@ -41,6 +40,10 @@ packages+=(
time apt-get update
time apt-get install --assume-yes --no-install-recommends "${packages[@]}"
# Install a more recent nodejs/npm than in the universe repository.
time curl -sL https://deb.nodesource.com/setup_14.x | bash -
time apt-get install nodejs
# Create the user. On the dev environment, allow sudo.
groupadd \
--gid="${BUILD_GID}" \
@ -55,7 +58,6 @@ useradd \
moonfire-nvr
echo 'moonfire-nvr ALL=(ALL) NOPASSWD: ALL' >>/etc/sudoers
# Install Rust. Note curl was already installed for yarn above.
time su moonfire-nvr -lc "
curl --proto =https --tlsv1.2 -sSf https://sh.rustup.rs |

View File

@ -170,10 +170,11 @@ To build the server, you will need the following C libraries installed:
* [`ncursesw`](https://www.gnu.org/software/ncurses/), the UTF-8 version of
the `ncurses` library.
To build the UI, you'll need [node and npm](https://nodejs.org/en/download/).
To build the UI, you'll need a [nodejs](https://nodejs.org/en/download/) release
in "Maintenance LTS" or "Active LTS" status: currently v12 or v14.
On recent Ubuntu or Raspbian Linux, the following command will install
all non-Rust dependencies:
most non-Rust dependencies:
```
$ sudo apt-get install \
@ -183,12 +184,17 @@ $ sudo apt-get install \
libavutil-dev \
libncurses-dev \
libsqlite3-dev \
npm \
pkgconf \
sqlite3 \
tzdata
```
Ubuntu 20.04 (the latest LTS as of this writing) bundles node 10, which has
reached end-of-life (see [node.js: releases](https://nodejs.org/en/about/releases/)).
So rather than install the `nodejs` and `npm` packages from the built-in
repository, see [Installing Node.js via package
manager](https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions).
On macOS with [Homebrew](https://brew.sh/) and Xcode installed, try the
following command:

View File

@ -18,7 +18,7 @@ interface ParseError {
errorMessage: string;
}
const ASCII_DECODER = new TextDecoder("ascii");
const DECODER = new TextDecoder("utf-8");
const CR = "\r".charCodeAt(0);
const NL = "\n".charCodeAt(0);
@ -37,7 +37,7 @@ export function parsePart(raw: Uint8Array): ParseResult {
errorMessage: "header that never ends (no '\\r\\n')!",
};
}
const line = ASCII_DECODER.decode(raw.slice(pos, cr));
const line = DECODER.decode(raw.slice(pos, cr));
pos = cr + 2;
if (line.length === 0) {
break;