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

Webpack config fix #68

Merged
merged 2 commits into from
Oct 23, 2024
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
5 changes: 5 additions & 0 deletions .changeset/fifty-tigers-hope.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"sqlanydb-tools-vscode": patch
---

Fixed Webpack configuration to bundle internal dependencies with the .VSIX package
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ By bundling both command-line utilities and an integrated VSCode experience in a

## VSCode extension

There are 2 ways to install the VSCode extension:
1. Navigate to the `Extensions` tab in VSCode and search for `sqlanydb-tools-vscode`
2. Download the VSIX file from the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=dwarf1er.sqlanydb-tools-vscode)

## sqlanydb-manager CLI

[(Back to top)](#table-of-contents)
Expand Down
7 changes: 5 additions & 2 deletions apps/sqlanydb-tools-vscode/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@
"target": "ES2022",
"lib": ["ES2022"],
"sourceMap": true,
"rootDir": "src",
"rootDir": "../../",
"outDir": "dist",
"strict": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"noUnusedParameters": true
},
"include": ["src/**/*"],
"include": [
"../../apps/**/*",
"../../packages/**/*"
],
"exclude": ["node_modules", "dist"]
}
33 changes: 29 additions & 4 deletions apps/sqlanydb-tools-vscode/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,45 @@
"use strict";

const path = require("path");
const fs = require("fs");

const getInternalPackages = (dir) => {
return fs.readdirSync(dir)
.filter((item) => {
const itemPath = path.join(dir, item);
return fs.statSync(itemPath).isDirectory() && item !== 'sqlanydb-tools-vscode';
})
.map((item) => path.join(dir, item, 'src', 'index.ts'));
};

const packagesDir = path.resolve(__dirname, '../../packages');
const appsDir = path.resolve(__dirname, '../../apps');

//@ts-check
/** @typedef {import('webpack').Configuration} WebpackConfig **/

/** @type WebpackConfig */
const extensionConfig = {
target: "node", // VS Code extensions run in a Node.js-context 📖 -> https://webpack.js.org/configuration/node/
mode: "none", // this leaves the source code as close as possible to the original (when packaging we set this to 'production')
target: "node",
mode: "none",

entry: "./src/extension.ts", // the entry point of this extension, 📖 -> https://webpack.js.org/configuration/entry-context/
entry: {
extension: "./src/extension.ts",
...getInternalPackages(packagesDir).reduce((acc, packageEntry) => {
const packageName = path.basename(path.dirname(packageEntry));
acc[packageName] = packageEntry;
return acc;
}, {}),
...getInternalPackages(appsDir).reduce((acc, appEntry) => {
const appName = path.basename(path.dirname(appEntry));
acc[appName] = appEntry;
return acc;
}, {}),
},
output: {
// the bundle is stored in the 'dist' folder (check package.json), 📖 -> https://webpack.js.org/configuration/output/
path: path.resolve(__dirname, "dist"),
filename: "extension.js",
filename: "[name].js",
libraryTarget: "commonjs2",
},
externals: {
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

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

Loading