Skip to content

Commit 21db693

Browse files
committed
bundle & logo
1 parent 4d6778f commit 21db693

File tree

7 files changed

+2183
-29
lines changed

7 files changed

+2183
-29
lines changed

.vscodeignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,7 @@ vsc-extension-quickstart.md
1111
create_refs.py
1212
**/*.ts
1313
showcase.png
14-
.mypy_cache
14+
.mypy_cache
15+
node_modules
16+
esbuild.js
17+
tsconfig.json

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1-
# [1.0.0]
1+
# Changelog
2+
3+
## [1.1.0]
4+
5+
- Added logo
6+
- Bundled extension to reduce size
7+
8+
## [1.0.0]
29

310
- Initial release

esbuild.js

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
const esbuild = require('esbuild');
2+
3+
const production = process.argv.includes('--production');
4+
const watch = process.argv.includes('--watch');
5+
6+
async function main() {
7+
const ctx = await esbuild.context({
8+
entryPoints: ['src/extension.ts'],
9+
bundle: true,
10+
format: 'cjs',
11+
minify: production,
12+
sourcemap: !production,
13+
sourcesContent: false,
14+
platform: 'node',
15+
outfile: 'dist/extension.js',
16+
external: ['vscode'],
17+
logLevel: 'silent',
18+
plugins: [
19+
/* add to the end of plugins array */
20+
esbuildProblemMatcherPlugin
21+
]
22+
});
23+
if (watch) {
24+
await ctx.watch();
25+
} else {
26+
await ctx.rebuild();
27+
await ctx.dispose();
28+
}
29+
}
30+
31+
/**
32+
* @type {import('esbuild').Plugin}
33+
*/
34+
const esbuildProblemMatcherPlugin = {
35+
name: 'esbuild-problem-matcher',
36+
37+
setup(build) {
38+
build.onStart(() => {
39+
console.log('[watch] build started');
40+
});
41+
build.onEnd(result => {
42+
result.errors.forEach(({ text, location }) => {
43+
console.error(`✘ [ERROR] ${text}`);
44+
console.error(` ${location.file}:${location.line}:${location.column}:`);
45+
});
46+
console.log('[watch] build finished');
47+
});
48+
}
49+
};
50+
51+
main().catch(e => {
52+
console.error(e);
53+
process.exit(1);
54+
});

logo.png

31.2 KB
Loading

0 commit comments

Comments
 (0)