ura-components/tasks/esbuild-packages.js

37 lines
742 B
JavaScript

import fg from 'fast-glob'
import {build} from 'esbuild'
export const buildPackage = async (paths) => {
const builds = []
if (paths.length) {
builds.push(
build({
entryPoints: paths,
bundle: false,
outdir: '.',
outbase: '.',
sourcemap: false,
define: {'window.__swc.DEBUG': false},
}).catch(() => process.exit(1))
)
}
}
export const watchFiles = async () => {
const files = await fg([
'./src/components/**/!(*.d).ts',
'./src/lib/**/!(*.d).ts',
'src/widgets/*.ts',
'src/widgets/**/*.ts',
])
return files
}
export const buildTSFiles = async () => {
const files = await watchFiles()
console.log(files)
buildPackage(files)
}
buildTSFiles()