status/dashboard/index.js
Romein van Buren de2b8cdba8
Dashboard watcher
Signed-off-by: Romein van Buren <romein@vburen.nl>
2022-07-08 15:18:40 +02:00

32 lines
685 B
JavaScript

'use strict';
const { build: viteBuild } = require('vite');
const fs = require('fs').promises;
const { svelte } = require('@sveltejs/vite-plugin-svelte');
const path = __dirname + '/../gui/dashboard';
const build = (prefix = '') => viteBuild({
root: path,
base: `${prefix}/statusdashboard/asset/`,
plugins: [ svelte() ],
build: {
rollupOptions: {
output: {
assetFileNames: '[hash].[ext]',
entryFileNames: '[hash].js',
chunkFileNames: '[hash].js',
},
},
outDir: path + '/build',
},
});
const cleanup = () => fs.rm(path + '/build', {
recursive: true,
force: true,
});
module.exports = { build, cleanup, path };
build();