35 lines
690 B
JavaScript
35 lines
690 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: 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()
|