2021-11-20 15:30:02 +01:00
|
|
|
const fs = require('fs');
|
|
|
|
const path = require('path');
|
2021-11-20 15:34:58 +01:00
|
|
|
const {copyRecursively} = require("./_functions");
|
2021-04-23 18:19:05 +02:00
|
|
|
|
2021-04-27 15:44:20 +02:00
|
|
|
// These folders must exist for nodemon not to loop indefinitely.
|
2021-04-23 18:19:05 +02:00
|
|
|
[
|
|
|
|
'public',
|
2021-05-27 15:26:19 +02:00
|
|
|
'dist',
|
|
|
|
'intermediates',
|
|
|
|
'intermediates/assets',
|
2021-04-23 18:19:05 +02:00
|
|
|
].forEach(dir => {
|
|
|
|
if (!fs.existsSync(dir)) fs.mkdirSync(dir);
|
|
|
|
});
|
2021-05-27 15:26:19 +02:00
|
|
|
|
|
|
|
// Symlink to build/common
|
|
|
|
const symlink = path.resolve('intermediates/common');
|
|
|
|
if (!fs.existsSync(symlink)) {
|
|
|
|
fs.symlinkSync(path.resolve('dist/common'), symlink);
|
|
|
|
}
|
|
|
|
|
2021-11-20 15:34:58 +01:00
|
|
|
// Copy assets
|
|
|
|
fs.readdirSync('src/assets').forEach(file => {
|
|
|
|
copyRecursively(path.join('src/assets', file), 'dist/assets');
|
|
|
|
});
|
|
|
|
|
2021-11-10 19:25:50 +01:00
|
|
|
// Copy package.json
|
|
|
|
fs.copyFileSync('package.json', 'dist/package.json');
|