ura-components/tasks/esbuild-packages.js

35 lines
690 B
JavaScript
Raw Normal View History

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: true,
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',
])
return files
}
export const buildTSFiles = async () => {
const files = await watchFiles()
console.log(files)
buildPackage(files)
}
buildTSFiles()