| author | |
| committer | |
| log | d6437a7e131ab98706efe31263cddb4ae957557a |
| tree | cf1ba67eba85bce4f9e6da55258292dcdf0f890d |
| parent | 9fc5ad20830a148ae36abf2381efef8283dc3699 |
- Move BranchToolbar below the chat input box to match Codex app layout
- Change worktree path to ~/.t3code/worktrees/{repo}/{branch}
- Split desktop tsdown config into separate main/preload builds to prevent
code-splitting from leaking node:os into the sandboxed preload script
- Migrate turbo scripts to turbo watch, add desktop start/smoke-test tasks
- Update server output to .mjs, add CJS format, remove tsx dependency
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>15 files changed, 86 insertions(+), 36 deletions(-)
README.md+2-2| ... | ... | @@ -59,8 +59,8 @@ npx t3 |
| 59 | 59 | |
| 60 | 60 | ## Scripts |
| 61 | 61 | |
| 62 | - `bun run dev` — Starts contracts, server, and web dev tasks via Turborepo's parallel task runner. | |
| 63 | - `bun run dev:server` — Starts just the WebSocket server (uses tsx for TS execution). | |
| 62 | - `bun run dev` — Starts contracts, server, and web in `turbo watch` mode. | |
| 63 | - `bun run dev:server` — Starts just the WebSocket server (uses Bun TypeScript execution). | |
| 64 | 64 | - `bun run dev:web` — Starts just the Vite dev server for the web app. |
| 65 | 65 | - `bun run start` — Runs the production server (serves built web app as static files). |
| 66 | 66 | - `bun run build` — Builds contracts, web app, and server through Turbo. |
apps/desktop/package.json+1-1| ... | ... | @@ -8,7 +8,7 @@ |
| 8 | 8 | "dev:bundle": "tsdown --watch", |
| 9 | 9 | "dev:electron": "bun run scripts/dev-electron.mjs", |
| 10 | 10 | "build": "tsdown", |
| 11 | "start": "electron dist-electron/main.cjs", | |
| 11 | "start": "electron dist-electron/main.js", | |
| 12 | 12 | "typecheck": "tsc --noEmit", |
| 13 | 13 | "test": "vitest run --passWithNoTests", |
| 14 | 14 | "smoke-test": "node scripts/smoke-test.mjs" |
apps/desktop/scripts/dev-electron.mjs+1-1| ... | ... | @@ -10,7 +10,7 @@ await waitOn({ |
| 10 | 10 | `tcp:${port}`, |
| 11 | 11 | "file:dist-electron/main.js", |
| 12 | 12 | "file:dist-electron/preload.js", |
| 13 | "file:../server/dist/index.js", | |
| 13 | // "file:../server/dist/index.cjs", | |
| 14 | 14 | ], |
| 15 | 15 | }); |
| 16 | 16 |
apps/desktop/scripts/smoke-test.mjs+1-5| ... | ... | @@ -1,16 +1,12 @@ |
| 1 | import { execSync, spawn } from "node:child_process"; | |
| 1 | import { spawn } from "node:child_process"; | |
| 2 | 2 | import { dirname, resolve } from "node:path"; |
| 3 | 3 | import { fileURLToPath } from "node:url"; |
| 4 | 4 | |
| 5 | 5 | const __dirname = dirname(fileURLToPath(import.meta.url)); |
| 6 | 6 | const desktopDir = resolve(__dirname, ".."); |
| 7 | const rootDir = resolve(__dirname, "../../.."); | |
| 8 | 7 | const electronBin = resolve(desktopDir, "node_modules/.bin/electron"); |
| 9 | 8 | const mainJs = resolve(desktopDir, "dist-electron/main.js"); |
| 10 | 9 | |
| 11 | console.log("Building contracts + web + server + desktop..."); | |
| 12 | execSync("bun run build", { cwd: rootDir, stdio: "inherit" }); | |
| 13 | ||
| 14 | 10 | console.log("\nLaunching Electron smoke test..."); |
| 15 | 11 | |
| 16 | 12 | const child = spawn(electronBin, [mainJs], { |
apps/desktop/src/main.ts+1-1| ... | ... | @@ -13,7 +13,7 @@ fixPath(); |
| 13 | 13 | |
| 14 | 14 | const PICK_FOLDER_CHANNEL = "desktop:pick-folder"; |
| 15 | 15 | const ROOT_DIR = path.resolve(__dirname, "../../.."); |
| 16 | const BACKEND_ENTRY = path.join(ROOT_DIR, "apps/server/dist/index.js"); | |
| 16 | const BACKEND_ENTRY = path.join(ROOT_DIR, "apps/server/dist/index.mjs"); | |
| 17 | 17 | const WEB_ENTRY = path.join(ROOT_DIR, "apps/web/dist/index.html"); |
| 18 | 18 | const STATE_DIR = path.join(os.homedir(), ".t3", "userdata"); |
| 19 | 19 | const isDevelopment = Boolean(process.env.VITE_DEV_SERVER_URL); |
apps/desktop/tsdown.config.ts+18-7| ... | ... | @@ -1,10 +1,21 @@ |
| 1 | import { defineConfig } from "tsup"; | |
| 1 | import { defineConfig } from "tsdown"; | |
| 2 | 2 | |
| 3 | export default defineConfig({ | |
| 4 | entry: ["src/main.ts", "src/preload.ts"], | |
| 5 | format: "cjs", | |
| 3 | const shared = { | |
| 4 | format: "cjs" as const, | |
| 6 | 5 | outDir: "dist-electron", |
| 7 | 6 | sourcemap: true, |
| 8 | clean: true, | |
| 9 | noExternal: ["@t3tools/contracts"], | |
| 10 | }); | |
| 7 | outExtensions: () => ({ js: ".js" }), | |
| 8 | }; | |
| 9 | ||
| 10 | export default defineConfig([ | |
| 11 | { | |
| 12 | ...shared, | |
| 13 | entry: ["src/main.ts"], | |
| 14 | clean: true, | |
| 15 | noExternal: ["@t3tools/contracts"], | |
| 16 | }, | |
| 17 | { | |
| 18 | ...shared, | |
| 19 | entry: ["src/preload.ts"], | |
| 20 | }, | |
| 21 | ]); |
apps/desktop/turbo.jsonc+10| ... | ... | @@ -9,5 +9,15 @@ |
| 9 | 9 | "dev": { |
| 10 | 10 | "persistent": true, |
| 11 | 11 | }, |
| 12 | "start": { | |
| 13 | "dependsOn": ["build", "@t3tools/web#build", "t3#build"], | |
| 14 | "cache": false, | |
| 15 | "persistent": true, | |
| 16 | }, | |
| 17 | "smoke-test": { | |
| 18 | "dependsOn": ["build", "@t3tools/web#build", "t3#build"], | |
| 19 | "cache": false, | |
| 20 | "outputs": [], | |
| 21 | }, | |
| 12 | 22 | }, |
| 13 | 23 | } |
apps/server/package.json+4-5| ... | ... | @@ -2,17 +2,17 @@ |
| 2 | 2 | "name": "t3", |
| 3 | 3 | "version": "0.1.0", |
| 4 | 4 | "bin": { |
| 5 | "t3": "./dist/index.js" | |
| 5 | "t3": "./dist/index.mjs" | |
| 6 | 6 | }, |
| 7 | 7 | "files": [ |
| 8 | 8 | "dist" |
| 9 | 9 | ], |
| 10 | 10 | "type": "module", |
| 11 | "main": "./dist/index.js", | |
| 11 | "main": "./dist/index.mjs", | |
| 12 | 12 | "scripts": { |
| 13 | "dev": "VITE_DEV_SERVER_URL=http://localhost:5173 tsx src/index.ts", | |
| 13 | "dev": "VITE_DEV_SERVER_URL=http://localhost:5173 bun run src/index.ts", | |
| 14 | 14 | "build": "tsdown && node scripts/bundle-client.mjs", |
| 15 | "start": "node dist/index.js", | |
| 15 | "start": "node dist/index.mjs", | |
| 16 | 16 | "typecheck": "tsc --noEmit", |
| 17 | 17 | "test": "vitest run" |
| 18 | 18 | }, |
| ... | ... | @@ -26,7 +26,6 @@ |
| 26 | 26 | "@types/node": "^22.10.2", |
| 27 | 27 | "@types/ws": "^8.5.13", |
| 28 | 28 | "tsdown": "^0.20.3", |
| 29 | "tsx": "^4.19.0", | |
| 30 | 29 | "typescript": "^5.7.3" |
| 31 | 30 | } |
| 32 | 31 | } |
apps/server/tsdown.config.ts+2-2| ... | ... | @@ -2,12 +2,12 @@ import { defineConfig } from "tsup"; |
| 2 | 2 | |
| 3 | 3 | export default defineConfig({ |
| 4 | 4 | entry: ["src/index.ts"], |
| 5 | format: "esm", | |
| 5 | format: ["esm", "cjs"], | |
| 6 | 6 | outDir: "dist", |
| 7 | 7 | sourcemap: true, |
| 8 | 8 | clean: true, |
| 9 | 9 | noExternal: ["@t3tools/contracts"], |
| 10 | 10 | banner: { |
| 11 | js: '#!/usr/bin/env node\n', | |
| 11 | js: "#!/usr/bin/env node\n", | |
| 12 | 12 | }, |
| 13 | 13 | }); |
apps/server/turbo.jsonc created+16| ... | ... | @@ -0,0 +1,16 @@ |
| 1 | { | |
| 2 | "$schema": "https://turbo.build/schema.json", | |
| 3 | "extends": ["//"], | |
| 4 | "tasks": { | |
| 5 | "dev": { | |
| 6 | "dependsOn": ["@t3tools/contracts#dev"], | |
| 7 | "persistent": true, | |
| 8 | "interruptible": true | |
| 9 | }, | |
| 10 | "start": { | |
| 11 | "dependsOn": ["build"], | |
| 12 | "cache": false, | |
| 13 | "persistent": true | |
| 14 | } | |
| 15 | } | |
| 16 | } |
apps/web/turbo.jsonc created+9| ... | ... | @@ -0,0 +1,9 @@ |
| 1 | { | |
| 2 | "$schema": "https://turbo.build/schema.json", | |
| 3 | "extends": ["//"], | |
| 4 | "tasks": { | |
| 5 | "dev": { | |
| 6 | "persistent": true | |
| 7 | } | |
| 8 | } | |
| 9 | } |
bun.lock-1| ... | ... | @@ -43,7 +43,6 @@ |
| 43 | 43 | "@types/node": "^22.10.2", |
| 44 | 44 | "@types/ws": "^8.5.13", |
| 45 | 45 | "tsdown": "^0.20.3", |
| 46 | "tsx": "^4.19.0", | |
| 47 | 46 | "typescript": "^5.7.3", |
| 48 | 47 | }, |
| 49 | 48 | }, |
package.json+8-8| ... | ... | @@ -6,20 +6,20 @@ |
| 6 | 6 | "packages/*" |
| 7 | 7 | ], |
| 8 | 8 | "scripts": { |
| 9 | "dev": "T3CODE_LOG_WS_EVENTS=1 VITE_WS_URL=ws://localhost:3773 turbo run dev --ui=tui --filter=@t3tools/contracts --filter=@t3tools/web --filter=t3 --parallel", | |
| 10 | "dev:server": "bun run build:contracts && bun run --cwd apps/server dev", | |
| 11 | "dev:web": "VITE_WS_URL=ws://localhost:3773 bun run --cwd apps/web dev", | |
| 9 | "dev": "T3CODE_LOG_WS_EVENTS=1 VITE_WS_URL=ws://localhost:3773 turbo watch dev --ui=tui --filter=@t3tools/contracts --filter=@t3tools/web --filter=t3", | |
| 10 | "dev:server": "turbo watch dev --filter=t3", | |
| 11 | "dev:web": "VITE_WS_URL=ws://localhost:3773 turbo watch dev --filter=@t3tools/web", | |
| 12 | 12 | "dev:desktop": "turbo watch dev --filter=@t3tools/desktop --filter=t3 --filter=@t3tools/web", |
| 13 | "start": "node apps/server/dist/index.js", | |
| 14 | "start:desktop": "bun run --cwd apps/desktop start", | |
| 13 | "start": "turbo run start --filter=t3", | |
| 14 | "start:desktop": "turbo run start --filter=@t3tools/desktop", | |
| 15 | 15 | "build": "turbo run build", |
| 16 | "build:desktop": "bun run build:contracts && bun run --cwd apps/web build && bun run --cwd apps/server build && bun run --cwd apps/desktop build", | |
| 16 | "build:desktop": "turbo run build --filter=@t3tools/desktop --filter=t3", | |
| 17 | 17 | "typecheck": "turbo run typecheck", |
| 18 | 18 | "lint": "oxlint --report-unused-disable-directives", |
| 19 | 19 | "test": "turbo run test", |
| 20 | "test:desktop-smoke": "bun run --cwd apps/desktop smoke-test", | |
| 20 | "test:desktop-smoke": "turbo run smoke-test --filter=@t3tools/desktop", | |
| 21 | 21 | "fmt": "oxfmt", |
| 22 | "build:contracts": "bun run --cwd packages/contracts build" | |
| 22 | "build:contracts": "turbo run build --filter=@t3tools/contracts" | |
| 23 | 23 | }, |
| 24 | 24 | "devDependencies": { |
| 25 | 25 | "oxfmt": "^0.28.0", |
turbo.json+2-2| ... | ... | @@ -18,9 +18,9 @@ |
| 18 | 18 | "outputs": ["dist/**", "dist-electron/**"] |
| 19 | 19 | }, |
| 20 | 20 | "dev": { |
| 21 | "dependsOn": ["@t3tools/contracts#build"], | |
| 21 | "dependsOn": ["^dev"], | |
| 22 | 22 | "cache": false, |
| 23 | "persistent": true | |
| 23 | "persistent": false | |
| 24 | 24 | }, |
| 25 | 25 | "typecheck": { |
| 26 | 26 | "dependsOn": ["^typecheck"], |
vitest.config.ts+11-1| ... | ... | @@ -1,3 +1,13 @@ |
| 1 | import * as path from "node:path"; | |
| 1 | 2 | import { defineConfig } from "vitest/config"; |
| 2 | 3 | |
| 3 | export default defineConfig({}); | |
| 4 | export default defineConfig({ | |
| 5 | resolve: { | |
| 6 | alias: [ | |
| 7 | { | |
| 8 | find: /^@t3tools\/contracts$/, | |
| 9 | replacement: path.resolve(import.meta.dirname, "./packages/contracts/src/index.ts"), | |
| 10 | }, | |
| 11 | ], | |
| 12 | }, | |
| 13 | }); |