-
Notifications
You must be signed in to change notification settings - Fork 47.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags:
- Loading branch information
Showing
5 changed files
with
141 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
**/node_modules | ||
client | ||
server | ||
scripts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/usr/bin/env node | ||
|
||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import * as esbuild from 'esbuild'; | ||
import yargs from 'yargs'; | ||
import * as Server from './server.mjs'; | ||
import * as Client from './client.mjs'; | ||
import path from 'path'; | ||
import {fileURLToPath} from 'url'; | ||
|
||
const IS_DEV = process.env.NODE_ENV === 'development'; | ||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = path.dirname(__filename); | ||
|
||
const argv = yargs(process.argv.slice(2)) | ||
.choices('t', ['client', 'server']) | ||
.options('w', { | ||
alias: 'watch', | ||
default: false, | ||
type: 'boolean', | ||
}) | ||
.parse(); | ||
|
||
async function main() { | ||
if (argv.w) { | ||
const serverCtx = await esbuild.context(Server.config); | ||
const clientCtx = await esbuild.context(Client.config); | ||
await Promise.all([serverCtx.watch(), clientCtx.watch()]); | ||
console.log('watching for changes...'); | ||
} else { | ||
switch (argv.t) { | ||
case 'server': { | ||
await esbuild.build({ | ||
sourcemap: IS_DEV, | ||
minify: IS_DEV === false, | ||
...Server.config, | ||
}); | ||
break; | ||
} | ||
case 'client': { | ||
await esbuild.build({ | ||
sourcemap: IS_DEV, | ||
minify: IS_DEV === false, | ||
...Client.config, | ||
}); | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
|
||
main(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import path from 'path'; | ||
import {fileURLToPath} from 'url'; | ||
|
||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = path.dirname(__filename); | ||
|
||
export const entryPoint = path.join(__dirname, '../client/src/extension.ts'); | ||
export const outfile = path.join(__dirname, '../dist/extension.js'); | ||
export const config = { | ||
entryPoints: [entryPoint], | ||
outfile, | ||
bundle: true, | ||
external: ['vscode'], | ||
format: 'cjs', | ||
platform: 'node', | ||
banner: { | ||
js: `/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @lightSyntaxTransform | ||
* @noflow | ||
* @nolint | ||
* @preventMunge | ||
* @preserve-invariant-messages | ||
*/ | ||
`, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import path from 'path'; | ||
import {fileURLToPath} from 'url'; | ||
|
||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = path.dirname(__filename); | ||
|
||
export const entryPoint = path.join(__dirname, '../server/src/index.ts'); | ||
export const outfile = path.join(__dirname, '../dist/extension.js'); | ||
export const config = { | ||
entryPoints: [entryPoint], | ||
outfile, | ||
bundle: true, | ||
external: ['vscode'], | ||
format: 'cjs', | ||
platform: 'node', | ||
banner: { | ||
js: `/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @lightSyntaxTransform | ||
* @noflow | ||
* @nolint | ||
* @preventMunge | ||
* @preserve-invariant-messages | ||
*/ | ||
`, | ||
}, | ||
}; |