summaryrefslogtreecommitdiff
path: root/vscode/scripts/build.mjs
diff options
context:
space:
mode:
authorGravatar Nate Moore <natemoo-re@users.noreply.github.com> 2021-03-25 10:38:17 -0500
committerGravatar GitHub <noreply@github.com> 2021-03-25 10:38:17 -0500
commit18e7cc5af903543ac6f46780bfea67c13c6517df (patch)
treef61100a6adf3d4641cab89a23ac071268ed911e2 /vscode/scripts/build.mjs
parent30cccdf7154b6470e876464da9e412af10894dd5 (diff)
downloadastro-18e7cc5af903543ac6f46780bfea67c13c6517df.tar.gz
astro-18e7cc5af903543ac6f46780bfea67c13c6517df.tar.zst
astro-18e7cc5af903543ac6f46780bfea67c13c6517df.zip
Scaffold language server (#25)
* wip: scaffold astro extension * wip: scaffold astro extension * WIP: vscode extension * fix: autoCloseBefore * chore: update package.json * fix: use tsx instead of plain ts * chore: remove dist files * chore: remove comments * chore: cleanup package build process, switch build to esbuild * refactor: use shared esbuild config Co-authored-by: Nate Moore <nate@skypack.dev>
Diffstat (limited to 'vscode/scripts/build.mjs')
-rw-r--r--vscode/scripts/build.mjs37
1 files changed, 37 insertions, 0 deletions
diff --git a/vscode/scripts/build.mjs b/vscode/scripts/build.mjs
new file mode 100644
index 000000000..baaaa207f
--- /dev/null
+++ b/vscode/scripts/build.mjs
@@ -0,0 +1,37 @@
+import esbuild from 'esbuild';
+import config from './esbuild.config.mjs';
+import { performance } from 'perf_hooks';
+
+function buildClient() {
+ return esbuild.build({
+ ...config,
+ entryPoints: ['packages/client/src/index.ts'],
+ outfile: 'dist/index.js',
+ });
+}
+
+function buildServer() {
+ return esbuild.build({
+ ...config,
+ entryPoints: ['packages/server/src/index.ts'],
+ outfile: 'dist/server.js',
+ });
+}
+
+async function build() {
+ const start = performance.now();
+ try {
+ await Promise.all([buildClient(), buildServer()]);
+ } catch ({ errors }) {
+ if (errors[0].text.indexOf('Could not resolve') > -1) {
+ console.error('Make sure you run "npm run bootstrap" first!');
+ }
+ return;
+ }
+ const end = performance.now();
+ const span = end - start;
+
+ console.log(`✨ Built in ${Math.round(span)}ms!`);
+}
+
+build();