chore: Add cleanup for existing Merico workflow directory

- Add safety check to remove existing workflow directory if present
- Ensure clean installation by removing old files before copying
- Prevent potential conflicts during version updates
This commit is contained in:
bobo.yang 2024-12-18 10:43:07 +08:00
parent 6ac60e7b31
commit cf4193c352

View File

@ -219,6 +219,9 @@ export function registerInstallCommandsCommand(
let copiedDirectory = false;
if (!fs.existsSync(sysMericoDirPath) || (updatePublicWorkflow === false && currentVersion !== previousVersion)) {
logger.channel()?.debug("Creating directory: " + sysMericoDirPath);
if (fs.existsSync(sysMericoDirPath)) {
fs.rmSync(sysMericoDirPath, { recursive: true, force: true });
}
await copyDirectory(pluginDirPath, sysDirPath);
copiedDirectory = true;
}