1
- import esbuild from ' esbuild'
2
- import copyPluginPkg from ' @sprout2000/esbuild-copy-plugin'
3
- import { lessLoader } from ' esbuild-plugin-less'
4
- import * as process from ' node:process'
5
- import * as console from ' node:console'
1
+ import esbuild from " esbuild"
2
+ import copyPluginPkg from " @sprout2000/esbuild-copy-plugin"
3
+ import { lessLoader } from " esbuild-plugin-less"
4
+ import * as process from " node:process"
5
+ import * as console from " node:console"
6
6
7
7
const { copyPlugin } = copyPluginPkg
8
- const isProduction = ! process . argv . includes ( ' --development' )
9
- const OUT_DIR = ' dist'
8
+ const isProduction = ! process . argv . includes ( " --development" )
9
+ const OUT_DIR = " dist"
10
10
11
11
const defaultOptions = {
12
- format : ' cjs' ,
13
- resolveExtensions : [ ' .ts' , ' .js' , ' .mjs' , ' .tsx' ] ,
12
+ format : " cjs" ,
13
+ resolveExtensions : [ " .ts" , " .js" , " .mjs" , " .tsx" ] ,
14
14
bundle : true ,
15
15
sourcemap : ! isProduction ,
16
16
minify : isProduction ,
17
- platform : ' node' ,
17
+ platform : " node" ,
18
18
outdir : OUT_DIR ,
19
19
}
20
20
21
21
async function buildExtension ( ) {
22
22
const options = {
23
23
...defaultOptions ,
24
- entryPoints : [ ' ./src/extension.ts' ] ,
25
- external : [ ' vscode' , ' @mapbox/node-pre-gyp' , ' sequelize' ] ,
24
+ entryPoints : [ " ./src/extension.ts" ] ,
25
+ external : [ " vscode" , " @mapbox/node-pre-gyp" , " sequelize" ] ,
26
26
define : {
27
- // eslint-disable-next-line @typescript-eslint/naming-convention
28
27
CNBLOGS_CLIENTID : JSON . stringify ( process . env . CLIENTID ) ,
29
- // eslint-disable-next-line @typescript-eslint/naming-convention
30
28
CNBLOGS_CLIENTSECRET : JSON . stringify ( process . env . CLIENTSECRET ) ,
31
29
} ,
32
30
plugins : [
33
31
copyPlugin ( {
34
- src : ' src/assets' ,
32
+ src : " src/assets" ,
35
33
dest : `${ OUT_DIR } /assets` ,
36
34
errorOnExist : false ,
37
35
} ) ,
38
36
copyPlugin ( {
39
- src : ' node_modules/@mapbox/node-pre-gyp' ,
37
+ src : " node_modules/@mapbox/node-pre-gyp" ,
40
38
dest : `${ OUT_DIR } /node_modules/@mapbox/node-pre-gyp` ,
41
39
errorOnExist : false ,
42
40
} ) ,
43
41
copyPlugin ( {
44
- src : ' node_modules/sequelize' ,
42
+ src : " node_modules/sequelize" ,
45
43
dest : `${ OUT_DIR } /node_modules/sequelize` ,
46
44
errorOnExist : false ,
47
45
} ) ,
48
46
copyPlugin ( {
49
- src : ' node_modules/@fluentui/font-icons-mdl2/fonts/' ,
47
+ src : " node_modules/@fluentui/font-icons-mdl2/fonts/" ,
50
48
dest : `${ OUT_DIR } /assets/fonts` ,
51
49
errorOnExist : false ,
52
50
} ) ,
53
51
copyPlugin ( {
54
- src : ' src/wasm/rs_bg.wasm' ,
52
+ src : " src/wasm/rs_bg.wasm" ,
55
53
dest : `${ OUT_DIR } /rs_bg.wasm` ,
56
54
errorOnExist : false ,
57
55
} ) ,
@@ -62,13 +60,13 @@ async function buildExtension() {
62
60
}
63
61
64
62
async function buildUI ( ...apps ) {
65
- const srcPath = ' ./ui/'
63
+ const srcPath = " ./ui/"
66
64
const outPath = `${ OUT_DIR } /assets/ui/`
67
65
for ( const app of apps ) {
68
66
const options = {
69
67
...defaultOptions ,
70
68
define : {
71
- ' process.env.NODE_ENV' : JSON . stringify ( ' production' ) ,
69
+ " process.env.NODE_ENV" : JSON . stringify ( " production" ) ,
72
70
} ,
73
71
entryPoints : [ `${ srcPath } ${ app } /index.tsx` ] ,
74
72
outdir : `${ outPath } ${ app } ` ,
@@ -86,7 +84,9 @@ async function buildUI(...apps) {
86
84
}
87
85
}
88
86
89
- await Promise . all ( [ buildExtension ( ) , buildUI ( 'ing' , 'post-cfg' ) ] ) . catch ( ex => {
90
- console . error ( ex )
91
- process . exit ( 1 )
92
- } )
87
+ await Promise . all ( [ buildExtension ( ) , buildUI ( "ing" , "post-cfg" ) ] ) . catch (
88
+ ( ex ) => {
89
+ console . error ( ex )
90
+ process . exit ( 1 )
91
+ } ,
92
+ )
0 commit comments