Commit d562838 1 parent 1a987ee commit d562838 Copy full SHA for d562838
File tree 2 files changed +31
-1
lines changed
2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change
1
+ .github /
1
2
.vscode /
2
3
out /**
3
4
node_modules /**
@@ -11,4 +12,5 @@ vsc-extension-quickstart.md
11
12
** /* .map
12
13
** /* .ts
13
14
** /.vscode-test. *
14
- resources /
15
+ resources /
16
+ lib /
Original file line number Diff line number Diff line change 1
1
const esbuild = require ( "esbuild" ) ;
2
+ const fs = require ( 'fs' ) ;
3
+ const path = require ( 'path' ) ;
2
4
3
5
const production = process . argv . includes ( '--production' ) ;
4
6
const watch = process . argv . includes ( '--watch' ) ;
@@ -23,6 +25,31 @@ const esbuildProblemMatcherPlugin = {
23
25
} ,
24
26
} ;
25
27
28
+ /**
29
+ * @type {import('esbuild').Plugin }
30
+ */
31
+ const copyLibPlugin = {
32
+ name : 'copy-lib' ,
33
+ setup ( build ) {
34
+ build . onEnd ( ( ) => {
35
+ const srcDir = path . join ( __dirname , 'lib' ) ;
36
+ const destDir = path . join ( __dirname , 'dist' , 'lib' ) ;
37
+
38
+ if ( ! fs . existsSync ( destDir ) ) {
39
+ fs . mkdirSync ( destDir , { recursive : true } ) ;
40
+ }
41
+
42
+ fs . readdirSync ( srcDir ) . forEach ( file => {
43
+ const srcFile = path . join ( srcDir , file ) ;
44
+ const destFile = path . join ( destDir , file ) ;
45
+ fs . copyFileSync ( srcFile , destFile ) ;
46
+ } ) ;
47
+
48
+ console . log ( 'Copied lib directory to dist/lib' ) ;
49
+ } ) ;
50
+ }
51
+ } ;
52
+
26
53
async function main ( ) {
27
54
const ctx = await esbuild . context ( {
28
55
entryPoints : [
@@ -40,6 +67,7 @@ async function main() {
40
67
plugins : [
41
68
/* add to the end of plugins array */
42
69
esbuildProblemMatcherPlugin ,
70
+ copyLibPlugin ,
43
71
] ,
44
72
} ) ;
45
73
if ( watch ) {
You can’t perform that action at this time.
0 commit comments