tldraw/apps/vscode/extension/scripts/dev.js
Steve Ruiz e6a3e5c3ea
[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
2021-11-18 13:09:18 +00:00

43 lines
895 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* eslint-disable */
const fs = require('fs')
const esbuild = require('esbuild')
async function main() {
if (fs.existsSync('./dist')) {
fs.rmSync('./dist', { recursive: true }, (e) => {
if (e) {
throw e
}
})
}
try {
await esbuild.build({
entryPoints: ['./src/extension.ts'],
outdir: 'dist/web',
minify: false,
bundle: true,
format: 'cjs',
target: 'es6',
sourcemap: 'inline',
define: {
'process.env.NODE_ENV': '"development"',
},
tsconfig: './tsconfig.json',
external: ['vscode'],
incremental: true,
watch: {
onRebuild(err) {
err ? console.error('❌ Failed') : console.log('✅ Updated')
},
},
})
console.log(`Built package.`)
} catch (e) {
console.log(`× Build failed due to an error.`)
console.log(e)
}
}
main()