From e0b1e2b044dc88f30c9aeb6555bc41ac80162684 Mon Sep 17 00:00:00 2001 From: Egor Date: Thu, 22 Jan 2026 23:03:28 -0800 Subject: [PATCH] unify lock files --- server/.env.example => .env.example | 0 bun.lock | 37 +++++++++++++++++++++-- package.json | 18 +++++++++-- server/Dockerfile | 8 ++--- server/bun.lock | 47 ----------------------------- server/constants/paths.ts | 7 +++-- server/package.json | 25 --------------- tsconfig.json | 4 +++ 8 files changed, 62 insertions(+), 84 deletions(-) rename server/.env.example => .env.example (100%) delete mode 100644 server/bun.lock delete mode 100644 server/package.json diff --git a/server/.env.example b/.env.example similarity index 100% rename from server/.env.example rename to .env.example diff --git a/bun.lock b/bun.lock index 7d8a996..609206c 100644 --- a/bun.lock +++ b/bun.lock @@ -4,10 +4,17 @@ "workspaces": { "": { "name": "sup", + "dependencies": { + "chalk": "5.6.2", + "hono": "4.11.5", + "hono-rate-limiter": "0.5.3", + "imap": "0.8.19", + }, "devDependencies": { - "@biomejs/biome": "^2.3.11", - "@types/bun": "^1.3.6", - "typescript": "^5.9.3", + "@biomejs/biome": "2.3.11", + "@types/bun": "1.3.6", + "@types/imap": "0.8.43", + "typescript": "5.9.3", }, }, }, @@ -32,12 +39,36 @@ "@types/bun": ["@types/bun@1.3.6", "", { "dependencies": { "bun-types": "1.3.6" } }, "sha512-uWCv6FO/8LcpREhenN1d1b6fcspAB+cefwD7uti8C8VffIv0Um08TKMn98FynpTiU38+y2dUO55T11NgDt8VAA=="], + "@types/imap": ["@types/imap@0.8.43", "", { "dependencies": { "@types/node": "*" } }, "sha512-POPoqrDax9mxM2N4ITZYCWaFtg1ORVfzJe4S7xwSh9aHawdEb7FwWTJYiAhzIvWp7DM+6BajnzYOwZ1BUrqtow=="], + "@types/node": ["@types/node@25.0.7", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-C/er7DlIZgRJO7WtTdYovjIFzGsz0I95UlMyR9anTb4aCpBSRWe5Jc1/RvLKUfzmOxHPGjSE5+63HgLtndxU4w=="], "bun-types": ["bun-types@1.3.6", "", { "dependencies": { "@types/node": "*" } }, "sha512-OlFwHcnNV99r//9v5IIOgQ9Uk37gZqrNMCcqEaExdkVq3Avwqok1bJFmvGMCkCE0FqzdY8VMOZpfpR3lwI+CsQ=="], + "chalk": ["chalk@5.6.2", "", {}, "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA=="], + + "core-util-is": ["core-util-is@1.0.3", "", {}, "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ=="], + + "hono": ["hono@4.11.5", "", {}, "sha512-WemPi9/WfyMwZs+ZUXdiwcCh9Y+m7L+8vki9MzDw3jJ+W9Lc+12HGsd368Qc1vZi1xwW8BWMMsnK5efYKPdt4g=="], + + "hono-rate-limiter": ["hono-rate-limiter@0.5.3", "", { "peerDependencies": { "hono": "^4.10.8", "unstorage": "^1.17.3" }, "optionalPeers": ["unstorage"] }, "sha512-M0DxbVMpPELEzLi0AJg1XyBHLGJXz7GySjsPoK+gc5YeeBsdGDGe+2RvVuCAv8ydINiwlbxqYMNxUEyYfRji/A=="], + + "imap": ["imap@0.8.19", "", { "dependencies": { "readable-stream": "1.1.x", "utf7": ">=1.0.2" } }, "sha512-z5DxEA1uRnZG73UcPA4ES5NSCGnPuuouUx43OPX7KZx1yzq3N8/vx2mtXEShT5inxB3pRgnfG1hijfu7XN2YMw=="], + + "inherits": ["inherits@2.0.4", "", {}, "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="], + + "isarray": ["isarray@0.0.1", "", {}, "sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ=="], + + "readable-stream": ["readable-stream@1.1.14", "", { "dependencies": { "core-util-is": "~1.0.0", "inherits": "~2.0.1", "isarray": "0.0.1", "string_decoder": "~0.10.x" } }, "sha512-+MeVjFf4L44XUkhM1eYbD8fyEsxcV81pqMSR5gblfcLCHfZvbrqy4/qYHE+/R5HoBUT11WV5O08Cr1n3YXkWVQ=="], + + "semver": ["semver@5.3.0", "", { "bin": { "semver": "./bin/semver" } }, "sha512-mfmm3/H9+67MCVix1h+IXTpDwL6710LyHuk7+cWC9T1mE0qz4iHhh6r4hU2wrIT9iTsAAC2XQRvfblL028cpLw=="], + + "string_decoder": ["string_decoder@0.10.31", "", {}, "sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ=="], + "typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="], "undici-types": ["undici-types@7.16.0", "", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="], + + "utf7": ["utf7@1.0.2", "", { "dependencies": { "semver": "~5.3.0" } }, "sha512-qQrPtYLLLl12NF4DrM9CvfkxkYI97xOb5dsnGZHE3teFr0tWiEZ9UdgMPczv24vl708cYMpe6mGXGHrotIp3Bw=="], } } diff --git a/package.json b/package.json index 583b6a4..e9a6a55 100644 --- a/package.json +++ b/package.json @@ -14,15 +14,27 @@ "url": "https://github.com/lone-cloud/sup" }, "scripts": { + "postinstall": "bun run scripts/install-signal-cli.ts || true", + "start": "bun run server/index.ts", + "build": "bun build --compile server/index.ts --outfile server/sup-server", + "check": "tsc --noEmit && biome check .", + "fix": "biome check --write --unsafe .", "android:build": "bun run scripts/test-android-build.ts", "android:release": "bun run scripts/release-android.ts", "android:deps": "bun run scripts/check-android-deps.ts", "android:lockfile": "bun run scripts/update-android-lockfile.ts", "docker:release": "bun run scripts/release-docker.ts" }, + "dependencies": { + "chalk": "5.6.2", + "hono": "4.11.5", + "hono-rate-limiter": "0.5.3", + "imap": "0.8.19" + }, "devDependencies": { - "@biomejs/biome": "^2.3.11", - "@types/bun": "^1.3.6", - "typescript": "^5.9.3" + "@biomejs/biome": "2.3.11", + "@types/bun": "1.3.6", + "@types/imap": "0.8.43", + "typescript": "5.9.3" } } diff --git a/server/Dockerfile b/server/Dockerfile index c7af5df..ce47693 100644 --- a/server/Dockerfile +++ b/server/Dockerfile @@ -2,12 +2,12 @@ FROM oven/bun:1.3.6-debian AS builder WORKDIR /app -COPY server/package.json server/bun.lock* ./ +COPY package.json bun.lock* ./ RUN bun install --frozen-lockfile -COPY server . +COPY server ./server -RUN bun build --compile index.ts --outfile sup-server +RUN bun build --compile server/index.ts --outfile sup-server FROM debian:13.3-slim @@ -35,7 +35,7 @@ RUN ARCH=$(uname -m) && \ fi COPY --from=builder /app/sup-server /usr/local/bin/sup-server -COPY --from=builder /app/public /public +COPY --from=builder /app/server/public /public ENV PATH="/usr/local/signal-cli/bin:${PATH}" ENV LD_LIBRARY_PATH="/usr/local/signal-cli/lib:${LD_LIBRARY_PATH}" diff --git a/server/bun.lock b/server/bun.lock deleted file mode 100644 index b274d17..0000000 --- a/server/bun.lock +++ /dev/null @@ -1,47 +0,0 @@ -{ - "lockfileVersion": 1, - "configVersion": 1, - "workspaces": { - "": { - "name": "sup-server", - "dependencies": { - "chalk": "^5.6.2", - "hono": "^4.11.5", - "hono-rate-limiter": "^0.5.3", - "imap": "^0.8.19", - }, - "devDependencies": { - "@types/imap": "^0.8.43", - }, - }, - }, - "packages": { - "@types/imap": ["@types/imap@0.8.43", "", { "dependencies": { "@types/node": "*" } }, "sha512-POPoqrDax9mxM2N4ITZYCWaFtg1ORVfzJe4S7xwSh9aHawdEb7FwWTJYiAhzIvWp7DM+6BajnzYOwZ1BUrqtow=="], - - "@types/node": ["@types/node@25.0.9", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-/rpCXHlCWeqClNBwUhDcusJxXYDjZTyE8v5oTO7WbL8eij2nKhUeU89/6xgjU7N4/Vh3He0BtyhJdQbDyhiXAw=="], - - "chalk": ["chalk@5.6.2", "", {}, "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA=="], - - "core-util-is": ["core-util-is@1.0.3", "", {}, "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ=="], - - "hono": ["hono@4.11.5", "", {}, "sha512-WemPi9/WfyMwZs+ZUXdiwcCh9Y+m7L+8vki9MzDw3jJ+W9Lc+12HGsd368Qc1vZi1xwW8BWMMsnK5efYKPdt4g=="], - - "hono-rate-limiter": ["hono-rate-limiter@0.5.3", "", { "peerDependencies": { "hono": "^4.10.8", "unstorage": "^1.17.3" }, "optionalPeers": ["unstorage"] }, "sha512-M0DxbVMpPELEzLi0AJg1XyBHLGJXz7GySjsPoK+gc5YeeBsdGDGe+2RvVuCAv8ydINiwlbxqYMNxUEyYfRji/A=="], - - "imap": ["imap@0.8.19", "", { "dependencies": { "readable-stream": "1.1.x", "utf7": ">=1.0.2" } }, "sha512-z5DxEA1uRnZG73UcPA4ES5NSCGnPuuouUx43OPX7KZx1yzq3N8/vx2mtXEShT5inxB3pRgnfG1hijfu7XN2YMw=="], - - "inherits": ["inherits@2.0.4", "", {}, "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="], - - "isarray": ["isarray@0.0.1", "", {}, "sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ=="], - - "readable-stream": ["readable-stream@1.1.14", "", { "dependencies": { "core-util-is": "~1.0.0", "inherits": "~2.0.1", "isarray": "0.0.1", "string_decoder": "~0.10.x" } }, "sha512-+MeVjFf4L44XUkhM1eYbD8fyEsxcV81pqMSR5gblfcLCHfZvbrqy4/qYHE+/R5HoBUT11WV5O08Cr1n3YXkWVQ=="], - - "semver": ["semver@5.3.0", "", { "bin": { "semver": "./bin/semver" } }, "sha512-mfmm3/H9+67MCVix1h+IXTpDwL6710LyHuk7+cWC9T1mE0qz4iHhh6r4hU2wrIT9iTsAAC2XQRvfblL028cpLw=="], - - "string_decoder": ["string_decoder@0.10.31", "", {}, "sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ=="], - - "undici-types": ["undici-types@7.16.0", "", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="], - - "utf7": ["utf7@1.0.2", "", { "dependencies": { "semver": "~5.3.0" } }, "sha512-qQrPtYLLLl12NF4DrM9CvfkxkYI97xOb5dsnGZHE3teFr0tWiEZ9UdgMPczv24vl708cYMpe6mGXGHrotIp3Bw=="], - } -} diff --git a/server/constants/paths.ts b/server/constants/paths.ts index 5eff36c..2cc10ee 100644 --- a/server/constants/paths.ts +++ b/server/constants/paths.ts @@ -1,6 +1,6 @@ const HOME = process.env.HOME || '/root'; -const SIGNAL_CLI_BIN = '../signal-cli/bin/signal-cli'; +const SIGNAL_CLI_BIN = `${import.meta.dir}/../../signal-cli/bin/signal-cli`; export const SIGNAL_CLI = (await Bun.file(SIGNAL_CLI_BIN).exists()) ? SIGNAL_CLI_BIN : 'signal-cli'; export const SIGNAL_CLI_SOCKET = '/tmp/signal-cli.sock'; @@ -9,4 +9,7 @@ export const SIGNAL_CLI_DATA = `${HOME}/.local/share/signal-cli/data`; export const SUP_DB = `${HOME}/.local/share/sup/store.db`; -export const PUBLIC_DIR = (await Bun.file('public/favicon.webp').exists()) ? 'public' : '/public'; +const PUBLIC_DIR_LOCAL = `${import.meta.dir}/../public`; +export const PUBLIC_DIR = (await Bun.file(`${PUBLIC_DIR_LOCAL}/favicon.webp`).exists()) + ? PUBLIC_DIR_LOCAL + : '/public'; diff --git a/server/package.json b/server/package.json deleted file mode 100644 index b345d26..0000000 --- a/server/package.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "sup-server", - "version": "0.1.0", - "description": "Privacy-preserving push notifications using Signal as transport", - "module": "index.ts", - "type": "module", - "private": true, - "license": "AGPL-3.0-or-later", - "dependencies": { - "chalk": "^5.6.2", - "hono": "^4.11.5", - "hono-rate-limiter": "^0.5.3", - "imap": "^0.8.19" - }, - "devDependencies": { - "@types/imap": "^0.8.43" - }, - "scripts": { - "postinstall": "bun run ../scripts/install-signal-cli.ts || true", - "start": "bun run index.ts", - "build": "bun build --compile index.ts --outfile sup-server", - "check": "tsc --noEmit && biome check .", - "fix": "biome check --write --unsafe ." - } -} diff --git a/tsconfig.json b/tsconfig.json index cbb453f..2159107 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,6 +8,10 @@ "allowImportingTsExtensions": true, "verbatimModuleSyntax": true, "noEmit": true, + "baseUrl": ".", + "paths": { + "@/*": ["server/*"] + }, "strict": true, "skipLibCheck": true,