2021-05-03 19:29:22 +02:00
|
|
|
import fs from "fs";
|
|
|
|
import path from "path";
|
2021-03-30 11:31:17 +02:00
|
|
|
|
|
|
|
function copyRecursively(file, destination) {
|
|
|
|
const target = path.join(destination, path.basename(file));
|
|
|
|
if (fs.statSync(file).isDirectory()) {
|
|
|
|
console.log('mkdir', target);
|
|
|
|
|
|
|
|
fs.mkdirSync(target, {recursive: true});
|
|
|
|
fs.readdirSync(file).forEach(f => {
|
|
|
|
copyRecursively(path.join(file, f), target);
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
console.log('> cp ', target);
|
|
|
|
|
|
|
|
fs.copyFileSync(file, target);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[
|
|
|
|
'yarn.lock',
|
|
|
|
'README.md',
|
|
|
|
'config/',
|
2021-05-04 17:04:14 +02:00
|
|
|
'assets/',
|
2021-03-30 11:31:17 +02:00
|
|
|
].forEach(file => {
|
|
|
|
copyRecursively(file, 'dist');
|
|
|
|
});
|
|
|
|
|
|
|
|
fs.mkdirSync('dist/types', {recursive: true});
|
|
|
|
|
|
|
|
fs.readdirSync('src/types').forEach(file => {
|
|
|
|
copyRecursively(path.join('src/types', file), 'dist/types');
|
|
|
|
});
|