[Updater > Module] Further minor source cleanup
This commit is contained in:
parent
babf473559
commit
471084c7ec
1 changed files with 4 additions and 7 deletions
|
@ -258,8 +258,6 @@ const downloadModule = async (name, ver) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const installModule = (name, ver, path) => {
|
const installModule = (name, ver, path) => {
|
||||||
const currentVer = installed[name]?.installedVersion;
|
|
||||||
|
|
||||||
installing.total++;
|
installing.total++;
|
||||||
events.emit('installing-module', {
|
events.emit('installing-module', {
|
||||||
name,
|
name,
|
||||||
|
@ -269,7 +267,7 @@ const installModule = (name, ver, path) => {
|
||||||
|
|
||||||
log('Modules', 'Installing', `${name}@${ver}`, 'from', path);
|
log('Modules', 'Installing', `${name}@${ver}`, 'from', path);
|
||||||
|
|
||||||
let success = true, hasError = false;
|
let hasError;
|
||||||
|
|
||||||
const handleErr = (e) => {
|
const handleErr = (e) => {
|
||||||
if (hasError) return;
|
if (hasError) return;
|
||||||
|
@ -277,8 +275,7 @@ const installModule = (name, ver, path) => {
|
||||||
|
|
||||||
log('Modules', 'Failed install', `${name}@${ver}`, e);
|
log('Modules', 'Failed install', `${name}@${ver}`, e);
|
||||||
|
|
||||||
success = false;
|
finishInstall(name, ver, false);
|
||||||
finishInstall(name, ver, success);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -303,12 +300,12 @@ const installModule = (name, ver, path) => {
|
||||||
zip.on('error', handleErr);
|
zip.on('error', handleErr);
|
||||||
|
|
||||||
zip.on('end', () => {
|
zip.on('end', () => {
|
||||||
if (!success) return;
|
if (hasError) return;
|
||||||
|
|
||||||
installed[name].installedVersion = ver;
|
installed[name].installedVersion = ver;
|
||||||
commitManifest();
|
commitManifest();
|
||||||
|
|
||||||
finishInstall(name, ver, success);
|
finishInstall(name, ver, true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
Loading…
Reference in a new issue