!refactor: replace node with bun (#3)
Reviewed-on: #3 Co-authored-by: Timo Behrendt <t.behrendt@t00n.de> Co-committed-by: Timo Behrendt <t.behrendt@t00n.de>
This commit was merged in pull request #3.
This commit is contained in:
1
.bun-version
Normal file
1
.bun-version
Normal file
@@ -0,0 +1 @@
|
||||
1.1.42
|
||||
@@ -16,19 +16,18 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
- uses: oven-sh/setup-bun@v2
|
||||
with:
|
||||
node-version: ${{ inputs.node-version }}
|
||||
bun-version-file: ".bun-version"
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
run: bun install --frozen-lockfile
|
||||
|
||||
- name: Run lint
|
||||
run: npm run check:code
|
||||
run: bun run check:code
|
||||
|
||||
- name: Run spellcheck
|
||||
run: npm run check:spell
|
||||
run: bun run check:spell
|
||||
|
||||
build_and_push:
|
||||
name: Build and push
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
@@ -10,16 +11,15 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
- uses: oven-sh/setup-bun@v2
|
||||
with:
|
||||
node-version: ${{ inputs.node-version }}
|
||||
bun-version-file: ".bun-version"
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
run: bun install --frozen-lockfile
|
||||
|
||||
- name: Run lint
|
||||
run: npm run check:code
|
||||
run: bun run check:code
|
||||
|
||||
- name: Run spellcheck
|
||||
run: npm run check:spell
|
||||
run: bun run check:spell
|
||||
|
||||
20
Dockerfile
20
Dockerfile
@@ -1,13 +1,23 @@
|
||||
FROM node:18.12-slim
|
||||
FROM oven/bun:1.1.42 AS base
|
||||
|
||||
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 . .
|
||||
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"]
|
||||
5894
package-lock.json
generated
5894
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
10
package.json
10
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"scripts": {
|
||||
"build": "npx tsc",
|
||||
"build": "bun build --minify --target bun --outdir dist --sourcemap src/app.ts",
|
||||
"check:code": "eslint src/ --ext .ts",
|
||||
"check:spell": "cspell --config cspell.code.json **/*.ts"
|
||||
},
|
||||
@@ -10,11 +10,15 @@
|
||||
"@typescript-eslint/parser": "^5.46.0",
|
||||
"cspell": "^6.17.0",
|
||||
"eslint": "^8.29.0",
|
||||
"typescript": "^4.9.3"
|
||||
"typescript": "^4.9.3",
|
||||
"@types/bun": "latest"
|
||||
},
|
||||
"dependencies": {
|
||||
"gotify": "^1.1.0",
|
||||
"ts3-nodejs-library": "^3.4.1",
|
||||
"winston": "^3.8.2"
|
||||
}
|
||||
},
|
||||
"name": "ts3gotify",
|
||||
"module": "src/app.ts",
|
||||
"type": "module"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user