diff --git a/.changeset/fifty-tigers-hope.md b/.changeset/fifty-tigers-hope.md new file mode 100644 index 0000000..415e158 --- /dev/null +++ b/.changeset/fifty-tigers-hope.md @@ -0,0 +1,5 @@ +--- +"sqlanydb-tools-vscode": patch +--- + +Fixed Webpack configuration to bundle internal dependencies with the .VSIX package diff --git a/README.md b/README.md index c809e3a..929dbcf 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/apps/sqlanydb-tools-vscode/tsconfig.json b/apps/sqlanydb-tools-vscode/tsconfig.json index ba89632..544d46c 100644 --- a/apps/sqlanydb-tools-vscode/tsconfig.json +++ b/apps/sqlanydb-tools-vscode/tsconfig.json @@ -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"] } diff --git a/apps/sqlanydb-tools-vscode/webpack.config.js b/apps/sqlanydb-tools-vscode/webpack.config.js index a562341..7792d14 100644 --- a/apps/sqlanydb-tools-vscode/webpack.config.js +++ b/apps/sqlanydb-tools-vscode/webpack.config.js @@ -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: { diff --git a/package-lock.json b/package-lock.json index 70fdb02..9349b6e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -41,7 +41,7 @@ }, "apps/sqlanydb-manager": { "name": "@sqlanydb-tools/sqlanydb-manager", - "version": "1.2.1", + "version": "1.0.0", "license": "ISC", "dependencies": { "@sqlanydb-tools/sqlanydb-config": "*", @@ -62,7 +62,7 @@ } }, "apps/sqlanydb-tools-vscode": { - "version": "1.0.1", + "version": "1.0.0", "license": "MIT", "dependencies": { "@aws-sdk/client-s3": "^3.665.0", @@ -9896,7 +9896,7 @@ }, "packages/sqlanydb-config": { "name": "@sqlanydb-tools/sqlanydb-config", - "version": "1.2.1", + "version": "1.0.0", "license": "ISC" }, "packages/sqlanydb-database-config": {