📦 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 dist
docs docs
config data
frames
.vscode .vscode
video.mp4 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 fail-fast: false
matrix: matrix:
os: [ubuntu-latest] os: [ubuntu-latest]
bun-version: [latest, "1.1"] bun-version: ["1.2"]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
+5 -2
View File
@@ -1,7 +1,10 @@
video.mp4 video.mp4
#Configs # Host keys & text assets
config/ data/
# Generated frame sets
frames/
#VSCode #VSCode
.vscode .vscode
+4 -13
View File
@@ -1,14 +1,4 @@
FROM oven/bun:1 AS build FROM oven/bun:1.2-slim
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
WORKDIR /home/bun/app WORKDIR /home/bun/app
RUN apt-get update -y && \ RUN apt-get update -y && \
@@ -18,6 +8,7 @@ RUN apt-get update -y && \
COPY package.json bun.lock ./ COPY package.json bun.lock ./
RUN bun install --frozen-lockfile --production 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", "name": "trollssh",
"version": "1.0.0", "version": "1.0.0",
"main": "index.js", "main": "src/index.ts",
"repository": "https://github.com/YuzuZensai/TrollSSH.git", "repository": "https://github.com/YuzuZensai/TrollSSH.git",
"author": "Yuzu <yuzu@kirameki.cafe>", "author": "Yuzu <yuzu@kirameki.cafe>",
"license": "GPL-3.0", "license": "GPL-3.0",
"engines": {
"bun": ">=1.2.0"
},
"scripts": { "scripts": {
"dev": "bun --watch src/index.ts", "dev": "bun --watch src/index.ts",
"build": "tsc -b", "start": "bun src/index.ts",
"start": "bun dist/index.js",
"typecheck": "tsc --noEmit", "typecheck": "tsc --noEmit",
"lint": "eslint .", "lint": "eslint .",
"format": "prettier --check .", "format": "prettier --check .",
"format:fix": "prettier --write .", "format:fix": "prettier --write .",
"test": "bun test", "test": "bun test",
"docker-build": "docker build . -t ghcr.io/yuzuzensai/trollssh:latest", "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" "docker-push": "docker push ghcr.io/yuzuzensai/trollssh:latest"
}, },
"devDependencies": { "devDependencies": {
+1 -2
View File
@@ -3,8 +3,7 @@
"target": "ES2022", "target": "ES2022",
"module": "node16", "module": "node16",
"moduleResolution": "node16", "moduleResolution": "node16",
"outDir": "./dist", "noEmit": true,
"rootDir": "./src",
"esModuleInterop": true, "esModuleInterop": true,
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"strict": true, "strict": true,