chore: use vite for auto building @nodarium/ui instead of chokidar

We already use vite for building and during dev. Can use a custom vite
plugin to automatically package ui after every change, so no need for
chokidar.
This commit is contained in:
Max Richter
2026-02-03 12:14:58 +01:00
parent a28f15c256
commit 89e4cf8364
4 changed files with 26 additions and 203 deletions

View File

@@ -1,9 +1,25 @@
import { sveltekit } from '@sveltejs/kit/vite';
import tailwindcss from '@tailwindcss/vite';
import { exec } from 'node:child_process';
import { readFileSync } from 'node:fs';
import { defineConfig } from 'vitest/config';
const postDevPackagePlugin = () => {
const packageContent = JSON.parse(readFileSync('./package.json', { encoding: 'utf8' }));
let timeout: ReturnType<typeof setTimeout> | undefined;
return {
name: 'run-command-on-change',
handleHotUpdate: () => {
clearTimeout(timeout);
timeout = setTimeout(function() {
exec(packageContent.scripts.package);
}, 200);
}
} as const;
};
export default defineConfig({
plugins: [tailwindcss(), sveltekit()],
plugins: [tailwindcss(), sveltekit(), postDevPackagePlugin()],
test: {
include: ['src/**/*.{test,spec}.{js,ts}']
}