|
1 | 1 | #!/usr/bin/env bun |
2 | 2 | import '../src/shared/runtime/suppress-baseline-warning.js'; |
3 | | -import { mkdirSync, rmSync, cpSync, readFileSync, writeFileSync, readdirSync } from 'node:fs'; |
| 3 | +import { mkdirSync, rmSync, cpSync, readFileSync, writeFileSync, readdirSync, existsSync } from 'node:fs'; |
4 | 4 | import { join, dirname, resolve, relative } from 'node:path'; |
5 | 5 | import { fileURLToPath } from 'node:url'; |
6 | | -import { platform, arch } from 'node:os'; |
| 6 | +import { platform, arch, homedir } from 'node:os'; |
7 | 7 | import { $ } from 'bun'; |
8 | 8 |
|
9 | 9 | // Simple ANSI colors |
@@ -43,6 +43,13 @@ console.log(`\n${bold}${cyan}╭──────────────── |
43 | 43 | console.log(`${bold}${cyan}│${reset} Building ${bold}CodeMachine${reset} v${mainVersion} ${bold}${cyan}│${reset}`); |
44 | 44 | console.log(`${bold}${cyan}╰────────────────────────────────────────╯${reset}\n`); |
45 | 45 |
|
| 46 | +// Clean cached resources for this version to ensure fresh extraction on next run |
| 47 | +const cachedResourcesDir = join(homedir(), '.codemachine', 'resources', mainVersion); |
| 48 | +if (existsSync(cachedResourcesDir)) { |
| 49 | + rmSync(cachedResourcesDir, { recursive: true, force: true }); |
| 50 | + console.log(`${green}✓${reset} ${dim}Cleaned cached resources at ${cachedResourcesDir}${reset}`); |
| 51 | +} |
| 52 | + |
46 | 53 | // Collect resource files for embedding and generate a manifest that imports them. |
47 | 54 | function collectFiles(dir: string): string[] { |
48 | 55 | const results: string[] = []; |
|
0 commit comments