All checks were successful
Build And Deploy Main / build-and-deploy (push) Successful in 29s
31 lines
1.1 KiB
JavaScript
31 lines
1.1 KiB
JavaScript
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"];
|
|
const unicodeFontFiles = ["NotoSansSC-Regular.ttf", "NotoSansSC-VF.ttf", "NotoSansCJKsc-Regular.otf"];
|
|
|
|
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);
|
|
});
|
|
|
|
unicodeFontFiles.forEach((unicodeFontFile) => {
|
|
const appFontSourcePath = path.join(rootDir, "..", "app", "assets", "fonts", unicodeFontFile);
|
|
if (fs.existsSync(appFontSourcePath)) {
|
|
fs.copyFileSync(appFontSourcePath, path.join(targetDir, unicodeFontFile));
|
|
}
|
|
});
|
|
|
|
console.log("Route report PDF templates and Unicode font copied to build/upload.");
|