2022-07-08 09:28:44 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const { build: viteBuild } = require('vite');
|
2022-07-08 11:48:51 +00:00
|
|
|
const fs = require('fs').promises;
|
2022-07-08 13:18:40 +00:00
|
|
|
const { svelte } = require('@sveltejs/vite-plugin-svelte');
|
|
|
|
|
|
|
|
const path = __dirname + '/../gui/dashboard';
|
2022-07-08 09:28:44 +00:00
|
|
|
|
2022-07-08 11:48:51 +00:00
|
|
|
const build = (prefix = '') => viteBuild({
|
2022-07-08 13:18:40 +00:00
|
|
|
root: path,
|
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',
|
|
|
|
},
|
|
|
|
},
|
2022-07-08 13:18:40 +00:00
|
|
|
outDir: path + '/build',
|
2022-07-08 09:28:44 +00:00
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2022-07-08 13:18:40 +00:00
|
|
|
const cleanup = () => fs.rm(path + '/build', {
|
2022-07-08 12:50:06 +00:00
|
|
|
recursive: true,
|
|
|
|
force: true,
|
|
|
|
});
|
2022-07-08 11:48:51 +00:00
|
|
|
|
2022-07-08 13:18:40 +00:00
|
|
|
module.exports = { build, cleanup, path };
|
2022-07-08 11:48:51 +00:00
|
|
|
build();
|