Skip to content

Commit 42e9ecb

Browse files
committed
Major alpha update to node 20 and Typescript 5.5, rewrite dockerfile for pnpm
Patch required for better-ajv-errors as they declare their types incorrectly. See atlassian/better-ajv-errors#176, fix based on atlassian/better-ajv-errors#177 Updates tsconfig Bumps dependency versions
1 parent dd8fb29 commit 42e9ecb

File tree

8 files changed

+374
-433
lines changed

8 files changed

+374
-433
lines changed

.dockerignore

+4
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
node_modules
22
npm-debug.log
3+
.git
4+
.gitignore
5+
*.md
6+
dist

.github/workflows/publish.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ on:
88
jobs:
99
docker-publish:
1010
name: Publish to Docker Hub
11-
if: "!contains(github.event.head_commit.message, '[ci skip]')"
11+
if: |
12+
!contains(github.event.head_commit.message, '[ci skip]')
1213
runs-on: ubuntu-latest
1314
permissions:
1415
contents: read

Dockerfile

+15-18
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,22 @@
1-
FROM node:16-alpine AS base
2-
FROM base as builder
3-
1+
FROM node:22-alpine AS base
2+
ENV PNPM_HOME="/pnpm"
3+
ENV PATH="$PNPM_HOME:$PATH"
4+
RUN corepack enable
5+
COPY . /app
46
WORKDIR /app
57

6-
COPY package.json /app
7-
COPY yarn.lock /app
8-
COPY tsconfig.json /app
9-
COPY src /app/src
10-
11-
RUN yarn install --frozen-lockfile
12-
RUN yarn build
8+
FROM base AS prod-deps
9+
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile
1310

14-
RUN mv /app/node_modules /app/node_modules_dev
15-
RUN yarn install --frozen-lockfile --production
11+
FROM base AS build
12+
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
13+
RUN pnpm run build
1614

1715
FROM base
16+
COPY --from=prod-deps /app/node_modules /app/node_modules
17+
COPY --from=build /app/dist /app/dist
18+
EXPOSE 8000
1819
STOPSIGNAL SIGINT
19-
WORKDIR /app
20-
21-
COPY --from=builder /app/node_modules /app/node_modules
22-
COPY --from=builder /app/dist /app/dist
23-
COPY --from=builder /app/package.json /app/package.json
20+
ENV NODE_ENV=production
2421

25-
CMD [ "node", "/app/dist/index.js" ]
22+
CMD [ "node", "/app/dist/index.js" ]

package.json

+20-14
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,34 @@
77
},
88
"author": "Daniel Chesterton",
99
"dependencies": {
10-
"ajv": "^8.8.2",
11-
"async-mqtt": "^2.6.1",
12-
"better-ajv-errors": "^1.1.2",
10+
"ajv": "^8.16.0",
11+
"async-mqtt": "^2.6.3",
12+
"better-ajv-errors": "^1.2.0",
1313
"bigint-buffer": "^1.1.5",
1414
"js-yaml": "^4.1.0",
15-
"luxon": "^2.3.0",
16-
"net-snmp": "^3.5.8",
17-
"slugify": "^1.6.5"
15+
"luxon": "^2.5.2",
16+
"net-snmp": "^3.12.0",
17+
"slugify": "^1.6.6"
1818
},
1919
"devDependencies": {
20-
"@tsconfig/node16": "^1.0.2",
21-
"@types/js-yaml": "^4.0.5",
22-
"@types/luxon": "^2.0.8",
23-
"@types/node": "^14.14.27",
24-
"prettier": "^2.5.1",
25-
"ts-node": "^10.4.0",
26-
"typescript": "^4.5.4"
20+
"@tsconfig/node20": "^20.1.4",
21+
"@types/js-yaml": "^4.0.9",
22+
"@types/luxon": "^2.4.0",
23+
"@types/node": "^20.14.10",
24+
"prettier": "^2.8.8",
25+
"ts-node": "^10.9.2",
26+
"typescript": "^5.5.3"
2727
},
2828
"scripts": {
2929
"build": "rm -rf dist && tsc",
3030
"start": "ts-node --files src/index.ts",
31+
"dev": "ts-node --files src/index.ts",
3132
"prettier:write": "prettier src --write"
3233
},
33-
"packageManager": "[email protected]+sha512.140036830124618d624a2187b50d04289d5a087f326c9edfc0ccd733d76c4f52c3a313d4fc148794a2a9d81553016004e6742e8cf850670268a7387fc220c903"
34+
"packageManager": "[email protected]+sha512.140036830124618d624a2187b50d04289d5a087f326c9edfc0ccd733d76c4f52c3a313d4fc148794a2a9d81553016004e6742e8cf850670268a7387fc220c903",
35+
"pnpm": {
36+
"patchedDependencies": {
37+
38+
}
39+
}
3440
}

patches/[email protected]

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
diff --git a/CHANGELOG.md b/CHANGELOG.md
2+
deleted file mode 100644
3+
index 14b6dfaa73957a7832335206511e764cdd2ea730..0000000000000000000000000000000000000000
4+
diff --git a/typings.d.ts b/lib/cjs/typings.d.ts
5+
similarity index 100%
6+
rename from typings.d.ts
7+
rename to lib/cjs/typings.d.ts
8+
diff --git a/lib/esm/typings.d.mts b/lib/esm/typings.d.mts
9+
new file mode 100644
10+
index 0000000000000000000000000000000000000000..580c56f4397ad8d7ba8a9527e95bbe3e973802b8
11+
--- /dev/null
12+
+++ b/lib/esm/typings.d.mts
13+
@@ -0,0 +1,24 @@
14+
+import type { ErrorObject } from 'ajv';
15+
+
16+
+export interface IOutputError {
17+
+ start: { line: number; column: number; offset: number };
18+
+ // Optional for required
19+
+ end?: { line: number; column: number; offset: number };
20+
+ error: string;
21+
+ suggestion?: string;
22+
+}
23+
+
24+
+export interface IInputOptions {
25+
+ format?: 'cli' | 'js';
26+
+ indent?: number | null;
27+
+
28+
+ /** Raw JSON used when highlighting error location */
29+
+ json?: string | null;
30+
+}
31+
+
32+
+export default function <S, T, Options extends IInputOptions>(
33+
+ schema: S,
34+
+ data: T,
35+
+ errors: Array<ErrorObject>,
36+
+ options?: Options
37+
+): Options extends { format: 'js' } ? Array<IOutputError> : string;
38+
diff --git a/package.json b/package.json
39+
index baaa5940665ea50aebee3b93b822d79c62772b6b..7608634ec7c25e99586b4d39e5356eecc8bf7edc 100644
40+
--- a/package.json
41+
+++ b/package.json
42+
@@ -6,8 +6,14 @@
43+
"main": "./lib/cjs/index.js",
44+
"exports": {
45+
".": {
46+
- "require": "./lib/cjs/index.js",
47+
- "default": "./lib/esm/index.mjs"
48+
+ "import": {
49+
+ "types": "./lib/esm/typings.d.mts",
50+
+ "default": "./lib/esm/index.mjs"
51+
+ },
52+
+ "require": {
53+
+ "types": "./lib/cjs/typings.d.ts",
54+
+ "default": "./lib/cjs/index.js"
55+
+ }
56+
}
57+
},
58+
"module": "./lib/esm/index.mjs",
59+
@@ -26,10 +32,9 @@
60+
"Tong Li"
61+
],
62+
"license": "Apache-2.0",
63+
- "types": "./typings.d.ts",
64+
+ "types": "./lib/cjs/typings.d.ts",
65+
"files": [
66+
- "lib",
67+
- "typings.d.ts"
68+
+ "lib"
69+
],
70+
"scripts": {
71+
"prebuild": "rm -rf lib",

0 commit comments

Comments
 (0)