const fs = require('fs'); const path = require('path'); // 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 commonLocalSymlink = path.resolve('intermediates/common-local'); if (!fs.existsSync(commonLocalSymlink)) { const target = path.resolve('dist/common-local'); fs.symlinkSync(target, commonLocalSymlink); } const commonSymlink = path.resolve('intermediates/common'); if (!fs.existsSync(commonSymlink)) { const target = path.resolve('node_modules/swaf/common'); fs.symlinkSync(target, commonSymlink); } // Copy package.json fs.copyFileSync('package.json', 'dist/package.json');