2022-09-22 11:09:13 +08:00
|
|
|
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: '.',
|
2022-09-23 14:10:13 +08:00
|
|
|
sourcemap: false,
|
2022-09-22 11:09:13 +08:00
|
|
|
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',
|
2022-09-22 11:09:13 +08:00
|
|
|
])
|
|
|
|
return files
|
|
|
|
}
|
|
|
|
|
|
|
|
export const buildTSFiles = async () => {
|
|
|
|
const files = await watchFiles()
|
|
|
|
console.log(files)
|
|
|
|
buildPackage(files)
|
|
|
|
}
|
|
|
|
|
|
|
|
buildTSFiles()
|