mirror of
https://github.com/ivabus/gui
synced 2025-04-23 05:57:11 +03:00
handle deleting packages that do not exist more gracefully (#681)
This commit is contained in:
parent
b85c996c15
commit
6f0ece0704
2 changed files with 9 additions and 4 deletions
|
@ -153,9 +153,13 @@ export async function deletePackageFolder(fullName, version) {
|
|||
try {
|
||||
const foldPath = path.join(getTeaPath(), fullName, `v${version}`);
|
||||
log.info("rm:", foldPath);
|
||||
await fs.rmSync(foldPath, { recursive: true });
|
||||
fs.rmSync(foldPath, { recursive: true });
|
||||
} catch (error) {
|
||||
log.error(error);
|
||||
if (error.code === "ENOENT") {
|
||||
log.info(`Attempted to delete non-existent folder: ${fullName} v${version}`);
|
||||
} else {
|
||||
log.error(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -243,8 +243,8 @@ const installPkg = async (pkg: GUIPackage, version?: string) => {
|
|||
await installPackage(pkg, versionToInstall);
|
||||
trackInstall(pkg.full_name);
|
||||
|
||||
// If the package was AVAILABLE previously then it was just installed, otherwise it was updated
|
||||
const state = pkg.state === PackageStates.AVAILABLE ? "INSTALLED" : "UPDATED";
|
||||
// If the package was NEEDS_UPDATE previously then it was updated, otherwise it was just installed
|
||||
const state = pkg.state === PackageStates.NEEDS_UPDATE ? "UPDATED" : "INSTALLED";
|
||||
updatePackage(pkg.full_name, { displayState: { state, version: versionToInstall } });
|
||||
|
||||
await refreshSinglePackage(pkg.full_name);
|
||||
|
@ -275,6 +275,7 @@ const uninstallPkg = async (pkg: GUIPackage) => {
|
|||
await deletePkg(pkg, v);
|
||||
}
|
||||
|
||||
resetPackageDisplayState(pkg);
|
||||
await refreshSinglePackage(pkg.full_name);
|
||||
} catch (error) {
|
||||
log.error(error);
|
||||
|
|
Loading…
Reference in a new issue