Skip to content

Commit c1ff303

Browse files
authored
chore: better dev/typecheck dx (#205)
1 parent e133653 commit c1ff303

File tree

15 files changed

+610
-427
lines changed

15 files changed

+610
-427
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ node_modules/
55
dist/
66
release/
77
.vite/
8+
.turbo/
89
out/
910
*.log
1011

@@ -26,6 +27,7 @@ Thumbs.db
2627
*.tmp
2728
*.temp
2829
*.tgz
30+
.agent-trigger
2931

3032
AGENTS.md
3133
.claude/

apps/array/forge.config.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,13 +171,16 @@ const config: ForgeConfig = {
171171
],
172172
hooks: {
173173
generateAssets: async () => {
174-
// Generate ICNS from source PNG
175-
if (existsSync("build/[email protected]")) {
174+
// Generate ICNS from source PNG (skip if already exists)
175+
if (
176+
existsSync("build/[email protected]") &&
177+
!existsSync("build/app-icon.icns")
178+
) {
176179
execSync("bash scripts/generate-icns.sh", { stdio: "inherit" });
177180
}
178181

179-
// Compile liquid glass icon to Assets.car
180-
if (existsSync("build/icon.icon")) {
182+
// Compile liquid glass icon to Assets.car (skip if already exists)
183+
if (existsSync("build/icon.icon") && !existsSync("build/Assets.car")) {
181184
execSync("bash scripts/compile-glass-icon.sh", { stdio: "inherit" });
182185
}
183186
},

apps/array/scripts/generate-icns.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ if [ ! -f "$SOURCE_PNG" ]; then
1515
exit 1
1616
fi
1717

18-
echo "Creating iconset from $SOURCE_PNG..."
19-
2018
mkdir -p "$ICONSET_DIR"
2119

2220
# Scale factor for macOS icon guidelines: 832/1024 = 13/16 = 0.8125

apps/array/src/main/index.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import {
2020
// Legacy type kept for backwards compatibility with taskControllers map
2121
type TaskController = unknown;
2222

23-
import { setupAgentHotReload } from "./services/dev-reload.js";
2423
import { registerFileWatcherIpc } from "./services/fileWatcher.js";
2524
import { registerFoldersIpc } from "./services/folders.js";
2625
import { registerFsIpc } from "./services/fs.js";
@@ -216,11 +215,6 @@ app.whenReady().then(() => {
216215
getOrRefreshApps().catch(() => {
217216
// Silently fail, will retry on first use
218217
});
219-
220-
// Dev mode: Watch agent package and restart via mprocs
221-
if (MAIN_WINDOW_VITE_DEV_SERVER_URL) {
222-
setupAgentHotReload();
223-
}
224218
});
225219

226220
app.on("window-all-closed", async () => {

apps/array/src/main/services/dev-reload.ts

Lines changed: 0 additions & 33 deletions
This file was deleted.

apps/array/src/main/services/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
*/
55

66
import "./contextMenu.js";
7-
import "./dev-reload.js";
87
import "./externalApps.js";
98
import "./fileWatcher.js";
109
import "./folders.js";

apps/array/vite.main.config.mts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ function copyAgentTemplates(): Plugin {
5454

5555
mkdirSync(join(__dirname, ".vite/build/templates"), { recursive: true });
5656
copyFileSync(templateSrc, templateDest);
57-
console.log("Copied agent templates to build directory");
5857
},
5958
};
6059
}
@@ -102,23 +101,14 @@ function copyClaudeExecutable(): Plugin {
102101
existsSync(join(candidate.path, "cli.js")) &&
103102
existsSync(join(candidate.path, "yoga.wasm"))
104103
) {
105-
console.log(
106-
`[copy-claude-executable] Found pre-built artifacts at ${candidate.path}`,
107-
);
108104
const files = ["cli.js", "package.json", "yoga.wasm"];
109105
for (const file of files) {
110106
copyFileSync(join(candidate.path, file), join(destDir, file));
111107
}
112-
console.log("Copied Claude CLI to claude-cli/ subdirectory");
113108
return;
114109
}
115110
}
116111

117-
// Fallback: Assemble from individual source packages (Development Workspace)
118-
console.log(
119-
"[copy-claude-executable] Pre-built artifacts not found. Attempting to assemble from workspace sources...",
120-
);
121-
122112
const rootNodeModules = join(__dirname, "../../node_modules");
123113
const sdkDir = join(rootNodeModules, "@anthropic-ai/claude-agent-sdk");
124114
const yogaDir = join(rootNodeModules, "yoga-wasm-web/dist");
@@ -165,14 +155,20 @@ export default defineConfig({
165155
"@api": path.resolve(__dirname, "./src/api"),
166156
},
167157
},
158+
cacheDir: ".vite/cache",
168159
build: {
169160
target: "node18",
170-
minify: false, // Disable minification to prevent variable name conflicts
161+
minify: false,
162+
reportCompressedSize: false,
171163
commonjsOptions: {
172164
transformMixedEsModules: true,
173165
},
174166
rollupOptions: {
175167
external: ["node-pty", "@parcel/watcher", "file-icon"],
168+
onwarn(warning, warn) {
169+
if (warning.code === "UNUSED_EXTERNAL_IMPORT") return;
170+
warn(warning);
171+
},
176172
},
177173
},
178174
});

mprocs.yaml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
procs:
2-
agent:
3-
cmd: ["pnpm", "--filter", "agent", "run", "dev"]
4-
cwd: .
5-
color: magenta
6-
72
array:
83
cmd: ["pnpm", "--filter", "array", "run", "start"]
94
cwd: .
105
color: blue
11-
autorestart: true
126
depends_on:
137
- agent
8+
9+
agent:
10+
cmd: ["pnpm", "--filter", "agent", "run", "dev"]
11+
cwd: .
12+
color: magenta

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
"dev:agent": "pnpm --filter agent dev",
1414
"dev:array": "pnpm --filter array dev",
1515
"start": "pnpm --filter array start",
16-
"build": "pnpm --filter agent build && pnpm --filter array build",
17-
"typecheck": "pnpm --filter agent build && pnpm --filter agent typecheck && pnpm --filter array typecheck",
16+
"build": "turbo build",
17+
"typecheck": "turbo typecheck",
1818
"lint": "biome check --write --unsafe",
1919
"format": "biome format --write",
2020
"test": "pnpm -r test",
@@ -33,7 +33,8 @@
3333
"devDependencies": {
3434
"@biomejs/biome": "2.2.4",
3535
"husky": "^9.1.7",
36-
"lint-staged": "^15.5.2"
36+
"lint-staged": "^15.5.2",
37+
"turbo": "^2.6.2"
3738
},
3839
"lint-staged": {
3940
"*.{ts,tsx,js,jsx}": [

packages/agent/package.json

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
"types": "./dist/index.d.ts",
99
"exports": {
1010
".": {
11+
"types": "./dist/index.d.ts",
1112
"import": "./dist/index.js",
12-
"require": "./dist/index.js",
13-
"types": "./dist/index.d.ts"
13+
"require": "./dist/index.js"
1414
}
1515
},
1616
"type": "module",
@@ -25,8 +25,8 @@
2525
"author": "PostHog",
2626
"license": "SEE LICENSE IN LICENSE",
2727
"scripts": {
28-
"build": "pnpm exec rimraf dist && pnpm exec rollup -c && pnpm exec tsc --project tsconfig.build.json --emitDeclarationOnly",
29-
"dev": "pnpm exec rollup -c --watch",
28+
"build": "tsup",
29+
"dev": "tsup --watch",
3030
"typecheck": "pnpm exec tsc --noEmit",
3131
"example": "tsx example.ts",
3232
"prepublishOnly": "pnpm run build"
@@ -36,15 +36,9 @@
3636
},
3737
"devDependencies": {
3838
"@changesets/cli": "^2.27.8",
39-
"@rollup/plugin-commonjs": "^25.0.7",
40-
"@rollup/plugin-json": "^6.1.0",
41-
"@rollup/plugin-node-resolve": "^15.2.3",
4239
"@types/bun": "latest",
4340
"minimatch": "^10.0.3",
44-
"rimraf": "^6.0.1",
45-
"rollup": "^4.24.0",
46-
"rollup-plugin-copy": "^3.5.0",
47-
"rollup-plugin-typescript2": "^0.36.0",
41+
"tsup": "^8.5.1",
4842
"tsx": "^4.20.6",
4943
"typescript": "^5.5.0"
5044
},

0 commit comments

Comments
 (0)