File tree Expand file tree Collapse file tree 5 files changed +141
-5
lines changed
compiler/packages/react-forgive Expand file tree Collapse file tree 5 files changed +141
-5
lines changed Original file line number Diff line number Diff line change 11** /node_modules
22client
33server
4+ scripts
Original file line number Diff line number Diff line change 3636 },
3737 "scripts" : {
3838 "build" : " yarn run compile" ,
39- "compile" : " rimraf dist && concurrently -n server,client \" yarn run esbuild: server --sourcemap \" \" yarn run esbuild: client --sourcemap \" " ,
39+ "compile" : " rimraf dist && concurrently -n server,client \" scripts/build.mjs -t server\" \" scripts/build.mjs -t client\" " ,
4040 "dev" : " yarn run package && yarn run install-ext" ,
41- "esbuild:client" : " esbuild ./client/src/extension.ts --bundle --outfile=dist/extension.js --external:vscode --format=cjs --platform=node" ,
42- "esbuild:server" : " esbuild ./server/src/index.ts --bundle --outfile=dist/server.js --external:vscode --format=cjs --platform=node" ,
4341 "install-ext" : " code --install-extension react-forgive-0.0.0.vsix" ,
4442 "lint" : " echo 'no tests'" ,
4543 "package" : " rm -f react-forgive-0.0.0.vsix && vsce package --yarn" ,
4644 "postinstall" : " cd client && yarn install && cd ../server && yarn install && cd .." ,
4745 "pretest" : " yarn run compile && yarn run lint" ,
4846 "test" : " vscode-test" ,
4947 "vscode:prepublish" : " yarn run compile" ,
50- "watch" : " concurrently --kill-others -n server,client \" run esbuild:server --sourcemap -- watch\" \" run esbuild:client --sourcemap --watch \" "
48+ "watch" : " scripts/build.mjs --watch"
5149 },
5250 "devDependencies" : {
5351 "@eslint/js" : " ^9.13.0" ,
5957 "esbuild" : " ^0.24.0" ,
6058 "eslint" : " ^9.13.0" ,
6159 "mocha" : " ^11.0.1" ,
62- "typescript-eslint" : " ^8.16.0"
60+ "typescript-eslint" : " ^8.16.0" ,
61+ "yargs" : " ^17.7.2"
6362 }
6463}
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env node
2+
3+ /**
4+ * Copyright (c) Meta Platforms, Inc. and affiliates.
5+ *
6+ * This source code is licensed under the MIT license found in the
7+ * LICENSE file in the root directory of this source tree.
8+ */
9+
10+ import * as esbuild from 'esbuild' ;
11+ import yargs from 'yargs' ;
12+ import * as Server from './server.mjs' ;
13+ import * as Client from './client.mjs' ;
14+ import path from 'path' ;
15+ import { fileURLToPath } from 'url' ;
16+
17+ const IS_DEV = process . env . NODE_ENV === 'development' ;
18+ const __filename = fileURLToPath ( import . meta. url ) ;
19+ const __dirname = path . dirname ( __filename ) ;
20+
21+ const argv = yargs ( process . argv . slice ( 2 ) )
22+ . choices ( 't' , [ 'client' , 'server' ] )
23+ . options ( 'w' , {
24+ alias : 'watch' ,
25+ default : false ,
26+ type : 'boolean' ,
27+ } )
28+ . parse ( ) ;
29+
30+ async function main ( ) {
31+ if ( argv . w ) {
32+ const serverCtx = await esbuild . context ( Server . config ) ;
33+ const clientCtx = await esbuild . context ( Client . config ) ;
34+ await Promise . all ( [ serverCtx . watch ( ) , clientCtx . watch ( ) ] ) ;
35+ console . log ( 'watching for changes...' ) ;
36+ } else {
37+ switch ( argv . t ) {
38+ case 'server' : {
39+ await esbuild . build ( {
40+ sourcemap : IS_DEV ,
41+ minify : IS_DEV === false ,
42+ ...Server . config ,
43+ } ) ;
44+ break ;
45+ }
46+ case 'client' : {
47+ await esbuild . build ( {
48+ sourcemap : IS_DEV ,
49+ minify : IS_DEV === false ,
50+ ...Client . config ,
51+ } ) ;
52+ break ;
53+ }
54+ }
55+ }
56+ }
57+
58+ main ( ) ;
Original file line number Diff line number Diff line change 1+ /**
2+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3+ *
4+ * This source code is licensed under the MIT license found in the
5+ * LICENSE file in the root directory of this source tree.
6+ */
7+
8+ import path from 'path' ;
9+ import { fileURLToPath } from 'url' ;
10+
11+ const __filename = fileURLToPath ( import . meta. url ) ;
12+ const __dirname = path . dirname ( __filename ) ;
13+
14+ export const entryPoint = path . join ( __dirname , '../client/src/extension.ts' ) ;
15+ export const outfile = path . join ( __dirname , '../dist/extension.js' ) ;
16+ export const config = {
17+ entryPoints : [ entryPoint ] ,
18+ outfile,
19+ bundle : true ,
20+ external : [ 'vscode' ] ,
21+ format : 'cjs' ,
22+ platform : 'node' ,
23+ banner : {
24+ js : `/**
25+ * Copyright (c) Meta Platforms, Inc. and affiliates.
26+ *
27+ * This source code is licensed under the MIT license found in the
28+ * LICENSE file in the root directory of this source tree.
29+ *
30+ * @lightSyntaxTransform
31+ * @noflow
32+ * @nolint
33+ * @preventMunge
34+ * @preserve-invariant-messages
35+ */
36+
37+ ` ,
38+ } ,
39+ } ;
Original file line number Diff line number Diff line change 1+ /**
2+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3+ *
4+ * This source code is licensed under the MIT license found in the
5+ * LICENSE file in the root directory of this source tree.
6+ */
7+
8+ import path from 'path' ;
9+ import { fileURLToPath } from 'url' ;
10+
11+ const __filename = fileURLToPath ( import . meta. url ) ;
12+ const __dirname = path . dirname ( __filename ) ;
13+
14+ export const entryPoint = path . join ( __dirname , '../server/src/index.ts' ) ;
15+ export const outfile = path . join ( __dirname , '../dist/extension.js' ) ;
16+ export const config = {
17+ entryPoints : [ entryPoint ] ,
18+ outfile,
19+ bundle : true ,
20+ external : [ 'vscode' ] ,
21+ format : 'cjs' ,
22+ platform : 'node' ,
23+ banner : {
24+ js : `/**
25+ * Copyright (c) Meta Platforms, Inc. and affiliates.
26+ *
27+ * This source code is licensed under the MIT license found in the
28+ * LICENSE file in the root directory of this source tree.
29+ *
30+ * @lightSyntaxTransform
31+ * @noflow
32+ * @nolint
33+ * @preventMunge
34+ * @preserve-invariant-messages
35+ */
36+
37+ ` ,
38+ } ,
39+ } ;
You can’t perform that action at this time.
0 commit comments