2021-11-10 15:35:51 +00:00
|
|
|
|
/* eslint-disable */
|
|
|
|
|
const fs = require('fs')
|
|
|
|
|
const esbuild = require('esbuild')
|
|
|
|
|
|
2021-12-22 00:14:38 +00:00
|
|
|
|
const { log: jslog } = console
|
|
|
|
|
|
2021-11-10 15:35:51 +00:00
|
|
|
|
async function main() {
|
|
|
|
|
if (fs.existsSync('./dist')) {
|
|
|
|
|
fs.rmSync('./dist', { recursive: true }, (e) => {
|
|
|
|
|
if (e) {
|
|
|
|
|
throw e
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try {
|
2021-11-13 11:02:10 +00:00
|
|
|
|
await esbuild.build({
|
2021-11-10 15:35:51 +00:00
|
|
|
|
entryPoints: ['./src/extension.ts'],
|
|
|
|
|
outdir: 'dist/web',
|
2021-11-13 08:49:34 +00:00
|
|
|
|
minify: false,
|
2021-11-10 15:35:51 +00:00
|
|
|
|
bundle: true,
|
|
|
|
|
format: 'cjs',
|
|
|
|
|
target: 'es6',
|
2021-11-13 08:49:34 +00:00
|
|
|
|
sourcemap: 'inline',
|
2022-05-11 15:58:40 +00:00
|
|
|
|
platform: 'node',
|
2021-11-10 15:35:51 +00:00
|
|
|
|
define: {
|
|
|
|
|
'process.env.NODE_ENV': '"development"',
|
|
|
|
|
},
|
|
|
|
|
tsconfig: './tsconfig.json',
|
2021-11-13 08:49:34 +00:00
|
|
|
|
external: ['vscode'],
|
2021-11-13 11:02:10 +00:00
|
|
|
|
incremental: true,
|
|
|
|
|
watch: {
|
|
|
|
|
onRebuild(err) {
|
2021-12-22 00:14:38 +00:00
|
|
|
|
err ? console.error('❌ Failed') : jslog('✅ Updated')
|
2021-11-13 11:02:10 +00:00
|
|
|
|
},
|
|
|
|
|
},
|
2021-11-10 15:35:51 +00:00
|
|
|
|
})
|
|
|
|
|
|
2021-12-22 00:14:38 +00:00
|
|
|
|
jslog(`Built package.`)
|
2021-11-10 15:35:51 +00:00
|
|
|
|
} catch (e) {
|
2021-12-22 00:14:38 +00:00
|
|
|
|
jslog(`× Build failed due to an error.`)
|
|
|
|
|
jslog(e)
|
2021-11-10 15:35:51 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
main()
|