Skip to content

Commit

Permalink
chore(vscode): combine build actions
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Nov 6, 2024
1 parent baa843e commit 6c8d41d
Showing 1 changed file with 4 additions and 34 deletions.
38 changes: 4 additions & 34 deletions extensions/vscode/scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ const fs = require('fs');

require('esbuild').context({
entryPoints: {
client: './out/nodeClientMain.js',
server: './node_modules/@vue/language-server/bin/vue-language-server.js',
'dist/client': './out/nodeClientMain.js',
'dist/server': './node_modules/@vue/language-server/bin/vue-language-server.js',
'node_modules/typescript-vue-plugin-bundle/index': './node_modules/@vue/typescript-plugin/index.js',
},
bundle: true,
metafile: process.argv.includes('--metafile'),
outdir: './dist',
outdir: '.',
external: ['vscode'],
format: 'cjs',
platform: 'node',
Expand Down Expand Up @@ -62,34 +63,3 @@ require('esbuild').context({
console.log('finished.');
}
})

require('esbuild').context({
entryPoints: ['./node_modules/@vue/typescript-plugin/index.js'],
bundle: true,
outfile: './node_modules/typescript-vue-plugin-bundle/index.js',
external: ['vscode'],
format: 'cjs',
platform: 'node',
tsconfig: './tsconfig.json',
minify: process.argv.includes('--minify'),
plugins: [{
name: 'umd2esm',
setup(build) {
build.onResolve({ filter: /^(vscode-.*-languageservice|jsonc-parser)/ }, args => {
const pathUmdMay = require.resolve(args.path, { paths: [args.resolveDir] })
const pathEsm = pathUmdMay.replace('/umd/', '/esm/')
return { path: pathEsm }
})
},
}],
}).then(async ctx => {
console.log('building...');
if (process.argv.includes('--watch')) {
await ctx.watch();
console.log('watching...');
} else {
await ctx.rebuild();
await ctx.dispose();
console.log('finished.');
}
})

0 comments on commit 6c8d41d

Please sign in to comment.