[big chore] restore core to monorepo (#287)
* 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
This commit is contained in:
parent
878ca710b7
commit
e6a3e5c3ea
389 changed files with 12980 additions and 95 deletions
58
examples/tldraw-example/scripts/dev.mjs
Normal file
58
examples/tldraw-example/scripts/dev.mjs
Normal file
|
@ -0,0 +1,58 @@
|
|||
/* eslint-disable no-undef */
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
import esbuildServe from 'esbuild-serve'
|
||||
import dotenv from 'dotenv'
|
||||
|
||||
dotenv.config()
|
||||
|
||||
async function main() {
|
||||
if (fs.existsSync('./dist')) {
|
||||
fs.rmSync('./dist', { recursive: true }, (e) => {
|
||||
if (e) {
|
||||
throw e
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fs.mkdirSync('./dist')
|
||||
|
||||
fs.readdirSync('./src/public').forEach((file) =>
|
||||
fs.copyFile(path.join('./src/public', file), path.join('./dist', file), (err) => {
|
||||
if (err) throw err
|
||||
})
|
||||
)
|
||||
|
||||
try {
|
||||
await esbuildServe(
|
||||
{
|
||||
entryPoints: ['src/index.tsx'],
|
||||
outfile: 'dist/index.js',
|
||||
minify: false,
|
||||
bundle: true,
|
||||
sourcemap: true,
|
||||
incremental: true,
|
||||
format: 'cjs',
|
||||
target: 'es6',
|
||||
define: {
|
||||
'process.env.NODE_ENV': '"development"',
|
||||
'process.env.LIVEBLOCKS_PUBLIC_API_KEY': `"${process.env.LIVEBLOCKS_PUBLIC_API_KEY}"`,
|
||||
},
|
||||
watch: {
|
||||
onRebuild(err) {
|
||||
err ? error('❌ Failed') : log('✅ Updated')
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
port: 5420,
|
||||
root: './dist',
|
||||
live: true,
|
||||
}
|
||||
)
|
||||
} catch (err) {
|
||||
process.exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
main()
|
Loading…
Add table
Add a link
Reference in a new issue