File tree Expand file tree Collapse file tree 7 files changed +85
-454
lines changed
Expand file tree Collapse file tree 7 files changed +85
-454
lines changed Original file line number Diff line number Diff line change 1+ const esbuild = require ( "esbuild" ) ;
2+
3+ const production = process . argv . includes ( '--production' ) ;
4+ const watch = process . argv . includes ( '--watch' ) ;
5+
6+ /**
7+ * @type {import('esbuild').Plugin }
8+ */
9+ const esbuildProblemMatcherPlugin = {
10+ name : 'esbuild-problem-matcher' ,
11+
12+ setup ( build ) {
13+ build . onStart ( ( ) => {
14+ console . log ( '[watch] build started' ) ;
15+ } ) ;
16+ build . onEnd ( ( result ) => {
17+ result . errors . forEach ( ( { text, location } ) => {
18+ console . error ( `✘ [ERROR] ${ text } ` ) ;
19+ console . error ( ` ${ location . file } :${ location . line } :${ location . column } :` ) ;
20+ } ) ;
21+ console . log ( '[watch] build finished' ) ;
22+ } ) ;
23+ } ,
24+ } ;
25+
26+ async function main ( ) {
27+ const ctx = await esbuild . context ( {
28+ entryPoints : [
29+ 'src/extension.ts'
30+ ] ,
31+ bundle : true ,
32+ format : 'cjs' ,
33+ minify : production ,
34+ sourcemap : ! production ,
35+ sourcesContent : false ,
36+ platform : 'node' ,
37+ outfile : 'dist/extension.js' ,
38+ external : [ 'vscode' ] ,
39+ logLevel : 'silent' ,
40+ plugins : [
41+ /* add to the end of plugins array */
42+ esbuildProblemMatcherPlugin ,
43+ ] ,
44+ } ) ;
45+ if ( watch ) {
46+ await ctx . watch ( ) ;
47+ } else {
48+ await ctx . rebuild ( ) ;
49+ await ctx . dispose ( ) ;
50+ }
51+ }
52+
53+ main ( ) . catch ( e => {
54+ console . error ( e ) ;
55+ process . exit ( 1 ) ;
56+ } ) ;
Original file line number Diff line number Diff line change @@ -5,10 +5,7 @@ const config: KnipConfig = {
55 '.' : {
66 entry : 'src/index.ts' ,
77 ignoreDependencies : [ 'terser' ] ,
8- ignoreBinaries : [ 'vsce' ] ,
9- tsup : {
10- config : 'tsup.config.ts'
11- } ,
8+ ignoreBinaries : [ 'vsce' ]
129 } ,
1310 } ,
1411 ignoreWorkspaces : [ 'ui' ]
Original file line number Diff line number Diff line change 3737 " svelte typescript react vue solid astro"
3838 ],
3939 "activationEvents" : [
40- " onView: previewDocSidebar"
40+ " previewDocSidebar"
4141 ],
4242 "files" : [
4343 " dist"
7373 ],
7474 "scripts" : {
7575 "install:all" : " pnpm install && cd ui && pnpm install" ,
76- "build" : " tsup && cd ui && pnpm build" ,
76+ "build" : " cd ui && pnpm build" ,
7777 "vscode:prepublish" : " pnpm build" ,
7878 "dev" : " pnpm build -- --watch" ,
7979 "lint" : " eslint --cache ./src --ext .ts --fix" ,
80- "package" : " vsce package --no-dependencies " ,
80+ "package" : " pnpm run typecheck && pnpm run lint && node esbuild.js --production " ,
8181 "publish:release" : " vsce publish --no-dependencies" ,
8282 "publish:pre" : " vsce publish --pre-release --no-dependencies" ,
8383 "release" : " pnpm build && npx changelogen --release --push && pnpm publish:release" ,
9090 "@types/vscode" : " ^1.100.0" ,
9191 "@typescript-eslint/eslint-plugin" : " ^6.21.0" ,
9292 "@typescript-eslint/parser" : " ^6.21.0" ,
93+ "esbuild" : " ^0.25.4" ,
9394 "eslint" : " ^8.57.1" ,
9495 "knip" : " ^4.6.0" ,
95- "tsup" : " ^8.5.0" ,
9696 "typescript" : " ^5.8.3"
9797 },
9898 "dependencies" : {
You can’t perform that action at this time.
0 commit comments