fix(install): copy no-reply-api to dist during installation
This commit is contained in:
@@ -22,11 +22,26 @@ const __dirname = path.dirname(new URL(import.meta.url).pathname);
|
|||||||
// Ensure dist/dirigent exists (handles git clone without npm prepare)
|
// Ensure dist/dirigent exists (handles git clone without npm prepare)
|
||||||
const DIST_DIR = path.resolve(__dirname, "..", "dist", "dirigent");
|
const DIST_DIR = path.resolve(__dirname, "..", "dist", "dirigent");
|
||||||
const PLUGIN_SRC_DIR = path.resolve(__dirname, "..", "plugin");
|
const PLUGIN_SRC_DIR = path.resolve(__dirname, "..", "plugin");
|
||||||
if (mode === "install" && !fs.existsSync(DIST_DIR)) {
|
const NO_REPLY_API_SRC_DIR = path.resolve(__dirname, "..", "no-reply-api");
|
||||||
console.log("[dirigent] dist/ not found, syncing from plugin/...");
|
const NO_REPLY_API_DIST_DIR = path.resolve(__dirname, "..", "dist", "no-reply-api");
|
||||||
fs.mkdirSync(DIST_DIR, { recursive: true });
|
|
||||||
for (const f of fs.readdirSync(PLUGIN_SRC_DIR)) {
|
if (mode === "install") {
|
||||||
fs.copyFileSync(path.join(PLUGIN_SRC_DIR, f), path.join(DIST_DIR, f));
|
// 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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user