From f71966b6c2a6b6606d5196b5807e70a5c2dcae46 Mon Sep 17 00:00:00 2001 From: co2-git Date: Sat, 14 Apr 2018 14:26:42 +0100 Subject: [PATCH 01/10] Build --- .gitignore | 1 + README.md | 22 +++------- app/components/Terminal/Console.js | 13 +++--- app/lib/exec.js | 64 ++++++++++++++++-------------- index.html | 11 ++++- main.js | 6 +-- package.json | 3 +- scripts/build.sh | 12 ++++++ 8 files changed, 74 insertions(+), 58 deletions(-) create mode 100644 scripts/build.sh diff --git a/.gitignore b/.gitignore index 9b502ce..5bb986e 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ npm-debug.log yarn-error.log dist/ +release/ diff --git a/README.md b/README.md index 91ba614..316abe7 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,10 @@ -ReactNativeRX +ReactNative === -# Run +This is a GUI for running React Native commands. It is built with electron so it works on Linux, Mac and Windows. -```javascript -reactors run web -reactors run desktop -reactors run ios -reactors run android -``` +# Downloads -# Upgrade +[v0.1.1](http://v1.1.1) is out! -```javascript -reactors run web -reactors run desktop -reactors run ios -reactors run android -``` - -More info about [reactors](https://github.com/co2-git/reactors). +# Screenshots diff --git a/app/components/Terminal/Console.js b/app/components/Terminal/Console.js index 42d694d..251f8a4 100644 --- a/app/components/Terminal/Console.js +++ b/app/components/Terminal/Console.js @@ -49,7 +49,10 @@ class Terminal extends PureComponent<$TerminalProps, $TerminalState> { inputHandler(data.message, this.ps); } })); - this.ps.on('error', error => this.setState({error})); + this.ps.on('error', (error) => { + console.log(error.stack); + this.setState({error}); + }); this.ps.on('done', () => this.setState({done: true, code: 0}, () => { if (typeof this.props.onDone === 'function') { this.props.onDone(); @@ -125,13 +128,13 @@ export default Terminal; const styles = { console: { - padding: 10, backgroundColor: '#000', + borderRadius: 8, + boxShadow: '1px 1px 2px 2px rgba(0, 0, 0, 0.25)', color: '#fff', - maxHeight: 300, marginTop: 12, - borderRadius: 8, + maxHeight: 300, overflow: 'auto', - boxShadow: '1px 1px 2px 2px rgba(0, 0, 0, 0.25)', + padding: 10, }, }; diff --git a/app/lib/exec.js b/app/lib/exec.js index 12a3e20..ac691ec 100644 --- a/app/lib/exec.js +++ b/app/lib/exec.js @@ -4,42 +4,46 @@ import Emitter from 'events'; const $spawn = (cmd, options = {}) => { const emitter = new Emitter(); setTimeout(() => { - const [entry, ...bits] = cmd.trim().split(/\s+/); - const ps = spawn(entry, bits, options); - let done = false; - emitter.emit('pid', ps.pid); - ps - .on('error', error => emitter.emit('error', error)) - .on('exit', (status) => { - done = true; - if (status === 0) { - emitter.emit('done'); - } else { - emitter.emit('failed', status); - } - }) - .on('close', (status) => { - if (!done) { + try { + const [entry, ...bits] = cmd.trim().split(/\s+/); + const ps = spawn(entry, bits, options); + let done = false; + emitter.emit('pid', ps.pid); + ps + .on('error', error => emitter.emit('error', error)) + .on('exit', (status) => { done = true; if (status === 0) { emitter.emit('done'); } else { emitter.emit('failed', status); } - } - }); - ps.stdout.on('data', data => emitter.emit('data', { - std: 'out', - buffer: data, - message: data.toString(), - })); - ps.stderr.on('data', data => emitter.emit('data', { - std: 'err', - buffer: data, - message: data.toString(), - })); - emitter.on('write', message => ps.stdin.write(message)); - emitter.on('kill', () => $spawn(`kill -9 ${ps.pid}`)); + }) + .on('close', (status) => { + if (!done) { + done = true; + if (status === 0) { + emitter.emit('done'); + } else { + emitter.emit('failed', status); + } + } + }); + ps.stdout.on('data', data => emitter.emit('data', { + std: 'out', + buffer: data, + message: data.toString(), + })); + ps.stderr.on('data', data => emitter.emit('data', { + std: 'err', + buffer: data, + message: data.toString(), + })); + emitter.on('write', message => ps.stdin.write(message)); + emitter.on('kill', () => $spawn(`kill -9 ${ps.pid}`)); + } catch (error) { + console.log(error.stack); + } }); return emitter; }; diff --git a/index.html b/index.html index 060c096..d1437fe 100644 --- a/index.html +++ b/index.html @@ -8,6 +8,13 @@ font: 12px/1.5em 'Trebuchet MS', Trebuchet, sans-serif; background-color: #eee; } + #splash { + height: 100vh; + width: 100vw; + display: flex; + justify-content: center; + align-items: center; + }
- +
+ +