📦 build: run TypeScript directly with Bun, drop the tsc build step

This commit is contained in:
2026-07-13 16:59:54 +07:00
parent e6c4bc0ccd
commit be0fb27db7
8 changed files with 67 additions and 23 deletions
+2 -1
View File
@@ -10,6 +10,7 @@ node_modules
dist
docs
config
data
frames
.vscode
video.mp4
+35
View File
@@ -0,0 +1,35 @@
HOST=0.0.0.0
PORT=22
# Source video (auto-discovers video.* if unset). Only used to build frames.json.
VIDEO_PATH=video.mp4
MAX_LOOP=5
# Weather to loop the video or play random frames after completion. Options: loop | random
PLAYBACK_MODE=random
# Let viewers switch frame sets with arrow keys
ALLOW_USER_CONTROL=true
# Min ms between arrow-key switches; ignores faster repeats.
SWITCH_DEBOUNCE_MS=120
LOGIN_DELAY=1500
# ASCII rendering (live, no frame rebuild).
# CHARSET: detailed|standard|simple|blocks or custom ramp.
BRIGHTNESS_THRESHOLD=40
CHARSET=blocks
INVERT=false
# Max rendered width/height in characters.
MAX_DIMENSION=1080
# Stored frame resolution (px).
# Higher = sharper but bigger frames.json. Rebuild required.
FRAME_RESOLUTION=512
MAX_CONNECTIONS=10
MAX_TOTAL_CONNECTIONS=1000
MAX_AUTH_ATTEMPTS=6
HANDSHAKE_TIMEOUT=10000
LOG_CREDENTIALS=true
# Minimum log level to emit: debug | info | warn | error
LOG_LEVEL=info
+1 -1
View File
@@ -17,7 +17,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
bun-version: [latest, "1.1"]
bun-version: ["1.2"]
steps:
- uses: actions/checkout@v4
+5 -2
View File
@@ -1,7 +1,10 @@
video.mp4
#Configs
config/
# Host keys & text assets
data/
# Generated frame sets
frames/
#VSCode
.vscode
+4 -13
View File
@@ -1,14 +1,4 @@
FROM oven/bun:1 AS build
WORKDIR /home/bun/app
COPY package.json bun.lock ./
RUN bun install --frozen-lockfile
COPY tsconfig.json ./
COPY src ./src
RUN bun run build
FROM oven/bun:1-slim
FROM oven/bun:1.2-slim
WORKDIR /home/bun/app
RUN apt-get update -y && \
@@ -18,6 +8,7 @@ RUN apt-get update -y && \
COPY package.json bun.lock ./
RUN bun install --frozen-lockfile --production
COPY --from=build /home/bun/app/dist ./dist
COPY tsconfig.json ./
COPY src ./src
CMD ["bun", "dist/index.js"]
CMD ["bun", "src/index.ts"]
+14
View File
@@ -0,0 +1,14 @@
services:
trollssh:
image: ghcr.io/yuzuzensai/trollssh:latest
container_name: trollssh
restart: unless-stopped
ports:
- "22:22"
env_file:
- .env
volumes:
# Host keys + banner/fakelogin/goodbye text assets (persisted).
- ./data:/home/bun/app/data
# Pre-generated frame sets
- ./frames:/home/bun/app/frames
+5 -4
View File
@@ -1,21 +1,22 @@
{
"name": "trollssh",
"version": "1.0.0",
"main": "index.js",
"main": "src/index.ts",
"repository": "https://github.com/YuzuZensai/TrollSSH.git",
"author": "Yuzu <yuzu@kirameki.cafe>",
"license": "GPL-3.0",
"engines": {
"bun": ">=1.2.0"
},
"scripts": {
"dev": "bun --watch src/index.ts",
"build": "tsc -b",
"start": "bun dist/index.js",
"start": "bun src/index.ts",
"typecheck": "tsc --noEmit",
"lint": "eslint .",
"format": "prettier --check .",
"format:fix": "prettier --write .",
"test": "bun test",
"docker-build": "docker build . -t ghcr.io/yuzuzensai/trollssh:latest",
"docker-run": "docker run -d --name trollssh --mount type=bind,source=\"$(pwd)\"/config,target=/home/node/app/config --mount type=bind,source=\"$(pwd)\"/video.mp4,target=/home/node/app/video.mp4 --network host --env-file .env ghcr.io/yuzuzensai/trollssh:latest",
"docker-push": "docker push ghcr.io/yuzuzensai/trollssh:latest"
},
"devDependencies": {
+1 -2
View File
@@ -3,8 +3,7 @@
"target": "ES2022",
"module": "node16",
"moduleResolution": "node16",
"outDir": "./dist",
"rootDir": "./src",
"noEmit": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,