continue-custom/scripts/util/index.js
Nate Sesti 53b61288ec
🎨 Refactor core (#1281)
* 🎨 refactor out react context

* 🎨 refactor local storage

* 🎨 refactor IdeMessenger

* 🔥 removing unused files

* 🚚 move scripts

* ✅ setup VSCode integration testing

* 🎨 fix test-related stuff

* 🚧 testing

* 🎨 tweak terminal cmd+L

* 🧑‍💻 install biome in core

* 🎨 run biome check on core

* 🎨 run biome check in vscode

* 🎨 run biome check in binary

* 🧑‍💻 global biome config

* 🎨 run biome check on core

* 🎨 run biome check in vscode

* 🎨 fix a few biome warnings

* 🚧 WIP on protocols

* 🚧 progress, organizing, about to remove webviewCore protocol

* 🚧 now running

* 🚧 move indexing code to core

* 🚧 WIP on JetBrains indexing implementation

* 🎨 finish listDir

* 🚧 gui fixes

* 🏷️ update IMessenger.on return type

* 🐛 fix jetbrains types + IDE detection

* 🧑‍💻 set up debugging for binary with TcpMessenger

* 👷 fix prepackage.js

* 🧑‍💻 turn off debug mode for intellij

* 🐛 merge fixes

* 🐛 fixes after refactor

* 🐛 merge fixes

* 💄 increase font size in JB

* 🔀 merge changes

* 🩹 small fixes

* 🐛 fix jetbrains build

* 🩹 more jetbrains fixes

* 🎨 jetbrains improvements

* 🐛 fix lancedb prob in jetbrains build

* 👷 update jetbrains build process

* ✨ intellij problems context provider

* 👷 add script utils file

* 💚 fix jetbrains build regression

* 🎨 dynamic import transformers.js

* 🩹 small jetbrains updates

* ✨ folder context provider in jetbrains

* 🎨 many more jetbrains improvements

* 🔀 merge fixes

* ⚡️ small improvements

* 🎨 tell users transformers.js not supported

* 🎨 trial updates

* 📝 update jetbrains readmej

* ⚡️ only use smaller context for local autocomplete models

* ⚡️ improve bracket filter

* ✨ global .continue/.prompts folder

* 💄 improved model setup process

* 🥅 display VSCode req errs
2024-05-24 19:38:13 -07:00

68 lines
2 KiB
JavaScript

const fs = require("fs");
const { execSync } = require("child_process");
function execCmdSync(cmd) {
try {
execSync(cmd);
} catch (err) {
console.error(`Error executing command '${cmd}': `, err.output.toString());
process.exit(1);
}
}
function validateFilesPresent(pathsToVerify) {
// This script verifies after pacakging that necessary files are in the correct locations
// In many cases just taking a sample file from the folder when they are all roughly the same thing
let missingFiles = [];
for (const path of pathsToVerify) {
if (!fs.existsSync(path)) {
const parentFolder = path.split("/").slice(0, -1).join("/");
const grandparentFolder = path.split("/").slice(0, -2).join("/");
const grandGrandparentFolder = path.split("/").slice(0, -3).join("/");
console.error(`File ${path} does not exist`);
if (!fs.existsSync(parentFolder)) {
console.error(`Parent folder ${parentFolder} does not exist`);
} else {
console.error(
"Contents of parent folder:",
fs.readdirSync(parentFolder),
);
}
if (!fs.existsSync(grandparentFolder)) {
console.error(`Grandparent folder ${grandparentFolder} does not exist`);
if (!fs.existsSync(grandGrandparentFolder)) {
console.error(
`Grandgrandparent folder ${grandGrandparentFolder} does not exist`,
);
} else {
console.error(
"Contents of grandgrandparent folder:",
fs.readdirSync(grandGrandparentFolder),
);
}
} else {
console.error(
"Contents of grandparent folder:",
fs.readdirSync(grandparentFolder),
);
}
missingFiles.push(path);
}
}
if (missingFiles.length > 0) {
throw new Error(
`The following files were missing:\n- ${missingFiles.join("\n- ")}`,
);
} else {
console.log("All paths exist");
}
}
module.exports = {
execCmdSync,
validateFilesPresent,
};