Skip to content

Commit eb0ddda

Browse files
authored
Merge pull request #4430 from hayemaxi/q-cw-ext
webpack, packaging generalizations for subprojects
2 parents a8a6d6b + 89a601c commit eb0ddda

16 files changed

+172
-92
lines changed

.gitignore

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ packages/toolkit/src/testFixtures/**/bin
3838
packages/toolkit/src/testFixtures/**/obj
3939

4040
# Generated by copyFiles.ts
41-
packages/toolkit/README*
42-
packages/toolkit/CHANGELOG.md
43-
packages/toolkit/LICENSE
44-
packages/toolkit/NOTICE
41+
packages/*/README*
42+
packages/*/CHANGELOG.md
43+
packages/*/LICENSE
44+
packages/*/NOTICE
4545

4646
# Icons
4747
packages/toolkit/resources/icons/cloud9/generated/**

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"test": "npm run test -w packages/",
2929
"testE2E": "npm run testE2E -w packages/",
3030
"testInteg": "npm run testInteg -w packages/",
31-
"package": "npm run package -w packages/",
31+
"package": "npm run package -w packages/toolkit",
3232
"newChange": "ts-node ./scripts/newChange.ts",
3333
"createRelease": "ts-node ./scripts/createRelease.ts",
3434
"format": "prettier --check plugins && npm run format -w packages/",
@@ -56,12 +56,16 @@
5656
"@vscode/test-electron": "^2.3.8",
5757
"@vscode/test-web": "^0.0.50",
5858
"@vscode/vsce": "^2.19.0",
59+
"@types/webpack-env": "^1.18.1",
5960
"prettier": "^2.8.8",
6061
"prettier-plugin-sh": "^0.12.8",
6162
"pretty-quick": "^3.1.3",
6263
"husky": "^9.0.7",
6364
"typescript": "^5.0.4",
64-
"ts-node": "^10.9.1"
65+
"ts-node": "^10.9.1",
66+
"webpack": "^5.83.0",
67+
"webpack-cli": "^5.1.4",
68+
"webpack-dev-server": "^4.15.1"
6569
},
6670
"dependencies": {
6771
"vscode-nls": "^5.2.0",

packages/amazonq/package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,16 @@
4040
"onStartupFinished",
4141
"onUri"
4242
],
43-
"main": "./dist/src/main.js",
43+
"main": "./dist/src/extension",
44+
"browser": "./dist/src/extensionWeb",
4445
"scripts": {
46+
"vscode:prepublish": "npm run clean && npm run compile && webpack --mode production",
4547
"clean": "ts-node ../../scripts/clean.ts dist/",
46-
"compile": "tsc -p ./",
47-
"testCompile": "npm run compile",
48+
"compile": "npm run clean && tsc -p ./ && webpack --mode development",
49+
"testCompile": "tsc -p ./",
4850
"watch": "npm run clean && tsc -watch -p ./",
49-
"serve": "echo 1"
51+
"serve": "webpack serve --config-name vue-hmr --mode development",
52+
"package": "ts-node ../../scripts/package.ts"
5053
},
5154
"dependencies": {},
5255
"devDependencies": {},

packages/amazonq/src/extension.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,10 @@
44
*/
55

66
import * as vscode from 'vscode'
7+
import { activateShared } from './extensionShared'
78

89
export async function activate(context: vscode.ExtensionContext) {
9-
void vscode.window.showInformationMessage(
10-
'Amazon Q + CodeWhisperer: This extension is under development and offers no features at this time.'
11-
)
10+
await activateShared()
1211
}
1312

1413
export async function deactivate() {}
15-
16-
export const awsQActivate = activate
17-
export const awsQDeactivate = deactivate
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*!
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
import * as vscode from 'vscode'
7+
8+
export async function activateShared() {
9+
void vscode.window.showInformationMessage(
10+
'Amazon Q + CodeWhisperer: This extension is under development and offers no features at this time.'
11+
)
12+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*!
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
import * as vscode from 'vscode'
7+
import { activateShared } from './extensionShared'
8+
9+
export async function activate(context: vscode.ExtensionContext) {
10+
await activateShared()
11+
}
12+
13+
export async function deactivate() {}

packages/amazonq/src/main.ts

Lines changed: 0 additions & 15 deletions
This file was deleted.

packages/amazonq/webpack.config.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*!
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
/**
7+
* This is the final webpack config that collects all webpack configs.
8+
*/
9+
10+
const baseConfig = require('../webpack.base.config')
11+
const baseVueConfig = require('../webpack.vue.config')
12+
const baseBrowserConfig = require('../webpack.browser.config')
13+
14+
const config = {
15+
...baseConfig,
16+
entry: {
17+
'src/extension': './src/extension.ts',
18+
},
19+
}
20+
21+
const vueConfigs = baseVueConfig.configs.map(c => {
22+
// Inject entry point into all configs.
23+
return {
24+
...c,
25+
entry: {
26+
...baseVueConfig.utils.createVueEntries(),
27+
//'src/amazonq/webview/ui/amazonq-ui': './src/amazonq/webview/ui/main.ts',
28+
},
29+
}
30+
})
31+
32+
const browserConfig = {
33+
...baseBrowserConfig,
34+
entry: {
35+
'src/extensionWeb': './src/extensionWeb.ts',
36+
},
37+
}
38+
39+
module.exports = [config, ...vueConfigs, browserConfig]

packages/toolkit/package.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4246,7 +4246,7 @@
42464246
"clean": "ts-node ../../scripts/clean.ts dist/ LICENSE NOTICE quickStart* README* CHANGELOG.md",
42474247
"copyFiles": "ts-node ./scripts/build/copyFiles.ts",
42484248
"buildScripts": "npm run generateClients && npm run generatePackage && npm run generateNonCodeFiles && npm run copyFiles",
4249-
"browserWatch": "npm run clean && npm run buildScripts && webpack --config webpack.browser.config.js --watch",
4249+
"browserWatch": "npm run clean && npm run buildScripts && webpack --config-name web --watch",
42504250
"browserRun": "npx @vscode/test-web --open-devtools --browserOption=--disable-web-security --waitForDebugger=9222 --extensionDevelopmentPath=. .",
42514251
"compile": "npm run clean && npm run buildScripts && webpack --mode development && npm run copyFiles",
42524252
"watch": "npm run clean && npm run buildScripts && tsc -watch -p ./",
@@ -4257,7 +4257,7 @@
42574257
"format": "prettier --ignore-path ../../.prettierignore --check src scripts",
42584258
"formatfix": "prettier --ignore-path ../../.prettierignore --write src scripts",
42594259
"lint": "ts-node ./scripts/lint/testLint.ts && npm run format",
4260-
"package": "ts-node ./scripts/build/package.ts",
4260+
"package": "ts-node ../../scripts/package.ts",
42614261
"install-plugin": "vsce package -o aws-toolkit-vscode-test.vsix && code --install-extension aws-toolkit-vscode-test.vsix",
42624262
"generateClients": "npm run build -w @amzn/codewhisperer-streaming && ts-node ./scripts/build/generateServiceClient.ts ",
42634263
"generatePackage": "ts-node ./scripts/build/generateIcons.ts",
@@ -4297,7 +4297,6 @@
42974297
"@types/sinonjs__fake-timers": "^8.1.2",
42984298
"@types/tcp-port-used": "^1.0.1",
42994299
"@types/uuid": "^9.0.1",
4300-
"@types/webpack-env": "^1.18.1",
43014300
"@types/whatwg-url": "^11.0.4",
43024301
"@types/xml2js": "^0.4.11",
43034302
"@typescript-eslint/eslint-plugin": "^5.59.0",
@@ -4324,9 +4323,6 @@
43244323
"vue-loader": "^17.2.2",
43254324
"vue-style-loader": "^4.1.3",
43264325
"webfont": "^11.2.26",
4327-
"webpack": "^5.83.0",
4328-
"webpack-cli": "^5.1.4",
4329-
"webpack-dev-server": "^4.15.1",
43304326
"typescript": "^5.0.4",
43314327
"ts-node": "^10.9.1"
43324328
},

0 commit comments

Comments
 (0)