Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: webpack/build scripts (#4670)
* test: fix core tests prompting build task Problem: When we run the core tests they prompt for a build task before running. We should not have to do this. Solution: Create a specific build task and explicitly use that. I think due to our recent changes the "defaultBuildTask" cannot be appropriately resolved which is why this change was needed. Signed-off-by: Nikolas Komonen <[email protected]> * refactor: remove index files in core Problem: We had index files in the core package which we used to expose certain methods once we packaged core in to a node module for use by the toolkit and amazonq package. We don't need it. Solution: Stop using the index files and go back to using the extension*.ts files Signed-off-by: Nikolas Komonen <[email protected]> * refactor: dynamically build webpack configs Now we can dynamically build webpack configs by exporting a function instead of the config. This will allow us to check for the 'development' mode at creation and from there we can modify the webpack config that we return. So now if we have `webpack --mode development`, we can recognize we are in development mode and incrementally change our config to our liking. Signed-off-by: Nikolas Komonen <[email protected]> * refactor: webpack/build scripts This commit: - Adds some comments to certain parts of the build process - Fixes our build tasks so that `core` will build all of the required artifacts for `toolkit` will run properly. Before there were cases where running the `Extension (toolkit)` would fail due to a missing `dist/vue` folder - Fixes webviews not reflecting updated code when we refresh the webview during debugging. This was due to the `webview serve` not being utilized correctly. Now if you change `.vue` code and reload the webview the changes should be seen. Signed-off-by: Nikolas Komonen <[email protected]> * refactor: remove vue hot reload This feature doesn't seem to work, or just isn't worth the effort to get working. This removes use of it, but we can always look to add it in if we have a need for it. Signed-off-by: Nikolas Komonen <[email protected]> * fix: post debug task not found We had multiple debug tasks with the same name, so when we tried to run them it didn't know which one to use. Solution: Rename one of them so the names are unique Signed-off-by: Nikolas Komonen <[email protected]> * refactor: webpack web configs + scripts This commit: - Updates the webpack web config to be dynamic, exporting a function which is used to create the config. Previously we exported the final object. - As a result the users of the config had to update to work with this change. - Now we can tweak the config depending on input arguments - Update the tasks in the launch.json to improve the debug mode in VS Code. - Remove the `serve` configs from the main webpack. - We previously used these for hot reloading but since we do not have a use for them anymore we are getting rid of them and simplifying things. Signed-off-by: Nikolas Komonen <[email protected]> * refactor: browser test output unique file Problem: We need to both compile all source code + webpack a web extension when running the Web unit tests so that we do not have type errors + have an executable file (webpacked file) The problem is that the name extensionWeb.js is shared by both the compiled output AND webpacked output. So one gets overwritten. Solution: Change the name of the webpacked output so that it does not get overwritten. Now in unit tests we target that specifically. Signed-off-by: Nikolas Komonen <[email protected]> * refactor: clean up VS Code Debug menu Problem: The VS Code Debug launch menu is cluttered with lots of different launch configs. It is confusing and there are many rarely used configs. Solution: Clean it up and reorder the configs so they are more relevant. Signed-off-by: Nikolas Komonen <[email protected]> * refactor: web mode webpack Before we had a custom flag to not build certain Web mode bundles. But it is instead easier to always build it, but output the bundle with a different name. We did this due to overlapping output files with the same name, but with this new change it does not happen anymore. Signed-off-by: Nikolas Komonen <[email protected]> * upgrade @vscode/test-web module Signed-off-by: Nikolas Komonen <[email protected]> * PR comment fixes: - Update CONTRIBUTING regarding webview dev server - Change the script name for web development compilation Signed-off-by: Nikolas Komonen <[email protected]> --------- Signed-off-by: Nikolas Komonen <[email protected]>
- Loading branch information