mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-19 15:14:49 +00:00
fix: tfcode web fails after npm install — copy app dist in postinstall
The web command crashed because postinstall scripts never copied the app/dist directory from the platform package. Added copyAppDir() to both postinstall scripts, multi-path resolution in findAppDir() and server static serving, and updated branding to use local favicon. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -164,6 +164,10 @@ for (const item of targets) {
|
||||
}
|
||||
|
||||
await $`rm -rf ./dist/${name}/bin/tui`
|
||||
const appDistDir = path.resolve(dir, "../app/dist")
|
||||
if (fs.existsSync(appDistDir)) {
|
||||
fs.cpSync(appDistDir, path.join(dir, "dist", name, "bin", "app", "dist"), { recursive: true })
|
||||
}
|
||||
await Bun.file(`dist/${name}/package.json`).write(
|
||||
JSON.stringify(
|
||||
{
|
||||
|
||||
@@ -181,6 +181,15 @@ async function downloadBinary() {
|
||||
console.log(`Installed tfcode to ${targetBinary}`)
|
||||
}
|
||||
|
||||
// Move app directory
|
||||
const extractedAppDir = path.join(tmpDir, "app")
|
||||
const targetAppDir = path.join(binDir, "app")
|
||||
if (fs.existsSync(path.join(extractedAppDir, "dist", "index.html"))) {
|
||||
if (fs.existsSync(targetAppDir)) fs.rmSync(targetAppDir, { recursive: true, force: true })
|
||||
fs.cpSync(extractedAppDir, targetAppDir, { recursive: true })
|
||||
console.log("Installed web app")
|
||||
}
|
||||
|
||||
// Cleanup
|
||||
fs.rmSync(tmpDir, { recursive: true, force: true })
|
||||
}
|
||||
@@ -202,6 +211,16 @@ function setupBinary(sourcePath, platform) {
|
||||
|
||||
fs.chmodSync(targetBinary, 0o755)
|
||||
console.log(`tfcode installed to ${targetBinary}`)
|
||||
|
||||
// Also copy app dir from platform package
|
||||
const sourceDir = path.dirname(sourcePath)
|
||||
const srcAppDir = path.join(sourceDir, "app")
|
||||
const targetAppDir = path.join(binDir, "app")
|
||||
if (fs.existsSync(path.join(srcAppDir, "dist", "index.html"))) {
|
||||
if (fs.existsSync(targetAppDir)) fs.rmSync(targetAppDir, { recursive: true, force: true })
|
||||
fs.cpSync(srcAppDir, targetAppDir, { recursive: true })
|
||||
console.log("Web app copied from platform package")
|
||||
}
|
||||
}
|
||||
|
||||
async function main() {
|
||||
|
||||
Reference in New Issue
Block a user