astro/vscode/scripts/build.mjs
Nate Moore 18e7cc5af9
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>
2021-03-25 10:38:17 -05:00

37 lines
855 B
JavaScript

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();