2021-11-10 15:35:51 +00:00
|
|
|
|
/* 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 {
|
2021-11-13 08:49:34 +00:00
|
|
|
|
esbuild.buildSync({
|
2021-11-10 15:35:51 +00:00
|
|
|
|
entryPoints: ['./src/extension.ts'],
|
|
|
|
|
outdir: 'dist/web',
|
2021-11-13 11:02:10 +00:00
|
|
|
|
minify: false,
|
2021-11-10 15:35:51 +00:00
|
|
|
|
bundle: true,
|
|
|
|
|
format: 'cjs',
|
|
|
|
|
target: 'es6',
|
|
|
|
|
define: {
|
|
|
|
|
'process.env.NODE_ENV': '"production"',
|
|
|
|
|
},
|
|
|
|
|
tsconfig: './tsconfig.json',
|
2021-11-13 08:49:34 +00:00
|
|
|
|
external: ['vscode'],
|
2021-11-10 15:35:51 +00:00
|
|
|
|
})
|
2021-11-13 08:49:34 +00:00
|
|
|
|
console.log(`Built package.`)
|
2021-11-10 15:35:51 +00:00
|
|
|
|
} catch (e) {
|
2021-11-13 08:49:34 +00:00
|
|
|
|
console.log(`× Build failed due to an error.`)
|
2021-11-10 15:35:51 +00:00
|
|
|
|
console.log(e)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
main()
|