refactor utils to child process files
This commit is contained in:
parent
18f1c67e20
commit
9fae1a2f05
|
@ -52,7 +52,7 @@
|
|||
"@aws-sdk/credential-providers": "^3.778.0",
|
||||
"@continuedev/config-types": "^1.0.13",
|
||||
"@continuedev/config-yaml": "file:../packages/config-yaml",
|
||||
"@continuedev/fetch": "^1.0.10",
|
||||
"@continuedev/fetch": "^1.0.13",
|
||||
"@continuedev/llm-info": "^1.0.8",
|
||||
"@continuedev/openai-adapters": "^1.0.25",
|
||||
"@modelcontextprotocol/sdk": "^1.12.0",
|
||||
|
@ -144,7 +144,8 @@
|
|||
"onnxruntime-common": "1.14.0",
|
||||
"onnxruntime-web": "1.14.0",
|
||||
"ts-jest": "^29.1.1",
|
||||
"typescript": "^5.6.3"
|
||||
"typescript": "^5.6.3",
|
||||
"vitest": "^3.1.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20.19.0"
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "continue",
|
||||
"version": "1.1.41",
|
||||
"version": "1.1.44",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "continue",
|
||||
"version": "1.1.41",
|
||||
"version": "1.1.44",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@continuedev/config-types": "^1.0.14",
|
||||
|
@ -107,7 +107,7 @@
|
|||
"@aws-sdk/credential-providers": "^3.778.0",
|
||||
"@continuedev/config-types": "^1.0.13",
|
||||
"@continuedev/config-yaml": "file:../packages/config-yaml",
|
||||
"@continuedev/fetch": "^1.0.10",
|
||||
"@continuedev/fetch": "^1.0.13",
|
||||
"@continuedev/llm-info": "^1.0.8",
|
||||
"@continuedev/openai-adapters": "^1.0.25",
|
||||
"@modelcontextprotocol/sdk": "^1.12.0",
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* @file Generate config.yaml file from template. Intended to run as a child process.
|
||||
*/
|
||||
|
||||
const { fork } = require("child_process");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
|
@ -81,3 +82,45 @@ process.on("message", (msg) => {
|
|||
});
|
||||
}
|
||||
});
|
||||
|
||||
async function generateAndCopyConfigYamlSchema() {
|
||||
// Generate and copy over config-yaml-schema.json
|
||||
const generateConfigYamlChild = fork(
|
||||
path.join(__dirname, "generate-copy-config.js"),
|
||||
{
|
||||
stdio: "inherit",
|
||||
},
|
||||
);
|
||||
generateConfigYamlChild.send({ payload: { operation: "generate" } });
|
||||
|
||||
await new Promise((resolve, reject) => {
|
||||
generateConfigYamlChild.on("message", (msg) => {
|
||||
if (msg.error) {
|
||||
reject();
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
|
||||
// Copy config schemas to intellij
|
||||
const copyConfigSchemaChild = fork(
|
||||
path.join(__dirname, "generate-copy-config.js"),
|
||||
{
|
||||
stdio: "inherit",
|
||||
},
|
||||
);
|
||||
copyConfigSchemaChild.send({ payload: { operation: "copy" } });
|
||||
|
||||
await new Promise((resolve, reject) => {
|
||||
copyConfigSchemaChild.on("message", (msg) => {
|
||||
if (msg.error) {
|
||||
reject();
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
generateAndCopyConfigYamlSchema,
|
||||
};
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* @file Install node modules for the VS Code extension. This is intended to run as a child process.
|
||||
*/
|
||||
|
||||
const { fork } = require("child_process");
|
||||
const path = require("path");
|
||||
|
||||
const { execCmdSync } = require("../../../scripts/util");
|
||||
|
@ -38,3 +39,44 @@ process.on("message", (msg) => {
|
|||
});
|
||||
}
|
||||
});
|
||||
|
||||
async function installNodeModules() {
|
||||
const installVscodeChild = fork(
|
||||
path.join(__dirname, "install-nodemodules.js"),
|
||||
{
|
||||
stdio: "inherit",
|
||||
},
|
||||
);
|
||||
installVscodeChild.send({ payload: { targetDir: "vscode" } });
|
||||
|
||||
const installGuiChild = fork(path.join(__dirname, "install-nodemodules.js"), {
|
||||
stdio: "inherit",
|
||||
});
|
||||
installGuiChild.send({ payload: { targetDir: "gui" } });
|
||||
|
||||
await Promise.all([
|
||||
new Promise((resolve, reject) => {
|
||||
installVscodeChild.on("message", (msg) => {
|
||||
if (msg.error) {
|
||||
reject();
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
}),
|
||||
new Promise((resolve, reject) => {
|
||||
installGuiChild.on("message", (msg) => {
|
||||
if (msg.error) {
|
||||
reject();
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
}),
|
||||
]).catch((error) => {
|
||||
console.error(error);
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
installNodeModules,
|
||||
};
|
||||
|
|
|
@ -11,13 +11,10 @@ const {
|
|||
autodetectPlatformAndArch,
|
||||
} = require("../../../scripts/util/index");
|
||||
|
||||
const { generateAndCopyConfigYamlSchema } = require("./generate-copy-config");
|
||||
const { copySqlite, copyEsbuild } = require("./install-copy-sqlite-esbuild");
|
||||
const {
|
||||
writeBuildTimestamp,
|
||||
installNodeModules,
|
||||
continueDir,
|
||||
generateAndCopyConfigYamlSchema,
|
||||
} = require("./utils");
|
||||
const { installNodeModules } = require("./install-nodemodules");
|
||||
const { writeBuildTimestamp, continueDir } = require("./utils");
|
||||
|
||||
// Clear folders that will be packaged to ensure clean slate
|
||||
rimrafSync(path.join(__dirname, "..", "bin"));
|
||||
|
|
|
@ -1,56 +1,13 @@
|
|||
const { fork } = require("child_process");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
const ncp = require("ncp").ncp;
|
||||
const { rimrafSync } = require("rimraf");
|
||||
|
||||
const {
|
||||
validateFilesPresent,
|
||||
execCmdSync,
|
||||
autodetectPlatformAndArch,
|
||||
} = require("../../../scripts/util/index");
|
||||
const { execCmdSync } = require("../../../scripts/util/index");
|
||||
|
||||
const continueDir = path.join(__dirname, "..", "..", "..");
|
||||
|
||||
async function generateAndCopyConfigYamlSchema() {
|
||||
// Generate and copy over config-yaml-schema.json
|
||||
const generateConfigYamlChild = fork(
|
||||
path.join(__dirname, "generate-copy-config.js"),
|
||||
{
|
||||
stdio: "inherit",
|
||||
},
|
||||
);
|
||||
generateConfigYamlChild.send({ payload: { operation: "generate" } });
|
||||
|
||||
await new Promise((resolve, reject) => {
|
||||
generateConfigYamlChild.on("message", (msg) => {
|
||||
if (msg.error) {
|
||||
reject();
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
|
||||
// Copy config schemas to intellij
|
||||
const copyConfigSchemaChild = fork(
|
||||
path.join(__dirname, "generate-copy-config.js"),
|
||||
{
|
||||
stdio: "inherit",
|
||||
},
|
||||
);
|
||||
copyConfigSchemaChild.send({ payload: { operation: "copy" } });
|
||||
|
||||
await new Promise((resolve, reject) => {
|
||||
copyConfigSchemaChild.on("message", (msg) => {
|
||||
if (msg.error) {
|
||||
reject();
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function copyTokenizers() {
|
||||
fs.copyFileSync(
|
||||
path.join(__dirname, "../../../core/llm/llamaTokenizerWorkerPool.mjs"),
|
||||
|
@ -65,43 +22,6 @@ function copyTokenizers() {
|
|||
console.log("[info] Copied llamaTokenizer");
|
||||
}
|
||||
|
||||
async function installNodeModules() {
|
||||
const installVscodeChild = fork(
|
||||
path.join(__dirname, "install-nodemodules.js"),
|
||||
{
|
||||
stdio: "inherit",
|
||||
},
|
||||
);
|
||||
installVscodeChild.send({ payload: { targetDir: "vscode" } });
|
||||
|
||||
const installGuiChild = fork(path.join(__dirname, "install-nodemodules.js"), {
|
||||
stdio: "inherit",
|
||||
});
|
||||
installGuiChild.send({ payload: { targetDir: "gui" } });
|
||||
|
||||
await Promise.all([
|
||||
new Promise((resolve, reject) => {
|
||||
installVscodeChild.on("message", (msg) => {
|
||||
if (msg.error) {
|
||||
reject();
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
}),
|
||||
new Promise((resolve, reject) => {
|
||||
installGuiChild.on("message", (msg) => {
|
||||
if (msg.error) {
|
||||
reject();
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
}),
|
||||
]).catch((error) => {
|
||||
console.error(error);
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
|
||||
async function buildGui(isGhAction) {
|
||||
// Make sure we are in the right directory
|
||||
if (!process.cwd().endsWith("gui")) {
|
||||
|
@ -552,8 +472,6 @@ function writeBuildTimestamp() {
|
|||
|
||||
module.exports = {
|
||||
continueDir,
|
||||
generateAndCopyConfigYamlSchema,
|
||||
installNodeModules,
|
||||
buildGui,
|
||||
copyOnnxRuntimeFromNodeModules,
|
||||
copyTreeSitterWasms,
|
||||
|
|
|
@ -111,7 +111,7 @@
|
|||
"@aws-sdk/credential-providers": "^3.778.0",
|
||||
"@continuedev/config-types": "^1.0.13",
|
||||
"@continuedev/config-yaml": "file:../packages/config-yaml",
|
||||
"@continuedev/fetch": "^1.0.10",
|
||||
"@continuedev/fetch": "^1.0.13",
|
||||
"@continuedev/llm-info": "^1.0.8",
|
||||
"@continuedev/openai-adapters": "^1.0.25",
|
||||
"@modelcontextprotocol/sdk": "^1.12.0",
|
||||
|
|
Loading…
Reference in New Issue