@mjcctech/meteor-desktop
Version:
Build a Meteor's desktop client with hot code push.
48 lines (35 loc) • 1.43 kB
JavaScript
;module.export({default:()=>Electron});var regeneratorRuntime;module.link('regenerator-runtime/runtime',{default(v){regeneratorRuntime=v}},0);var spawn;module.link('cross-spawn',{default(v){spawn=v}},1);var Log;module.link('./log',{default(v){Log=v}},2);var defaultDependencies;module.link('./defaultDependencies',{default(v){defaultDependencies=v}},3);
/**
* Simple Electron runner. Runs the project with the bin provided by the 'electron' package.
* @class
*/
class Electron {
constructor($) {
this.log = new Log('electron');
this.$ = $;
}
async init() {
this.electron = await this.$.getDependency('electron', defaultDependencies.electron);
}
run() {
// Until: https://github.com/electron-userland/electron-prebuilt/pull/118
const { env } = process;
env.ELECTRON_ENV = 'development';
const cmd = [];
if (this.$.env.options.debug) {
cmd.push('--debug=5858');
}
cmd.push('.');
const child = spawn(this.electron.dependency, cmd, {
cwd: this.$.env.paths.electronApp.root,
env
});
// TODO: check if we can configure piping in spawn options
child.stdout.on('data', (chunk) => {
process.stdout.write(chunk);
});
child.stderr.on('data', (chunk) => {
process.stderr.write(chunk);
});
}
}