Files
integration/packages/widgets/build.js
Sylvain Zimmer 720ee9f4f0 (widgets) import widgets code from Messages and setup Docker workflow (#33)
This adds Gaufre v2 with source, documentation, examples and built artefacts.
Also includes the feedback widget from Messages.
2025-11-19 15:18:21 +01:00

32 lines
905 B
JavaScript

import { build } from 'vite'
import { readdirSync } from 'node:fs'
import { join } from 'node:path'
import { fileURLToPath } from 'node:url'
const __dirname = fileURLToPath(new URL('.', import.meta.url))
const widgetsDir = join(__dirname, 'src', 'widgets')
function discoverWidgets() {
return readdirSync(widgetsDir, { withFileTypes: true })
.filter(dirent => dirent.isDirectory())
.map(dirent => dirent.name)
}
// Run an independent build for each widget
for (const widget of discoverWidgets()) {
await build({
build: {
emptyOutDir: false,
outDir: join(process.env.WIDGETS_OUTPUT_DIR || "", "dist"),
rollupOptions: {
input: join(widgetsDir, widget, 'main.ts'),
output: {
entryFileNames: widget + '.js',
format: 'iife'
}
}
},
})
}