From 03f8916da4825294d3d0d81fc1e27404a5375a6e Mon Sep 17 00:00:00 2001 From: quinm0 Date: Fri, 17 Apr 2026 20:22:54 -0400 Subject: [PATCH] eh --- bun/core/.gitignore | 34 ------------------ bun/core/Dockerfile | 38 -------------------- bun/core/README.md | 15 -------- bun/core/bun.lock | 26 -------------- bun/core/index.ts | 8 ----- bun/core/package.json | 12 ------- bun/core/tsconfig.json | 29 --------------- bun/core/types/ClientOptions.ts | 5 --- bun/core/types/Node.ts | 64 --------------------------------- bun/core/types/ServerOptions.ts | 5 --- 10 files changed, 236 deletions(-) delete mode 100644 bun/core/.gitignore delete mode 100644 bun/core/Dockerfile delete mode 100644 bun/core/README.md delete mode 100644 bun/core/bun.lock delete mode 100644 bun/core/index.ts delete mode 100644 bun/core/package.json delete mode 100644 bun/core/tsconfig.json delete mode 100644 bun/core/types/ClientOptions.ts delete mode 100644 bun/core/types/Node.ts delete mode 100644 bun/core/types/ServerOptions.ts diff --git a/bun/core/.gitignore b/bun/core/.gitignore deleted file mode 100644 index a14702c..0000000 --- a/bun/core/.gitignore +++ /dev/null @@ -1,34 +0,0 @@ -# dependencies (bun install) -node_modules - -# output -out -dist -*.tgz - -# code coverage -coverage -*.lcov - -# logs -logs -_.log -report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json - -# dotenv environment variable files -.env -.env.development.local -.env.test.local -.env.production.local -.env.local - -# caches -.eslintcache -.cache -*.tsbuildinfo - -# IntelliJ based IDEs -.idea - -# Finder (MacOS) folder config -.DS_Store diff --git a/bun/core/Dockerfile b/bun/core/Dockerfile deleted file mode 100644 index 745af55..0000000 --- a/bun/core/Dockerfile +++ /dev/null @@ -1,38 +0,0 @@ -# use the official Bun image -# see all versions at https://hub.docker.com/r/oven/bun/tags -FROM oven/bun:1 AS base -WORKDIR /usr/src/app - -# install dependencies into temp directory -# this will cache them and speed up future builds -FROM base AS install -RUN mkdir -p /temp/dev -COPY package.json bun.lock /temp/dev/ -RUN cd /temp/dev && bun install --frozen-lockfile - -# install with --production (exclude devDependencies) -RUN mkdir -p /temp/prod -COPY package.json bun.lock /temp/prod/ -RUN cd /temp/prod && bun install --frozen-lockfile --production - -# copy node_modules from temp directory -# then copy all (non-ignored) project files into the image -FROM base AS prerelease -COPY --from=install /temp/dev/node_modules node_modules -COPY . . - -# [optional] tests & build -ENV NODE_ENV=production -RUN bun test -RUN bun run build - -# copy production dependencies and source code into final image -FROM base AS release -# COPY --from=install /temp/prod/node_modules node_modules -# COPY --from=prerelease /usr/src/app/index.ts . -# COPY --from=prerelease /usr/src/app/package.json . - -# run the app -USER bun -EXPOSE 3000/tcp -ENTRYPOINT [ "bun", "run", "index.ts" ] \ No newline at end of file diff --git a/bun/core/README.md b/bun/core/README.md deleted file mode 100644 index 418f1b2..0000000 --- a/bun/core/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# core - -To install dependencies: - -```bash -bun install -``` - -To run: - -```bash -bun run index.ts -``` - -This project was created using `bun init` in bun v1.3.3. [Bun](https://bun.com) is a fast all-in-one JavaScript runtime. diff --git a/bun/core/bun.lock b/bun/core/bun.lock deleted file mode 100644 index 2023301..0000000 --- a/bun/core/bun.lock +++ /dev/null @@ -1,26 +0,0 @@ -{ - "lockfileVersion": 1, - "configVersion": 1, - "workspaces": { - "": { - "name": "core", - "devDependencies": { - "@types/bun": "latest", - }, - "peerDependencies": { - "typescript": "^5", - }, - }, - }, - "packages": { - "@types/bun": ["@types/bun@1.3.12", "", { "dependencies": { "bun-types": "1.3.12" } }, "sha512-DBv81elK+/VSwXHDlnH3Qduw+KxkTIWi7TXkAeh24zpi5l0B2kUg9Ga3tb4nJaPcOFswflgi/yAvMVBPrxMB+A=="], - - "@types/node": ["@types/node@25.6.0", "", { "dependencies": { "undici-types": "~7.19.0" } }, "sha512-+qIYRKdNYJwY3vRCZMdJbPLJAtGjQBudzZzdzwQYkEPQd+PJGixUL5QfvCLDaULoLv+RhT3LDkwEfKaAkgSmNQ=="], - - "bun-types": ["bun-types@1.3.12", "", { "dependencies": { "@types/node": "*" } }, "sha512-HqOLj5PoFajAQciOMRiIZGNoKxDJSr6qigAttOX40vJuSp6DN/CxWp9s3C1Xwm4oH7ybueITwiaOcWXoYVoRkA=="], - - "typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="], - - "undici-types": ["undici-types@7.19.2", "", {}, "sha512-qYVnV5OEm2AW8cJMCpdV20CDyaN3g0AjDlOGf1OW4iaDEx8MwdtChUp4zu4H0VP3nDRF/8RKWH+IPp9uW0YGZg=="], - } -} diff --git a/bun/core/index.ts b/bun/core/index.ts deleted file mode 100644 index b5189fa..0000000 --- a/bun/core/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { Node } from "./types/Node"; - -const server = new Node({ - runServer: true, -}) - - -const client = new Node({runServer: false}) \ No newline at end of file diff --git a/bun/core/package.json b/bun/core/package.json deleted file mode 100644 index ef951f2..0000000 --- a/bun/core/package.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "core", - "module": "index.ts", - "type": "module", - "private": true, - "devDependencies": { - "@types/bun": "latest" - }, - "peerDependencies": { - "typescript": "^5" - } -} diff --git a/bun/core/tsconfig.json b/bun/core/tsconfig.json deleted file mode 100644 index bfa0fea..0000000 --- a/bun/core/tsconfig.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "compilerOptions": { - // Environment setup & latest features - "lib": ["ESNext"], - "target": "ESNext", - "module": "Preserve", - "moduleDetection": "force", - "jsx": "react-jsx", - "allowJs": true, - - // Bundler mode - "moduleResolution": "bundler", - "allowImportingTsExtensions": true, - "verbatimModuleSyntax": true, - "noEmit": true, - - // Best practices - "strict": true, - "skipLibCheck": true, - "noFallthroughCasesInSwitch": true, - "noUncheckedIndexedAccess": true, - "noImplicitOverride": true, - - // Some stricter flags (disabled by default) - "noUnusedLocals": false, - "noUnusedParameters": false, - "noPropertyAccessFromIndexSignature": false - } -} diff --git a/bun/core/types/ClientOptions.ts b/bun/core/types/ClientOptions.ts deleted file mode 100644 index 03d0b55..0000000 --- a/bun/core/types/ClientOptions.ts +++ /dev/null @@ -1,5 +0,0 @@ -export type NodeClientOptions = { - serverHost?: string; - serverPort?: number; - runServer: false; -}; \ No newline at end of file diff --git a/bun/core/types/Node.ts b/bun/core/types/Node.ts deleted file mode 100644 index eca3a44..0000000 --- a/bun/core/types/Node.ts +++ /dev/null @@ -1,64 +0,0 @@ -import type { NodeClientOptions } from "./ClientOptions"; -import type { NodeServerOptions } from "./ServerOptions"; - -export class Node { - private server: Bun.Server | null = null; - private client: WebSocket | null = null; - - constructor(opts?: NodeClientOptions | NodeServerOptions ){ - if(opts?.runServer){ - this.initServer(opts) - }else{ - this.initClient({ - runServer: false, - serverHost: 'localhost', - serverPort: 3000, - ...opts - }); - } - } - - public initServer(opts: NodeServerOptions){ - this.server = Bun.serve({ - fetch(req, server) { - // upgrade the request to a WebSocket - if (server.upgrade(req)) { - return; // do not return a Response - } - return new Response("Upgrade failed", { status: 500 }); - }, - websocket: { - ping: (ws) => { - console.log(`ws://${ws.remoteAddress} sent ping, responding pong!`) - ws.pong() - ws.sendText('pong') - }, - message: (ws, message) => { - }, - open: (ws) => { - console.log('client connected', ws.remoteAddress) - }, - close: (ws, code, reason) => { - - } - }, - port: opts.serverPort, - }); - - console.log('server running on', this.server.port) - } - - public initClient(opts: NodeClientOptions){ - const newClient = new WebSocket(`ws://${opts.serverHost}:${opts.serverPort}`) - if(newClient !== null){ - newClient.onopen = (ev) => { - console.log('opened client!') - console.log('client: ping') - newClient.ping(); - } - newClient.onmessage = (ev) => { - console.log('message from server', JSON.stringify(ev.data, null, 2)) - } - } - } -} \ No newline at end of file diff --git a/bun/core/types/ServerOptions.ts b/bun/core/types/ServerOptions.ts deleted file mode 100644 index a1da958..0000000 --- a/bun/core/types/ServerOptions.ts +++ /dev/null @@ -1,5 +0,0 @@ -export type NodeServerOptions = { - serverHost?: string; - serverPort?: number; - runServer: true; -}; \ No newline at end of file