Files
Termix/scripts/copy-bundled-plugins.cjs
T
LukeGus c94a453f1e feat: ship the ssh terminal as a first-party in-process plugin
Adds a hardcoded process:transport-owner tier so the terminal can own its
WebSocket server and ssh2 clients, which cannot cross the worker boundary.
2026-09-21 08:28:50 -05:00

34 lines
1.1 KiB
JavaScript

/**
* Copies plugins/ into dist/plugins so bundled first-party plugins ship with a
* built server.
*
* tsc only emits .ts, and a plugin's backend entry is a hand-written .mjs plus
* a manifest.json, so without this step the plugins directory simply would not
* exist in dist and the loader would find nothing.
*
* getBundledPluginsDir() in src/backend/plugins/paths.ts resolves
* dist/backend/backend/plugins -> dist/plugins, which is where this writes.
*/
const fs = require("node:fs");
const path = require("node:path");
const root = path.resolve(__dirname, "..");
const source = path.join(root, "plugins");
const destination = path.join(root, "dist", "plugins");
if (!fs.existsSync(source)) {
console.log("No plugins/ directory, nothing to bundle.");
process.exit(0);
}
fs.rmSync(destination, { recursive: true, force: true });
fs.cpSync(source, destination, { recursive: true });
const bundled = fs
.readdirSync(destination, { withFileTypes: true })
.filter((entry) => entry.isDirectory())
.map((entry) => entry.name);
console.log(`Bundled ${bundled.length} plugin(s): ${bundled.join(", ")}`);