build: preserve staged plugin runtime deps

This commit is contained in:
Peter Steinberger
2026-04-24 16:17:59 +01:00
parent 2b45a112cb
commit f3bcea8732
3 changed files with 31 additions and 9 deletions

View File

@@ -191,6 +191,11 @@ function copyDeclaredPluginSkillPaths(params) {
const shouldExcludeNestedNodeModules = /^node_modules(?:\/|$)/u.test(
normalizeManifestRelativePath(raw),
);
if (shouldExcludeNestedNodeModules) {
removePathIfExists(
ensurePathInsideRoot(params.distPluginDir, normalizeManifestRelativePath(raw)),
);
}
copySkillPathWithRetry({
sourcePath,
targetPath,
@@ -270,10 +275,9 @@ export function copyBundledPluginMetadata(params = {}) {
if (fs.existsSync(manifestPath)) {
const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
// Generated skill assets live under a dedicated dist-owned directory. Also
// remove the older bad node_modules tree so release packs cannot pick it up.
// Generated skill assets live under a dedicated dist-owned directory. Runtime
// dependency staging owns dist plugin node_modules; do not remove it here.
removePathIfExists(path.join(distPluginDir, GENERATED_BUNDLED_SKILLS_DIR));
removePathIfExists(path.join(distPluginDir, "node_modules"));
const copiedSkills = copyDeclaredPluginSkillPaths({
manifest,
pluginDir,