swaf/scripts/prepare-sources.js

23 lines
571 B
JavaScript

const fs = require('fs');
const path = require('path');
const {copyRecursively} = require("./_functions");
// These folders must exist for nodemon not to loop indefinitely.
[
'public',
'dist',
'intermediates',
'intermediates/assets',
].forEach(dir => {
if (!fs.existsSync(dir)) fs.mkdirSync(dir);
});
// Symlink to build/common
const symlink = path.resolve('intermediates/common');
if (!fs.existsSync(symlink)) {
fs.symlinkSync(path.resolve('dist/common'), symlink);
}
// Copy package.json
fs.copyFileSync('package.json', 'dist/package.json');