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"
66
77const { 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"
1010
1111const defaultOptions = {
12- format : ' cjs' ,
13- resolveExtensions : [ ' .ts' , ' .js' , ' .mjs' , ' .tsx' ] ,
12+ format : " cjs" ,
13+ resolveExtensions : [ " .ts" , " .js" , " .mjs" , " .tsx" ] ,
1414 bundle : true ,
1515 sourcemap : ! isProduction ,
1616 minify : isProduction ,
17- platform : ' node' ,
17+ platform : " node" ,
1818 outdir : OUT_DIR ,
1919}
2020
2121async function buildExtension ( ) {
2222 const options = {
2323 ...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" ] ,
2626 define : {
27- // eslint-disable-next-line @typescript-eslint/naming-convention
2827 CNBLOGS_CLIENTID : JSON . stringify ( process . env . CLIENTID ) ,
29- // eslint-disable-next-line @typescript-eslint/naming-convention
3028 CNBLOGS_CLIENTSECRET : JSON . stringify ( process . env . CLIENTSECRET ) ,
3129 } ,
3230 plugins : [
3331 copyPlugin ( {
34- src : ' src/assets' ,
32+ src : " src/assets" ,
3533 dest : `${ OUT_DIR } /assets` ,
3634 errorOnExist : false ,
3735 } ) ,
3836 copyPlugin ( {
39- src : ' node_modules/@mapbox/node-pre-gyp' ,
37+ src : " node_modules/@mapbox/node-pre-gyp" ,
4038 dest : `${ OUT_DIR } /node_modules/@mapbox/node-pre-gyp` ,
4139 errorOnExist : false ,
4240 } ) ,
4341 copyPlugin ( {
44- src : ' node_modules/sequelize' ,
42+ src : " node_modules/sequelize" ,
4543 dest : `${ OUT_DIR } /node_modules/sequelize` ,
4644 errorOnExist : false ,
4745 } ) ,
4846 copyPlugin ( {
49- src : ' node_modules/@fluentui/font-icons-mdl2/fonts/' ,
47+ src : " node_modules/@fluentui/font-icons-mdl2/fonts/" ,
5048 dest : `${ OUT_DIR } /assets/fonts` ,
5149 errorOnExist : false ,
5250 } ) ,
5351 copyPlugin ( {
54- src : ' src/wasm/rs_bg.wasm' ,
52+ src : " src/wasm/rs_bg.wasm" ,
5553 dest : `${ OUT_DIR } /rs_bg.wasm` ,
5654 errorOnExist : false ,
5755 } ) ,
@@ -62,13 +60,13 @@ async function buildExtension() {
6260}
6361
6462async function buildUI ( ...apps ) {
65- const srcPath = ' ./ui/'
63+ const srcPath = " ./ui/"
6664 const outPath = `${ OUT_DIR } /assets/ui/`
6765 for ( const app of apps ) {
6866 const options = {
6967 ...defaultOptions ,
7068 define : {
71- ' process.env.NODE_ENV' : JSON . stringify ( ' production' ) ,
69+ " process.env.NODE_ENV" : JSON . stringify ( " production" ) ,
7270 } ,
7371 entryPoints : [ `${ srcPath } ${ app } /index.tsx` ] ,
7472 outdir : `${ outPath } ${ app } ` ,
@@ -86,7 +84,9 @@ async function buildUI(...apps) {
8684 }
8785}
8886
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