refactor: replace node with bun
All checks were successful
CI / Test (pull_request) Successful in 39s

This commit is contained in:
2025-01-07 18:03:28 +01:00
parent 774e638d51
commit 5a9da1bfd9
8 changed files with 34 additions and 5915 deletions

1
.bun-version Normal file
View File

@@ -0,0 +1 @@
1.1.42

View File

@@ -16,19 +16,18 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Setup Node.js - uses: oven-sh/setup-bun@v2
uses: actions/setup-node@v4
with: with:
node-version: ${{ inputs.node-version }} bun-version-file: ".bun-version"
- name: Install dependencies - name: Install dependencies
run: npm install run: bun install --frozen-lockfile
- name: Run lint - name: Run lint
run: npm run check:code run: bun run check:code
- name: Run spellcheck - name: Run spellcheck
run: npm run check:spell run: bun run check:spell
build_and_push: build_and_push:
name: Build and push name: Build and push

View File

@@ -1,4 +1,5 @@
name: CI name: CI
on: on:
pull_request: pull_request:
@@ -10,16 +11,15 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Setup Node.js - uses: oven-sh/setup-bun@v2
uses: actions/setup-node@v4
with: with:
node-version: ${{ inputs.node-version }} bun-version-file: ".bun-version"
- name: Install dependencies - name: Install dependencies
run: npm install run: bun install --frozen-lockfile
- name: Run lint - name: Run lint
run: npm run check:code run: bun run check:code
- name: Run spellcheck - name: Run spellcheck
run: npm run check:spell run: bun run check:spell

1
.nvmrc
View File

@@ -1 +0,0 @@
v18.12.1

View File

@@ -1,13 +1,23 @@
FROM node:18.12-slim FROM oven/bun:1.1.42 AS base
WORKDIR /app WORKDIR /app
COPY ["package.json", "package-lock.json", "./"] FROM base AS install
RUN mkdir -p /temp/dev
COPY package.json bun.lockb /temp/dev/
RUN cd /temp/dev && bun install --frozen-lockfile
RUN npm install RUN mkdir -p /temp/prod
COPY package.json bun.lockb /temp/prod/
RUN cd /temp/prod && bun install --frozen-lockfile --production
FROM base AS build
COPY --from=install /temp/dev/node_modules node_modules
COPY . . COPY . .
RUN bun run build
RUN npm run build FROM base as release
COPY --from=install /temp/prod/node_modules node_modules
COPY --from=build /app/dist .
CMD [ "node", "dist/app.js"] CMD [ "node", "/app/app.js"]

BIN
bun.lockb Executable file

Binary file not shown.

5894
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{ {
"scripts": { "scripts": {
"build": "npx tsc", "build": "bun build --minify --target bun --outdir dist --sourcemap src/app.ts",
"check:code": "eslint src/ --ext .ts", "check:code": "eslint src/ --ext .ts",
"check:spell": "cspell --config cspell.code.json **/*.ts" "check:spell": "cspell --config cspell.code.json **/*.ts"
}, },
@@ -10,11 +10,15 @@
"@typescript-eslint/parser": "^5.46.0", "@typescript-eslint/parser": "^5.46.0",
"cspell": "^6.17.0", "cspell": "^6.17.0",
"eslint": "^8.29.0", "eslint": "^8.29.0",
"typescript": "^4.9.3" "typescript": "^4.9.3",
"@types/bun": "latest"
}, },
"dependencies": { "dependencies": {
"gotify": "^1.1.0", "gotify": "^1.1.0",
"ts3-nodejs-library": "^3.4.1", "ts3-nodejs-library": "^3.4.1",
"winston": "^3.8.2" "winston": "^3.8.2"
} },
"name": "ts3gotify",
"module": "src/app.ts",
"type": "module"
} }