Skip to content

Commit 9e5b25f

Browse files
authored
chore!: upgrade deps (#38)
Upgrade node and deps, and drop deps in favor of node APIs when possible (`fetch`, `request`, `node:test`, watch mode, env files) fetch cannot be used to send http print requests because it writes a `content-length` header and zebra printers need it but don't support it with this casing (needs to be `Content-Length`, not spec-compliant).
1 parent 1a2497f commit 9e5b25f

24 files changed

+4442
-5394
lines changed

.eslintrc.yml

Lines changed: 0 additions & 3 deletions
This file was deleted.

.github/workflows/dockerimage.yml

Lines changed: 59 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,69 @@
11
name: Docker Image CI
22

33
on:
4-
workflow_dispatch:
5-
inputs:
6-
ref:
7-
description: 'GitHub ref to checkout'
8-
required: true
9-
default: main
10-
tag:
11-
description: 'Docker tag to push (do NOT use "latest" or version numbers)'
12-
required: true
13-
default: 'HEAD'
14-
push:
15-
tags:
16-
- v*
4+
workflow_dispatch:
5+
inputs:
6+
ref:
7+
description: 'GitHub ref to checkout'
8+
required: true
9+
default: main
10+
tag:
11+
description: 'Docker tag to push (do NOT use "latest" or version numbers)'
12+
required: true
13+
default: 'HEAD'
14+
push:
15+
tags:
16+
- v*
1717

1818
env:
19-
REGISTRY: ghcr.io
20-
IMAGE_NAME: ${{ github.repository }}
19+
REGISTRY: ghcr.io
20+
IMAGE_NAME: ${{ github.repository }}
2121

2222
jobs:
23-
build:
24-
name: Build and push image to registry
25-
runs-on: ubuntu-latest
26-
steps:
27-
- uses: actions/checkout@v2
28-
with:
29-
ref: ${{ github.event.inputs.ref }}
23+
build:
24+
name: Build and push image to registry
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v2
28+
with:
29+
ref: ${{ github.event.inputs.ref }}
3030

31-
- name: Build image
32-
run: docker build . --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}"
31+
- name: Build image
32+
run: docker build . --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}"
3333

34-
- name: Log in to registry
35-
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login $REGISTRY -u ${{ github.actor }} --password-stdin
34+
- name: Log in to registry
35+
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login $REGISTRY -u ${{ github.actor }} --password-stdin
3636

37-
- name: Push image (manual)
38-
if: github.event_name == 'workflow_dispatch'
39-
run: |
40-
IMAGE_ID="${REGISTRY}/${IMAGE_NAME}"
41-
# Change all uppercase to lowercase
42-
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
43-
TAG=${{ github.event.inputs.tag }}
44-
echo IMAGE_ID=$IMAGE_ID
45-
echo TAG=$TAG
46-
docker tag $IMAGE_NAME $IMAGE_ID:$TAG
47-
docker push $IMAGE_ID:$TAG
48-
- name: Push image (release)
49-
if: github.event_name != 'workflow_dispatch'
50-
run: |
51-
IMAGE_ID="${REGISTRY}/${IMAGE_NAME}"
52-
# Change all uppercase to lowercase
53-
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
54-
# Strip git ref prefix from version
55-
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
56-
# Strip "v" prefix from tag name
57-
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
58-
VERSION_START=${VERSION%%.*}
59-
echo IMAGE_ID=$IMAGE_ID
60-
echo VERSION=$VERSION
61-
# Push latest
62-
docker tag $IMAGE_NAME $IMAGE_ID:latest
63-
docker push $IMAGE_ID:latest
64-
# Push full version
65-
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
66-
docker push $IMAGE_ID:$VERSION
67-
# Push short version
68-
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION_START
69-
docker push $IMAGE_ID:$VERSION_START
37+
- name: Push image (manual)
38+
if: github.event_name == 'workflow_dispatch'
39+
run: |
40+
IMAGE_ID="${REGISTRY}/${IMAGE_NAME}"
41+
# Change all uppercase to lowercase
42+
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
43+
TAG=${{ github.event.inputs.tag }}
44+
echo IMAGE_ID=$IMAGE_ID
45+
echo TAG=$TAG
46+
docker tag $IMAGE_NAME $IMAGE_ID:$TAG
47+
docker push $IMAGE_ID:$TAG
48+
- name: Push image (release)
49+
if: github.event_name != 'workflow_dispatch'
50+
run: |
51+
IMAGE_ID="${REGISTRY}/${IMAGE_NAME}"
52+
# Change all uppercase to lowercase
53+
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
54+
# Strip git ref prefix from version
55+
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
56+
# Strip "v" prefix from tag name
57+
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
58+
VERSION_START=${VERSION%%.*}
59+
echo IMAGE_ID=$IMAGE_ID
60+
echo VERSION=$VERSION
61+
# Push latest
62+
docker tag $IMAGE_NAME $IMAGE_ID:latest
63+
docker push $IMAGE_ID:latest
64+
# Push full version
65+
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
66+
docker push $IMAGE_ID:$VERSION
67+
# Push short version
68+
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION_START
69+
docker push $IMAGE_ID:$VERSION_START

.github/workflows/nodejs.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,8 @@ jobs:
1010
nodejs:
1111
uses: zakodium/workflows/.github/workflows/nodejs.yml@nodejs-v1
1212
with:
13-
node-version-matrix: '[16, 18, 20]'
13+
node-version-matrix: '[22,24]'
1414
lint-check-types: true
15+
upload-coverage: false
16+
# Not a package
17+
disable-test-package: true

.prettierrc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"arrowParens": "always",
3-
"singleQuote": true,
4-
"tabWidth": 4,
5-
"trailingComma": "all"
2+
"arrowParens": "always",
3+
"singleQuote": true,
4+
"tabWidth": 4,
5+
"trailingComma": "all"
66
}

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
FROM node:16-alpine as builder
1+
FROM node:24-alpine AS builder
22

33
WORKDIR /build
44
COPY . .
55

66
RUN npm ci
77
RUN npm run build
88

9-
FROM node:16-alpine
9+
FROM node:24-alpine
1010

1111
WORKDIR /stock-printer-proxy-source
1212
COPY package.json package-lock.json ./
13-
ENV NODE_ENV production
13+
ENV NODE_ENV=production
1414
RUN npm ci
1515
RUN mkdir lib
1616
COPY --from=builder /build/lib ./lib

README.md

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,34 @@
11
# stock-printer-proxy
22

3-
- Server to launch print commands
4-
- Monitors printers on printers configured in rest-on-couch database
5-
- Sends printer status to rest-on-couch printer database
6-
- Authentication to rest-on-couch uses an [access token](https://github.com/cheminfo/rest-on-couch/blob/main/API.md#tokens)
3+
- Server to launch print commands
4+
- Monitors printers on printers configured in rest-on-couch database
5+
- Sends printer status to rest-on-couch printer database
6+
- Authentication to rest-on-couch uses an [access token](https://github.com/cheminfo/rest-on-couch/blob/main/API.md#tokens)
77

88
The user should have the rights read, write, create and owner.
99

1010
![rights](./rights.png)
1111

12+
# Development
13+
14+
Run a dev server which restarts automatically on code changes:
15+
16+
```bash
17+
npm run dev
18+
```
19+
20+
The dev server has monitoring disabled so it won't be doing DB operations.
21+
The docs can be accessed on http://127.0.0.1:7770/documentation
22+
1223
## Env variables
1324

1425
Those env variables must be defined:
1526

16-
- REST_ON_COUCH_URL
17-
- REST_ON_COUCH_DATABASE
18-
- REST_ON_COUCH_ACCESS_TOKEN
19-
- SERVER_PORT
20-
- PRINTER_PROTOCOL - can be http or tcp, default is `http`
21-
- DISABLE_MONITOR - Do not update registered printers' status in the database, default is `false`
22-
- HOST - Server host, e.g. `printers.my-domain.com`, default is `localhost:<PORT>` - Only needed if you want to expose the swagger documentation of the service.
23-
- BASE_PATH - Base path for the server, default is `/` - Only needed if you want to expose the swagger documentation of the service.
27+
- REST_ON_COUCH_URL
28+
- REST_ON_COUCH_DATABASE
29+
- REST_ON_COUCH_ACCESS_TOKEN
30+
- SERVER_PORT
31+
- PRINTER_PROTOCOL - can be http or tcp, default is `http`
32+
- DISABLE_MONITOR - Do not update registered printers' status in the database, default is `false`
33+
- HOST - Server host, e.g. `printers.my-domain.com`, default is `127.0.0.1:<PORT>` - Only needed if you want to expose the swagger documentation of the service.
34+
- BASE_PATH - Base path for the server, default is `/` - Only needed if you want to expose the swagger documentation of the service.

eslint.config.mjs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { defineConfig, globalIgnores } from 'eslint/config';
2+
import ts from 'eslint-config-zakodium/ts';
3+
4+
export default defineConfig(globalIgnores(['lib']), ts, {
5+
rules: {
6+
'new-cap': 'off',
7+
},
8+
});

jest.config.js

Lines changed: 0 additions & 4 deletions
This file was deleted.

nodemon.json

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)