const fs = require('fs'); const path = require('path'); const root = __dirname; const source = path.join(root, 'src'); const build = path.join(root, 'build'); fs.rmSync(build, {recursive: true, force: true}); fs.mkdirSync(path.join(build, 'static', 'css'), {recursive: true}); fs.mkdirSync(path.join(build, 'static', 'js'), {recursive: true}); fs.copyFileSync(path.join(source, 'index.html'), path.join(build, 'index.html')); fs.copyFileSync(path.join(source, 'dashboard.css'), path.join(build, 'static', 'css', 'dashboard.css')); fs.copyFileSync(path.join(source, 'dashboard.js'), path.join(build, 'static', 'js', 'dashboard.js')); const bundledIcons = path.join(root, 'item-icons'); fs.cpSync(bundledIcons, path.join(build, 'static', 'item-icons'), {recursive: true}); // Keep the standalone public entry synchronized for tools that serve it directly. fs.copyFileSync(path.join(source, 'index.html'), path.join(root, 'public', 'index.html')); console.log('Built static Mosfet dashboard into web_interface/build');