From ec78fe3d2c3bd60eb60c946079dcd201d9bbee81 Mon Sep 17 00:00:00 2001 From: diegosouzapw Date: Sat, 13 Jun 2026 00:07:23 -0300 Subject: [PATCH] fix(publish): clean opencode-plugin node_modules after tsup build to prevent E415 hard-link tarball rejection --- scripts/build/prepublish.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scripts/build/prepublish.ts b/scripts/build/prepublish.ts index b5c2e14dfb..afcdca2be3 100644 --- a/scripts/build/prepublish.ts +++ b/scripts/build/prepublish.ts @@ -309,6 +309,15 @@ if (existsSync(opencodePluginSrc) && existsSync(join(opencodePluginSrc, "package } else { console.log(" ✅ @omniroute/opencode-plugin dist/ already present (skipping rebuild)"); } + // Remove plugin node_modules after build — hard links created by npm install on Linux + // (CI runner) end up in the tarball as LINK entries, which npm registry rejects with + // E415 "Hard link is not allowed". The node_modules are only needed for the tsup build; + // they must not ship in the published package. + const pluginNodeModules = join(opencodePluginSrc, "node_modules"); + if (existsSync(pluginNodeModules)) { + rmSync(pluginNodeModules, { recursive: true, force: true }); + console.log(" 🧹 Removed @omniroute/opencode-plugin/node_modules (hard link guard)"); + } } else { console.log(" ⏭️ @omniroute/opencode-plugin not found in workspace (skipping build)"); }