2022-07-08 09:28:44 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const { build: viteBuild } = require('vite');
|
|
|
|
const { svelte } = require('@sveltejs/vite-plugin-svelte');
|
2022-07-08 11:48:51 +00:00
|
|
|
const fs = require('fs').promises;
|
2022-07-08 09:28:44 +00:00
|
|
|
|
2022-07-08 11:48:51 +00:00
|
|
|
const build = (prefix = '') => viteBuild({
|
2022-07-08 12:50:06 +00:00
|
|
|
root: __dirname + '/gui/dashboard/',
|
2022-07-08 11:48:51 +00:00
|
|
|
base: `${prefix}/statusdashboard/asset/`,
|
2022-07-08 09:28:44 +00:00
|
|
|
plugins: [ svelte() ],
|
|
|
|
build: {
|
|
|
|
rollupOptions: {
|
|
|
|
output: {
|
|
|
|
assetFileNames: '[hash].[ext]',
|
|
|
|
entryFileNames: '[hash].js',
|
|
|
|
chunkFileNames: '[hash].js',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
outDir: __dirname + '/gui/dashboard/build',
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2022-07-08 12:50:06 +00:00
|
|
|
const cleanup = () => fs.rm(__dirname + '/gui/dashboard/build', {
|
|
|
|
recursive: true,
|
|
|
|
force: true,
|
|
|
|
});
|
2022-07-08 11:48:51 +00:00
|
|
|
|
|
|
|
module.exports = { build, cleanup };
|
|
|
|
build();
|