b68a4681e1
* move folders out of packages * Remove custom yarn stuff, remove duplicate readme * Remove stitches config * Add README script. * bump deps * Fix script * Update package.json
44 lines
1,002 B
JavaScript
44 lines
1,002 B
JavaScript
/* eslint-disable no-undef */
|
|
import fs from 'fs'
|
|
import esbuild from 'esbuild'
|
|
import serve, { error, log } from 'create-serve'
|
|
|
|
const isDevServer = true
|
|
|
|
if (!fs.existsSync('./dist')) {
|
|
fs.mkdirSync('./dist')
|
|
}
|
|
|
|
fs.copyFile('./src/index.html', './dist/index.html', (err) => {
|
|
if (err) throw err
|
|
})
|
|
|
|
esbuild
|
|
.build({
|
|
entryPoints: ['src/index.tsx'],
|
|
bundle: true,
|
|
outfile: 'dist/bundle.js',
|
|
minify: false,
|
|
sourcemap: true,
|
|
incremental: isDevServer,
|
|
target: ['chrome58', 'firefox57', 'safari11', 'edge18'],
|
|
define: {
|
|
'process.env.LIVEBLOCKS_PUBLIC_API_KEY': process.env.LIVEBLOCKS_PUBLIC_API_KEY,
|
|
'process.env.NODE_ENV': isDevServer ? '"development"' : '"production"',
|
|
},
|
|
watch: isDevServer && {
|
|
onRebuild(err) {
|
|
serve.update()
|
|
err ? error('❌ Failed') : log('✅ Updated')
|
|
},
|
|
},
|
|
})
|
|
.catch(() => process.exit(1))
|
|
|
|
if (isDevServer) {
|
|
serve.start({
|
|
port: 5000,
|
|
root: './dist',
|
|
live: true,
|
|
})
|
|
}
|