Update node version to LTS

This commit is contained in:
Thomas Rogers 2024-12-14 02:34:33 +01:00
parent c7fa3824d1
commit e5f0c07ca1
40 changed files with 980 additions and 845 deletions

View file

@ -57,7 +57,7 @@ jobs:
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: 18.16
node-version: 22.12.0
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(source ~/.nvm/nvm.sh && yarn cache dir)"

View file

@ -1 +1 @@
18.16
23.1.0

View file

@ -10,7 +10,8 @@
{
"files": ["test/**/*.ts"],
"rules": {
"@typescript-eslint/no-unsafe-member-access": 0
"@typescript-eslint/no-unsafe-member-access": 0,
"@typescript-eslint/no-unnecessary-type-assertion": 0
}
}
]

View file

@ -1,4 +1,4 @@
FROM node:18.16 AS builder
FROM node:22.12 AS builder
WORKDIR /app
@ -23,7 +23,7 @@ RUN yarn install --pure-lockfile && \
rm -rf /app/packages/api/node_modules /app/node_modules && \
yarn install --pure-lockfile --production
FROM node:18.16-alpine AS runner
FROM node:22.12-alpine AS runner
LABEL org.opencontainers.image.source="https://github.com/omnivore-app/omnivore"
RUN apk update && apk add netcat-openbsd && rm -rf /var/cache/apk/*

View file

@ -1,4 +1,4 @@
FROM node:18.16-alpine
FROM node:22.12-alpine
WORKDIR /app

View file

@ -174,9 +174,9 @@
"ts-node-dev": "^1.1.8"
},
"engines": {
"node": "18.16.1"
"node": "22.12.0"
},
"volta": {
"extends": "../../package.json"
}
}
}

View file

@ -1,4 +1,4 @@
FROM node:18.16 as builder
FROM node:22.12 as builder
WORKDIR /app
@ -38,7 +38,7 @@ RUN rm -rf /app/packages/api/node_modules
RUN rm -rf /app/node_modules
RUN yarn install --pure-lockfile --production
FROM node:18.16 as runner
FROM node:22.12 as runner
LABEL org.opencontainers.image.source="https://github.com/omnivore-app/omnivore"
RUN apt-get update && apt-get install -y netcat-openbsd

View file

@ -20,7 +20,7 @@ export type File = {
publicUrl: () => string
download: () => Promise<Buffer>
exists: () => Promise<boolean>
save: (saveData: SaveData, saveOptions: SaveOptions) => Promise<void>,
save: (saveData: SaveData, saveOptions: SaveOptions) => Promise<void>
createWriteStream: (saveOptions: SaveOptions) => Writable
getMetadataMd5: () => Promise<string | undefined>
bucket: string

View file

@ -4,4 +4,4 @@ import { GcsStorageClient } from './GcsStorageClient'
export const storage = env.fileUpload.useLocalStorage
? new S3StorageClient(env.fileUpload.localMinioUrl)
: new GcsStorageClient(env.fileUpload?.gcsUploadSAKeyFilePath)
: new GcsStorageClient(env.fileUpload?.gcsUploadSAKeyFilePath ?? undefined)

View file

@ -4,6 +4,8 @@
"project": "tsconfig.json"
},
"rules": {
"@typescript-eslint/no-unsafe-assignment": 0,
"@typescript-eslint/no-unnecessary-type-assertion": 0,
"@typescript-eslint/no-floating-promises": [
"error",
{

View file

@ -1,4 +1,4 @@
FROM node:18.16
FROM node:22.12
LABEL org.opencontainers.image.source="https://github.com/omnivore-app/omnivore"
# Installs latest Chromium package.

View file

@ -1,4 +1,4 @@
FROM node:18.16
FROM node:22.12
WORKDIR /app

View file

@ -1,4 +1,4 @@
FROM node:18.16 as builder
FROM node:22.12 as builder
WORKDIR /app
@ -17,7 +17,7 @@ COPY /packages/discover/tsconfig.json ./packages/discover/tsconfig.json
RUN yarn install --pure-lockfile
RUN yarn workspace @omnivore/discover build
FROM node:18.16 as runner
FROM node:22.12 as runner
WORKDIR /app

View file

@ -1,4 +1,4 @@
FROM node:18.16-alpine
FROM node:22.12-alpine
WORKDIR /app

View file

@ -1,4 +1,4 @@
FROM node:18.16-alpine
FROM node:22.12-alpine
WORKDIR /app

View file

@ -1,4 +1,4 @@
FROM node:18.16-alpine
FROM node:22.12-alpine
WORKDIR /app

View file

@ -9,7 +9,6 @@
"keywords": [],
"license": "Apache-2.0",
"scripts": {
"test": "yarn mocha -r ts-node/register --config mocha-config.json",
"test:typecheck": "tsc --noEmit",
"lint": "eslint src --ext ts,js,tsx,jsx",
"compile": "tsc",

View file

@ -1,4 +1,4 @@
FROM node:18.16-alpine
FROM node:22.12-alpine
# Run everything after as non-privileged user.
WORKDIR /app

View file

@ -1,4 +1,4 @@
FROM node:18.16-alpine
FROM node:22.12-alpine
# Run everything after as non-privileged user.
WORKDIR /app

View file

@ -1,4 +1,4 @@
FROM node:18.16-alpine
FROM node:22.12-alpine
# Run everything after as non-privileged user.
WORKDIR /app

View file

@ -1,4 +1,4 @@
FROM node:18.16 as builder
FROM node:22.12 as builder
WORKDIR /app
@ -22,7 +22,7 @@ ADD /packages/utils ./packages/utils
RUN yarn workspace @omnivore/utils build
RUN yarn workspace @omnivore/local-mail-watcher build
FROM node:18.16 as runner
FROM node:22.12 as runner
WORKDIR /app

View file

@ -1,4 +1,4 @@
FROM node:18.16 as builder
FROM node:22.12 as builder
WORKDIR /app
@ -22,7 +22,7 @@ ADD /packages/utils ./packages/utils
RUN yarn workspace @omnivore/utils build
RUN yarn workspace @omnivore/local-mail-watcher build
FROM node:18.16 as runner
FROM node:22.12 as runner
WORKDIR /app

View file

@ -59,7 +59,7 @@ export function getEnv(): WatcherEnv {
apiEndpoint: parse('WATCHER_API_ENDPOINT')!,
sns,
filesystem,
redis
redis,
}
}

View file

@ -73,7 +73,9 @@ app.post('/sns', async (req, res) => {
console.log(`Sns Topic ARN ${snsMessage['TopicArn']}`)
if (snsMessage.TopicArn != env.sns.snsArn) {
console.log(`Topic ARN: ${snsMessage.TopicArn} Doesnt Match ${env.sns.snsArn}, failing...`)
console.log(
`Topic ARN: ${snsMessage.TopicArn} Doesnt Match ${env.sns.snsArn}, failing...`
)
res.status(401).send()
return
}

View file

@ -25,5 +25,3 @@ export const getQueue = async (
await queue.waitUntilReady()
return queue
}

View file

@ -7,7 +7,7 @@ import { env } from './env'
chokidar.watch(env.filesystem.filePath).on('add', (path, _event) => {
console.log(path)
const contents = fs.readFileSync(path).toString()
simpleParser(contents)
void simpleParser(contents)
.then(convertToMailObject)
.then(async (emailData) => {
await sendToEmailApi(emailData)

View file

@ -2,5 +2,10 @@
"extends": "../../.eslintrc",
"parserOptions": {
"project": "tsconfig.json"
},
"rules": {
"@typescript-eslint/no-unsafe-assignment": 0,
"@typescript-eslint/no-unsafe-argument": 0,
"@typescript-eslint/restrict-template-expressions": 0
}
}
}

View file

@ -1,4 +1,4 @@
FROM node:18.16-alpine
FROM node:22.12-alpine
# Run everything after as non-privileged user.
WORKDIR /app

View file

@ -36,7 +36,7 @@
"bullmq": "^5.1.4",
"concurrently": "^7.0.0",
"dotenv": "^8.2.0",
"pdfjs-dist": "^2.9.359"
"pdfjs-dist": "^2.16.105"
},
"volta": {
"extends": "../../package.json"

View file

@ -3,12 +3,13 @@
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-unsafe-argument */
import { getDocument as _getDocument } from 'pdfjs-dist/legacy/build/pdf'
import {
TextItem,
PDFPageProxy,
getDocument as _getDocument,
PDFDocumentProxy,
} from 'pdfjs-dist/types/display/api'
PDFPageProxy,
} from 'pdfjs-dist/legacy/build/pdf'
import { TextItem } from 'pdfjs-dist/types/src/display/api'
interface Page {
lines: string[]
@ -72,7 +73,7 @@ const getMetadataItem = async (
.getMetadata()
.then((metadata) => metadata.info as MetadataInfo)
.then((info) => {
return info[key]
return info[key] as string
})
}
@ -122,7 +123,7 @@ export const readPdfText = async (
const parsePage = async (pdfPage: PDFPageProxy): Promise<Page> => {
const rawContent = await pdfPage.getTextContent()
return parsePageItems(
rawContent.items.filter((item): item is TextItem => 'str' in item)
rawContent.items.filter((item: any): item is TextItem => 'str' in item)
)
}
@ -156,6 +157,7 @@ const parsePageItems = (pdfItems: TextItem[]): Page => {
if (nextY != undefined) {
const currentLineHeight: number = lineData[currentY].reduce(
(finalValue, current) =>
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
finalValue > current.height ? finalValue : current.height,
-1
)

View file

@ -21,7 +21,7 @@ describe('open a simple PDF with a set title', () => {
const doc = await getDocument('./test/pdf/data/pdf-simple-test.pdf')
const result = await getDocumentText(doc)
expect(result).to.equal(
'This is the page title \n \nThis is some more text \n'
'This is the page title\n\nThis is some more text\n'
)
})
})
@ -30,8 +30,9 @@ describe('open a complex PDF with no title', () => {
it('should return some initial content as the title', async () => {
const doc = await getDocument('./test/pdf/data/pdf-complex-test.pdf')
const result = await getDocumentTitle(doc)
console.log(result);
expect(result).to.startWith(
'Improving communications around vaccine breakthrough and vaccine effectiveness'
'Improving communications'
)
})

View file

@ -313,9 +313,7 @@ async function retrievePage(
return request.abort()
}
if (
request.url().toLowerCase().indexOf('mathjax') > -1
) {
if (request.url().toLowerCase().indexOf('mathjax') > -1) {
return request.abort()
}
@ -324,7 +322,6 @@ async function retrievePage(
})
await page.setRequestInterception(true)
page.on('response', (response) => {
if (!response.ok()) {
console.log('Failed request', response.url())

View file

@ -1,4 +1,4 @@
FROM node:18.16-alpine
FROM node:22.12-alpine
# Run everything after as non-privileged user.
WORKDIR /app

View file

@ -1,4 +1,4 @@
FROM node:18.16-alpine
FROM node:22.12-alpine
# Run everything after as non-privileged user.
WORKDIR /app

View file

@ -1,4 +1,4 @@
FROM node:18.16
FROM node:22.12
# Run everything after as non-privileged user.
WORKDIR /app

View file

@ -1,4 +1,4 @@
FROM node:18.16-alpine
FROM node:22.12-alpine
# Run everything after as non-privileged user.
WORKDIR /app

View file

@ -1,4 +1,4 @@
FROM node:18.16
FROM node:22.12
WORKDIR /app

View file

@ -1,4 +1,4 @@
FROM node:18.16 as builder
FROM node:22.12 as builder
WORKDIR /app
@ -17,7 +17,7 @@ COPY /packages/discord/tsconfig.json ./packages/discord/tsconfig.json
RUN yarn install --pure-lockfile
RUN yarn workspace @omnivore/discord build
FROM node:18.16 as runner
FROM node:22.12 as runner
WORKDIR /app

View file

@ -1,4 +1,4 @@
FROM node:18.16-alpine as builder
FROM node:22.12-alpine as builder
WORKDIR /app
@ -39,7 +39,7 @@ RUN rm -rf /app/packages/api/node_modules
RUN rm -rf /app/node_modules
RUN yarn install --pure-lockfile --production
FROM node:18.16-alpine as runner
FROM node:22.12-alpine as runner
WORKDIR /app

1706
yarn.lock

File diff suppressed because it is too large Load diff