This commit is contained in:
22
client/scripts/copy-route-report-templates.js
Normal file
22
client/scripts/copy-route-report-templates.js
Normal file
@@ -0,0 +1,22 @@
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
const rootDir = path.resolve(__dirname, "..");
|
||||
const sourceDir = path.join(rootDir, "public", "upload");
|
||||
const targetDir = path.join(rootDir, "build", "upload");
|
||||
const templates = ["pdf_templete1.pdf", "pdf_templete2.pdf", "pdf_templete3.pdf"];
|
||||
|
||||
if (!fs.existsSync(targetDir)) {
|
||||
fs.mkdirSync(targetDir, { recursive: true });
|
||||
}
|
||||
|
||||
templates.forEach((templateName) => {
|
||||
const sourcePath = path.join(sourceDir, templateName);
|
||||
const targetPath = path.join(targetDir, templateName);
|
||||
if (!fs.existsSync(sourcePath)) {
|
||||
throw new Error(`Missing source template: ${sourcePath}`);
|
||||
}
|
||||
fs.copyFileSync(sourcePath, targetPath);
|
||||
});
|
||||
|
||||
console.log("Route report PDF templates copied to build/upload.");
|
||||
Reference in New Issue
Block a user