Files
lst/scripts/lstAppMoves.mjs

52 lines
1.5 KiB
JavaScript

import fs from "fs";
import path from "path";
const src_views = path.resolve("app/src/pkg/utils/mail/views");
const dest_views = path.resolve("dist/src/pkg/utils/mail/views");
const src_settings = path.resolve(
"app/src/internal/system/controller/settings/settings.json",
);
const dest_settings = path.resolve(
"dist/src/internal/system/controller/settings/settings.json",
);
const src_modules = path.resolve(
"app/src/internal/system/controller/modules/modules.json",
);
const dest_modules = path.resolve(
"dist/src/internal/system/controller/modules/modules.json",
);
// Delete old views if they exist
if (fs.existsSync(dest_views)) {
fs.rmSync(dest_views, { recursive: true, force: true });
}
// Delete old settings file if it exists
if (fs.existsSync(dest_settings)) {
fs.rmSync(dest_settings, { force: true }); // for single files we dont need the recursive
}
if (fs.existsSync(dest_modules)) {
fs.rmSync(dest_modules, { force: true }); // for single files we dont need the recursive
}
// Ensure the destination directory exists for settings.json
const dest_settings_dir = path.dirname(dest_settings);
if (!fs.existsSync(dest_settings_dir)) {
fs.mkdirSync(dest_settings_dir, { recursive: true });
}
const dest_modules_dir = path.dirname(dest_modules);
if (!fs.existsSync(dest_modules_dir)) {
fs.mkdirSync(dest_modules_dir, { recursive: true });
}
// Copy files
fs.copyFileSync(src_settings, dest_settings);
fs.copyFileSync(src_modules, dest_modules);
fs.cpSync(src_views, dest_views, { recursive: true });
console.log(`All files copied`);