fix(install): copy no-reply-api to dist during installation

This commit is contained in:
root
2026-03-03 19:00:46 +00:00
parent a842218921
commit b9515fe765

View File

@@ -22,11 +22,26 @@ const __dirname = path.dirname(new URL(import.meta.url).pathname);
// Ensure dist/dirigent exists (handles git clone without npm prepare)
const DIST_DIR = path.resolve(__dirname, "..", "dist", "dirigent");
const PLUGIN_SRC_DIR = path.resolve(__dirname, "..", "plugin");
if (mode === "install" && !fs.existsSync(DIST_DIR)) {
console.log("[dirigent] dist/ not found, syncing from plugin/...");
fs.mkdirSync(DIST_DIR, { recursive: true });
for (const f of fs.readdirSync(PLUGIN_SRC_DIR)) {
fs.copyFileSync(path.join(PLUGIN_SRC_DIR, f), path.join(DIST_DIR, f));
const NO_REPLY_API_SRC_DIR = path.resolve(__dirname, "..", "no-reply-api");
const NO_REPLY_API_DIST_DIR = path.resolve(__dirname, "..", "dist", "no-reply-api");
if (mode === "install") {
// Copy plugin files to dist/dirigent
if (!fs.existsSync(DIST_DIR)) {
console.log("[dirigent] dist/dirigent/ not found, syncing from plugin/...");
fs.mkdirSync(DIST_DIR, { recursive: true });
for (const f of fs.readdirSync(PLUGIN_SRC_DIR)) {
fs.copyFileSync(path.join(PLUGIN_SRC_DIR, f), path.join(DIST_DIR, f));
}
}
// Copy no-reply-api files to dist/no-reply-api
if (!fs.existsSync(NO_REPLY_API_DIST_DIR)) {
console.log("[dirigent] dist/no-reply-api/ not found, syncing from no-reply-api/...");
fs.mkdirSync(NO_REPLY_API_DIST_DIR, { recursive: true });
for (const f of fs.readdirSync(NO_REPLY_API_SRC_DIR)) {
fs.copyFileSync(path.join(NO_REPLY_API_SRC_DIR, f), path.join(NO_REPLY_API_DIST_DIR, f));
}
}
}