Changesets · Branches · Tags · Compare
| Changeset | e8214ab5fa65ef8d8c20e74bba4a3eef1971d00e0630beab6170532602fe2b0c |
|---|---|
| Author | uinstinct <61635505+uinstinct@users.noreply.github.com> · 2025-06-06 23:08 +05:30 |
| Committer | uinstinct <61635505+uinstinct@users.noreply.github.com> · 2025-06-06 23:17 +05:30 |
| Parents | 7a689334a7f0 |
4 files changed
modified extensions/vscode/scripts/generate-copy-config.js +1 −1
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | /** |
| 2 | - * @file Generate config.yaml file from template. Intended to run as a child process. | |
| 2 | + * @file Generate config.yaml file from template. Also intended to run as a child process. | |
| 3 | 3 | */ |
| 4 | 4 | |
| 5 | 5 | const { fork } = require("child_process"); |
deleted extensions/vscode/scripts/install-nodemodules.js +0 −82
| @@ -1,82 +0,0 @@ | ||
| 1 | -/** | |
| 2 | - * @file Install node modules for the VS Code extension. This is intended to run as a child process. | |
| 3 | - */ | |
| 4 | - | |
| 5 | -const { fork } = require("child_process"); | |
| 6 | -const path = require("path"); | |
| 7 | - | |
| 8 | -const { execCmdSync } = require("../../../scripts/util"); | |
| 9 | - | |
| 10 | -const { continueDir } = require("./utils"); | |
| 11 | - | |
| 12 | -async function installNodeModulesInGui() { | |
| 13 | - process.chdir(path.join(continueDir, "gui")); | |
| 14 | - execCmdSync("npm install"); | |
| 15 | - console.log("[info] npm install in gui completed"); | |
| 16 | -} | |
| 17 | - | |
| 18 | -async function installNodeModulesInVscode() { | |
| 19 | - process.chdir(path.join(continueDir, "extensions", "vscode")); | |
| 20 | - execCmdSync("npm install"); | |
| 21 | - console.log("[info] npm install in extensions/vscode completed"); | |
| 22 | -} | |
| 23 | - | |
| 24 | -process.on("message", (msg) => { | |
| 25 | - const { targetDir } = msg.payload; | |
| 26 | - if (targetDir === "gui") { | |
| 27 | - installNodeModulesInGui() | |
| 28 | - .then(() => process.send({ done: true })) | |
| 29 | - .catch((error) => { | |
| 30 | - console.error(error); // show the error in the parent process | |
| 31 | - process.send({ error: true }); | |
| 32 | - }); | |
| 33 | - } else if (targetDir === "vscode") { | |
| 34 | - installNodeModulesInVscode() | |
| 35 | - .then(() => process.send({ done: true })) | |
| 36 | - .catch((error) => { | |
| 37 | - console.error(error); // show the error in the parent process | |
| 38 | - process.send({ error: true }); | |
| 39 | - }); | |
| 40 | - } | |
| 41 | -}); | |
| 42 | - | |
| 43 | -async function installNodeModules() { | |
| 44 | - const installVscodeChild = fork( | |
| 45 | - path.join(__dirname, "install-nodemodules.js"), | |
| 46 | - { | |
| 47 | - stdio: "inherit", | |
| 48 | - }, | |
| 49 | - ); | |
| 50 | - installVscodeChild.send({ payload: { targetDir: "vscode" } }); | |
| 51 | - | |
| 52 | - const installGuiChild = fork(path.join(__dirname, "install-nodemodules.js"), { | |
| 53 | - stdio: "inherit", | |
| 54 | - }); | |
| 55 | - installGuiChild.send({ payload: { targetDir: "gui" } }); | |
| 56 | - | |
| 57 | - await Promise.all([ | |
| 58 | - new Promise((resolve, reject) => { | |
| 59 | - installVscodeChild.on("message", (msg) => { | |
| 60 | - if (msg.error) { | |
| 61 | - reject(); | |
| 62 | - } | |
| 63 | - resolve(); | |
| 64 | - }); | |
| 65 | - }), | |
| 66 | - new Promise((resolve, reject) => { | |
| 67 | - installGuiChild.on("message", (msg) => { | |
| 68 | - if (msg.error) { | |
| 69 | - reject(); | |
| 70 | - } | |
| 71 | - resolve(); | |
| 72 | - }); | |
| 73 | - }), | |
| 74 | - ]).catch((error) => { | |
| 75 | - console.error(error); | |
| 76 | - process.exit(1); | |
| 77 | - }); | |
| 78 | -} | |
| 79 | - | |
| 80 | -module.exports = { | |
| 81 | - installNodeModules, | |
| 82 | -}; |
added extensions/vscode/scripts/npm-install.js +79 −0
| @@ -0,0 +1,79 @@ | ||
| 1 | +/** | |
| 2 | + * @file Install node modules for the VS Code extension and gui. This is also intended to run as a child process. | |
| 3 | + */ | |
| 4 | + | |
| 5 | +const { fork } = require("child_process"); | |
| 6 | +const path = require("path"); | |
| 7 | + | |
| 8 | +const { execCmdSync } = require("../../../scripts/util"); | |
| 9 | + | |
| 10 | +const { continueDir } = require("./utils"); | |
| 11 | + | |
| 12 | +async function installNodeModulesInGui() { | |
| 13 | + process.chdir(path.join(continueDir, "gui")); | |
| 14 | + execCmdSync("npm install"); | |
| 15 | + console.log("[info] npm install in gui completed"); | |
| 16 | +} | |
| 17 | + | |
| 18 | +async function installNodeModulesInVscode() { | |
| 19 | + process.chdir(path.join(continueDir, "extensions", "vscode")); | |
| 20 | + execCmdSync("npm install"); | |
| 21 | + console.log("[info] npm install in extensions/vscode completed"); | |
| 22 | +} | |
| 23 | + | |
| 24 | +process.on("message", (msg) => { | |
| 25 | + const { targetDir } = msg.payload; | |
| 26 | + if (targetDir === "gui") { | |
| 27 | + installNodeModulesInGui() | |
| 28 | + .then(() => process.send({ done: true })) | |
| 29 | + .catch((error) => { | |
| 30 | + console.error(error); // show the error in the parent process | |
| 31 | + process.send({ error: true }); | |
| 32 | + }); | |
| 33 | + } else if (targetDir === "vscode") { | |
| 34 | + installNodeModulesInVscode() | |
| 35 | + .then(() => process.send({ done: true })) | |
| 36 | + .catch((error) => { | |
| 37 | + console.error(error); // show the error in the parent process | |
| 38 | + process.send({ error: true }); | |
| 39 | + }); | |
| 40 | + } | |
| 41 | +}); | |
| 42 | + | |
| 43 | +async function npmInstall() { | |
| 44 | + const installVscodeChild = fork(__filename, { | |
| 45 | + stdio: "inherit", | |
| 46 | + }); | |
| 47 | + installVscodeChild.send({ payload: { targetDir: "vscode" } }); | |
| 48 | + | |
| 49 | + const installGuiChild = fork(__filename, { | |
| 50 | + stdio: "inherit", | |
| 51 | + }); | |
| 52 | + installGuiChild.send({ payload: { targetDir: "gui" } }); | |
| 53 | + | |
| 54 | + await Promise.all([ | |
| 55 | + new Promise((resolve, reject) => { | |
| 56 | + installVscodeChild.on("message", (msg) => { | |
| 57 | + if (msg.error) { | |
| 58 | + reject(); | |
| 59 | + } | |
| 60 | + resolve(); | |
| 61 | + }); | |
| 62 | + }), | |
| 63 | + new Promise((resolve, reject) => { | |
| 64 | + installGuiChild.on("message", (msg) => { | |
| 65 | + if (msg.error) { | |
| 66 | + reject(); | |
| 67 | + } | |
| 68 | + resolve(); | |
| 69 | + }); | |
| 70 | + }), | |
| 71 | + ]).catch((error) => { | |
| 72 | + console.error(error); | |
| 73 | + process.exit(1); | |
| 74 | + }); | |
| 75 | +} | |
| 76 | + | |
| 77 | +module.exports = { | |
| 78 | + npmInstall, | |
| 79 | +}; |
modified extensions/vscode/scripts/prepackage.js +2 −2
| @@ -13,7 +13,7 @@ | ||
| 13 | 13 | const { copySqlite, copyEsbuild } = require("./download-copy-sqlite-esbuild"); |
| 14 | 14 | const { generateAndCopyConfigYamlSchema } = require("./generate-copy-config"); |
| 15 | 15 | const { installAndCopyNodeModules } = require("./install-copy-nodemodule"); |
| 16 | -const { installNodeModules } = require("./install-nodemodules"); | |
| 16 | +const { npmInstall } = require("./npm-install"); | |
| 17 | 17 | const { writeBuildTimestamp, continueDir } = require("./utils"); |
| 18 | 18 | |
| 19 | 19 | // Clear folders that will be packaged to ensure clean slate |
| @@ -70,7 +70,7 @@ | ||
| 70 | 70 | // Make sure we have an initial timestamp file |
| 71 | 71 | writeBuildTimestamp(); |
| 72 | 72 | |
| 73 | - await Promise.all([generateAndCopyConfigYamlSchema(), installNodeModules()]); | |
| 73 | + await Promise.all([generateAndCopyConfigYamlSchema(), npmInstall()]); | |
| 74 | 74 | |
| 75 | 75 | process.chdir(path.join(continueDir, "gui")); |
| 76 | 76 |