ura-components/tasks/esbuild-packages.js

37 lines
738 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: false,
define: {'window.__swc.DEBUG': false},
}).catch(() => process.exit(1))
)
}
}
export const watchFiles = async () => {
const files = await fg([
2022-12-09 10:43:31 +08:00
'src/components/**/!(*.d).ts',
'src/lib/**/!(*.d).ts',
2022-10-06 16:50:43 +08:00
'src/widgets/*.ts',
'src/widgets/**/*.ts',
])
return files
}
export const buildTSFiles = async () => {
const files = await watchFiles()
console.log(files)
buildPackage(files)
}
buildTSFiles()