17 lines
500 B
JavaScript
17 lines
500 B
JavaScript
// Copies non-TS assets (door SQL migrations) from src/ to dist/ after tsc.
|
|
import fs from 'fs';
|
|
import path from 'path';
|
|
|
|
function walk(dir) {
|
|
for (const e of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
const p = path.join(dir, e.name);
|
|
if (e.isDirectory()) walk(p);
|
|
else if (e.name.endsWith('.sql')) {
|
|
const out = path.join('dist', path.relative('src', p));
|
|
fs.mkdirSync(path.dirname(out), { recursive: true });
|
|
fs.copyFileSync(p, out);
|
|
}
|
|
}
|
|
}
|
|
walk('src');
|