Bump to 1.0.38: fix postinstall not copying app dir when binary exists

The postinstall.mjs early-returned when the binary was already present,
skipping the app/ directory copy from the platform package entirely.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Gab
2026-04-15 14:31:53 +10:00
parent cdae3f5a99
commit dfdfa40691
2 changed files with 20 additions and 1 deletions

View File

@@ -1,6 +1,6 @@
{
"$schema": "https://json.schemastore.org/package.json",
"version": "1.0.37",
"version": "1.0.38",
"name": "@toothfairyai/tfcode",
"type": "module",
"license": "MIT",

View File

@@ -93,6 +93,25 @@ async function downloadBinary() {
if (fs.existsSync(existingBinary)) {
console.log(`✓ Binary already exists at ${existingBinary}`)
// Still need to copy app dir from platform package if missing
const targetAppDir = path.join(binDir, "app")
if (!fs.existsSync(path.join(targetAppDir, "dist", "index.html"))) {
let target = `tfcode-${platform}-${arch}`
if (needsBaseline) target += "-baseline"
if (abi) target += `-${abi}`
const pkgName = `@toothfairyai/${target}`
try {
const pkgUrl = import.meta.resolve(`${pkgName}/package.json`)
const pkgDir = path.dirname(fileURLToPath(pkgUrl))
const srcAppDir = path.join(pkgDir, "bin", "app")
if (fs.existsSync(path.join(srcAppDir, "dist", "index.html"))) {
fs.cpSync(srcAppDir, targetAppDir, { recursive: true })
console.log("✓ Web app copied from platform package")
}
} catch (e) {
console.log(`! Could not copy web app: ${e.message}`)
}
}
return
}