Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: update bundling of Codewhisperer language server #804

Merged
merged 1 commit into from
Feb 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/aws-lsp-codewhisperer-runtimes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This command will compile package and produce 2 bundled Javascript programs in `
- `./out/iam-standalone.js` - Amazon Q server using IAM Credentials provider
- `./out/token-standalone.js` - Amazon Q server using Bearer Token SSO Credentials provider

To test server you can use sample IDEs client in [`./client`](../../client) subpackages. In VSCode, you can use "Run and Debug" functionality with [sample client extension](../../CONTRIBUTING.md#with-minimal-vscode-client) and update `launch.json` configuration to point to [compiled bundle file](../../.vscode/launch.json#L60). Change value for `LSP_SERVER` valiable from `${workspaceFolder}/app/aws-lsp-codewhisperer-bundle/out/index.js` to `${workspaceFolder}/app/aws-lsp-codewhisperer-bundle/out/token-standalone.js`.
To test server you can use sample IDEs client in [`./client`](../../client) subpackages. In VSCode, you can use "Run and Debug" functionality with [sample client extension](../../CONTRIBUTING.md#with-minimal-vscode-client) and update `launch.json` configuration to point to [compiled bundle file](../../.vscode/launch.json#L60). Change value for `LSP_SERVER` valiable from `${workspaceFolder}/app/aws-lsp-codewhisperer-runtimes/out/index.js` to `${workspaceFolder}/app/aws-lsp-codewhisperer-runtimes/out/token-standalone.js`.

To verify compiled bundle can run, you can start it in your shell with NodeJS:

Expand Down
1 change: 1 addition & 0 deletions app/aws-lsp-codewhisperer-runtimes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"copyfiles": "^2.4.1"
},
"devDependencies": {
"node-loader": "^2.1.0",
"ts-loader": "^9.4.4",
"webpack": "^5.94.0",
"webpack-cli": "^6.0.1"
Expand Down
14 changes: 11 additions & 3 deletions app/aws-lsp-codewhisperer-runtimes/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@ var path = require('path')
const baseConfig = {
mode: 'development',
output: {
path: __dirname,
filename: 'build/[name].js',
path: path.resolve(__dirname, 'build'),
filename: '[name].js',
globalObject: 'this',
chunkFormat: false,
library: {
type: 'umd',
},
},
resolve: {
extensions: ['.ts', '.tsx', '.js'],
extensions: ['.ts', '.tsx', '.js', '.node'],
},
module: {
rules: [
Expand All @@ -20,6 +21,13 @@ const baseConfig = {
use: 'ts-loader',
exclude: /node_modules/,
},
{
test: /\.node$/,
loader: 'node-loader',
options: {
name: '[name].[ext]', // Preserves original path and filename
},
},
],
},
}
Expand Down
49 changes: 49 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading