Skip to content
Permalink
Browse files

feat(rebuilder): show rebuild progress from the electron-rebuild life…

…cycle
  • Loading branch information
MarshallOfSound authored and malept committed Jan 7, 2017
1 parent 3d26da5 commit 26f23b48e9c051f2a825671f7cd1f90066b2880f
Showing with 20 additions and 1 deletion.
  1. +20 −1 src/util/rebuild.js
@@ -1,3 +1,22 @@
import rebuild from 'electron-rebuild';

export default (buildPath, electronVersion, platform, arch) => rebuild(buildPath, electronVersion, arch);
import asyncOra from '../util/ora-handler';

export default async (buildPath, electronVersion, platform, arch) => {
await asyncOra('Preparing native dependencies', async (rebuildSpinner) => {
const rebuilder = rebuild(buildPath, electronVersion, arch);
const { lifecycle } = rebuilder;

let found = 0;
let done = 0;

const redraw = () => {
rebuildSpinner.text = `Preparing native dependencies: ${done} / ${found}`; // eslint-disable-line
};

lifecycle.on('module-found', () => { found += 1; redraw(); });
lifecycle.on('module-done', () => { done += 1; redraw(); });

await rebuilder;
});
};

0 comments on commit 26f23b4

Please sign in to comment.
You can’t perform that action at this time.