[Chore] Revert last commit for testing
This commit is contained in:
parent
da5c2d961b
commit
f513ff65d6
1 changed files with 24 additions and 7 deletions
|
@ -67,7 +67,9 @@ exports.init = (endpoint, { releaseChannel, version }) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
events.emit('downloading-module', {
|
events.emit('downloading-module', {
|
||||||
name: 'host'
|
name: 'host',
|
||||||
|
current: 1,
|
||||||
|
total: 1
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -93,11 +95,15 @@ exports.init = (endpoint, { releaseChannel, version }) => {
|
||||||
checking = false;
|
checking = false;
|
||||||
|
|
||||||
events.emit('downloaded-module', {
|
events.emit('downloaded-module', {
|
||||||
name: 'host'
|
name: 'host',
|
||||||
|
current: 1,
|
||||||
|
total: 1,
|
||||||
|
succeeded: true
|
||||||
});
|
});
|
||||||
|
|
||||||
events.emit('downloading-modules-finished', {
|
events.emit('downloading-modules-finished', {
|
||||||
succeeded: 1
|
succeeded: 1,
|
||||||
|
failed: 0
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -176,7 +182,9 @@ const checkModules = async () => {
|
||||||
const downloadModule = async (name, ver) => {
|
const downloadModule = async (name, ver) => {
|
||||||
downloading.total++;
|
downloading.total++;
|
||||||
events.emit('downloading-module', {
|
events.emit('downloading-module', {
|
||||||
name
|
name,
|
||||||
|
current: downloading.total,
|
||||||
|
total: downloading.total
|
||||||
});
|
});
|
||||||
|
|
||||||
const url = baseUrl + '/' + name + '/' + ver;
|
const url = baseUrl + '/' + name + '/' + ver;
|
||||||
|
@ -186,6 +194,7 @@ const downloadModule = async (name, ver) => {
|
||||||
|
|
||||||
stream.on('progress', ([ cur, total ]) => events.emit('downloading-module-progress', {
|
stream.on('progress', ([ cur, total ]) => events.emit('downloading-module-progress', {
|
||||||
name,
|
name,
|
||||||
|
progress: Math.min(100, Math.floor(100 * (cur / total))),
|
||||||
cur,
|
cur,
|
||||||
total
|
total
|
||||||
}));
|
}));
|
||||||
|
@ -211,7 +220,9 @@ const downloadModule = async (name, ver) => {
|
||||||
else downloading.fail++;
|
else downloading.fail++;
|
||||||
|
|
||||||
events.emit('downloaded-module', {
|
events.emit('downloaded-module', {
|
||||||
name
|
name,
|
||||||
|
current: downloading.total,
|
||||||
|
total: downloading.total
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@ -233,7 +244,9 @@ const downloadModule = async (name, ver) => {
|
||||||
const installModule = async (name, ver, path) => {
|
const installModule = async (name, ver, path) => {
|
||||||
installing.total++;
|
installing.total++;
|
||||||
events.emit('installing-module', {
|
events.emit('installing-module', {
|
||||||
name
|
name,
|
||||||
|
current: installing.total,
|
||||||
|
total: installing.total
|
||||||
});
|
});
|
||||||
|
|
||||||
log('Modules', 'Installing', `${name}@${ver}`, 'from', path);
|
log('Modules', 'Installing', `${name}@${ver}`, 'from', path);
|
||||||
|
@ -286,6 +299,7 @@ const installModule = async (name, ver, path) => {
|
||||||
cur++;
|
cur++;
|
||||||
events.emit('installing-module-progress', {
|
events.emit('installing-module-progress', {
|
||||||
name,
|
name,
|
||||||
|
progress: Math.min(100, Math.floor(cur / total * 100)),
|
||||||
cur,
|
cur,
|
||||||
total
|
total
|
||||||
});
|
});
|
||||||
|
@ -305,7 +319,10 @@ const finishInstall = (name, ver, success) => {
|
||||||
if (!success) installing.fail++;
|
if (!success) installing.fail++;
|
||||||
|
|
||||||
events.emit('installed-module', {
|
events.emit('installed-module', {
|
||||||
name
|
name,
|
||||||
|
current: installing.total,
|
||||||
|
total: installing.total,
|
||||||
|
succeeded: success
|
||||||
});
|
});
|
||||||
|
|
||||||
installing.done++;
|
installing.done++;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue