features
This commit is contained in:
24
apps/api/scripts/copy-mail-assets.js
Normal file
24
apps/api/scripts/copy-mail-assets.js
Normal file
@@ -0,0 +1,24 @@
|
||||
const { copyFileSync, existsSync, mkdirSync, readdirSync, statSync } = require('node:fs');
|
||||
const { join } = require('node:path');
|
||||
|
||||
const source = join(__dirname, '..', 'src', 'mail', 'templates');
|
||||
const target = join(__dirname, '..', 'dist', 'mail', 'templates');
|
||||
|
||||
function copyDirectory(from, to) {
|
||||
if (!existsSync(from)) {
|
||||
return;
|
||||
}
|
||||
|
||||
mkdirSync(to, { recursive: true });
|
||||
for (const entry of readdirSync(from)) {
|
||||
const sourcePath = join(from, entry);
|
||||
const targetPath = join(to, entry);
|
||||
if (statSync(sourcePath).isDirectory()) {
|
||||
copyDirectory(sourcePath, targetPath);
|
||||
} else {
|
||||
copyFileSync(sourcePath, targetPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
copyDirectory(source, target);
|
||||
Reference in New Issue
Block a user