Fix Tauri builds and Windows opencode-config loop

This commit is contained in:
Shantur Rathore
2026-01-07 06:25:19 +00:00
parent b1691add1c
commit 847faf1214
2 changed files with 34 additions and 8 deletions

View File

@@ -10,6 +10,7 @@ const cliRoot = path.resolve(__dirname, "..")
const sourceDir = path.resolve(cliRoot, "../opencode-config")
const targetDir = path.resolve(cliRoot, "dist/opencode-config")
const nodeModulesDir = path.resolve(sourceDir, "node_modules")
const selfLinkDir = path.resolve(nodeModulesDir, "@codenomad", "opencode-config")
const npmExecPath = process.env.npm_execpath
const npmNodeExecPath = process.env.npm_node_execpath
@@ -49,6 +50,10 @@ if (!existsSync(nodeModulesDir)) {
}
}
// npm can create a self-referential link for scoped packages on Windows.
// That link causes recursive copies (ELOOP) during bundling.
rmSync(selfLinkDir, { recursive: true, force: true })
rmSync(targetDir, { recursive: true, force: true })
mkdirSync(path.dirname(targetDir), { recursive: true })
cpSync(sourceDir, targetDir, { recursive: true })