e6a3e5c3ea
* move core into repo, apps into apps folder, update tests * Update scripts for build:core * improve scripts * remove noise from www * Update .gitignore * Fix focus bug * add ci test script * Update main.yml
40 lines
883 B
JavaScript
40 lines
883 B
JavaScript
/* eslint-disable */
|
||
import fs from 'fs'
|
||
import esbuild from 'esbuild'
|
||
import { createRequire } from 'module'
|
||
|
||
const pkg = createRequire(import.meta.url)('../package.json')
|
||
|
||
async function main() {
|
||
if (fs.existsSync('./dist')) {
|
||
fs.rmSync('./dist', { recursive: true }, (e) => {
|
||
if (e) {
|
||
throw e
|
||
}
|
||
})
|
||
}
|
||
|
||
try {
|
||
esbuild.buildSync({
|
||
entryPoints: ['./src/index.tsx'],
|
||
outfile: 'dist/index.js',
|
||
minify: true,
|
||
bundle: true,
|
||
format: 'esm',
|
||
target: 'es6',
|
||
jsxFactory: 'React.createElement',
|
||
jsxFragment: 'React.Fragment',
|
||
tsconfig: './tsconfig.json',
|
||
define: {
|
||
'process.env.NODE_ENV': '"production"',
|
||
},
|
||
})
|
||
|
||
console.log(`✔ ${pkg.name}: Build completed.`)
|
||
} catch (e) {
|
||
console.log(`× ${pkg.name}: Build failed due to an error.`)
|
||
console.log(e)
|
||
}
|
||
}
|
||
|
||
main()
|