Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ npm-debug.log
yarn-error.log

dist/
release/
27 changes: 11 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
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! Choose your weapon.

```javascript
reactors run web
reactors run desktop
reactors run ios
reactors run android
```

More info about [reactors](https://github.com/co2-git/reactors).
[<img alt="Mac" src="http://clinsite.com/wp-content/uploads/2017/01/Apple-logo-120x120.png" />](https://drive.google.com/open?id=12GdTnRph5DMrAj5b8Kmntykm0lXbOcT-)
[<img alt="Windows" src="https://upload.wikimedia.org/wikipedia/commons/thumb/3/34/Windows_logo_-_2012_derivative.svg/120px-Windows_logo_-_2012_derivative.svg.png" />](http://google.es)
[<img alt="Linux" src="http://www.linuxscrew.com/wp-content/uploads/2007/11/120px-crystal_128_penguin.png" />](https://drive.google.com/open?id=1F5Luv13r9QkX8MDCqUN1NtyPN3FFHKaQ)

# Screenshots

![alt text](https://raw.githubusercontent.com/co2-git/ReactNative/master/assets/screenshots/v0.1.1/Home.png)
13 changes: 8 additions & 5 deletions app/components/Terminal/Console.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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,
},
};
3 changes: 3 additions & 0 deletions app/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
// @flow
import React from 'react';
import ReactDOM from 'react-dom';
import fixPath from 'fix-path';

import App from './App';

fixPath();

const root = document.getElementById('root');

ReactDOM.render(<App />, root);
64 changes: 34 additions & 30 deletions app/lib/exec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down
Binary file added assets/screenshots/v0.1.1/Home.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 10 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,23 @@
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;
}
</style>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/animate.css@3.5.2/animate.min.css"
/>

<section id="root">
<img src="assets/icons/icon.png" />
<div id="splash">
<img src="assets/icons/icon.png" />
</div>
</section>

<script>
Expand Down
6 changes: 2 additions & 4 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,13 @@ let win;

function createWindow() {
// Create the browser window.
win = new BrowserWindow({width: 800, height: 600});
win = new BrowserWindow({width: 600, height: 600});

// and load the index.html of the app.
win.loadURL(`file://${__dirname}/index.html`);

// Open the DevTools.
// if (process.env.NODE_ENV !== 'production') {
// win.webContents.openDevTools();
// }
// win.webContents.openDevTools();

// Emitted when the window is closed.
win.on('closed', () => {
Expand Down
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
{
"name": "ReactNative",
"version": "0.1.0",
"version": "0.1.1",
"scripts": {
"start": "electron main.js",
"babel": "babel --out-dir dist/ app/"
"babel": "babel --out-dir dist/ app/",
"build": "bash scripts/build.sh $npm_package_name $npm_package_version",
"build:osx": "bash scripts/build.sh $npm_package_name $npm_package_version darwin",
"build:linux": "bash scripts/build.sh $npm_package_name $npm_package_version linux",
"build:windows": "bash scripts/build.sh $npm_package_name $npm_package_version win32"
},
"dependencies": {
"babel-polyfill": "^6.26.0",
"fix-path": "^2.1.0",
"lodash": "^4.17.5",
"material-ui": "^0.20.0",
"open": "^0.0.5",
Expand Down
14 changes: 14 additions & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#! /bin/bash
APP_NAME="$1"
APP_VERSION="$2"
PLATFORM=${3:-all}
ELECTRON_VERSION=1.7.0

electron-packager . $APP_NAME \
--electron-version=$ELECTRON_VERSION \
--platform=$PLATFORM \
--version=$ELECTRON_VERSION \
--icon=assets/icons/icon \
--out=release/$APP_VERSION \
--ignore=release
--ignore=assets/screenshots
70 changes: 69 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1203,6 +1203,13 @@ core-util-is@1.0.2, core-util-is@~1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"

cross-spawn@^4.0.0:
version "4.0.2"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-4.0.2.tgz#7b9247621c23adfdd3856004a823cbe397424d41"
dependencies:
lru-cache "^4.0.1"
which "^1.2.9"

cross-spawn@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449"
Expand Down Expand Up @@ -1254,6 +1261,10 @@ deep-is@~0.1.3:
version "0.1.3"
resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34"

default-shell@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/default-shell/-/default-shell-1.0.1.tgz#752304bddc6174f49eb29cb988feea0b8813c8bc"

define-properties@^1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.2.tgz#83a73f2fea569898fb737193c8f873caf6d45c94"
Expand Down Expand Up @@ -1517,6 +1528,18 @@ esutils@^2.0.2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b"

execa@^0.5.0:
version "0.5.1"
resolved "https://registry.yarnpkg.com/execa/-/execa-0.5.1.tgz#de3fb85cb8d6e91c85bcbceb164581785cb57b36"
dependencies:
cross-spawn "^4.0.0"
get-stream "^2.2.0"
is-stream "^1.1.0"
npm-run-path "^2.0.0"
p-finally "^1.0.0"
signal-exit "^3.0.0"
strip-eof "^1.0.0"

expand-brackets@^0.1.4:
version "0.1.5"
resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-0.1.5.tgz#df07284e342a807cd733ac5af72411e581d1177b"
Expand Down Expand Up @@ -1627,6 +1650,12 @@ find-up@^2.0.0, find-up@^2.1.0:
dependencies:
locate-path "^2.0.0"

fix-path@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/fix-path/-/fix-path-2.1.0.tgz#72ece739de9af4bd63fd02da23e9a70c619b4c38"
dependencies:
shell-path "^2.0.0"

flat-cache@^1.2.1:
version "1.3.0"
resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-1.3.0.tgz#d3030b32b38154f4e3b7e9c709f490f7ef97c481"
Expand Down Expand Up @@ -1719,6 +1748,13 @@ gauge@~2.7.3:
strip-ansi "^3.0.1"
wide-align "^1.1.0"

get-stream@^2.2.0:
version "2.3.1"
resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-2.3.1.tgz#5f38f93f346009666ee0150a054167f91bdd95de"
dependencies:
object-assign "^4.0.1"
pinkie-promise "^2.0.0"

getpass@^0.1.1:
version "0.1.7"
resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa"
Expand Down Expand Up @@ -2036,7 +2072,7 @@ is-resolvable@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/is-resolvable/-/is-resolvable-1.1.0.tgz#fb18f87ce1feb925169c9a407c19318a3206ed88"

is-stream@^1.0.1:
is-stream@^1.0.1, is-stream@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44"

Expand Down Expand Up @@ -2364,6 +2400,12 @@ normalize-path@^2.0.0, normalize-path@^2.0.1:
dependencies:
remove-trailing-separator "^1.0.1"

npm-run-path@^2.0.0:
version "2.0.2"
resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f"
dependencies:
path-key "^2.0.0"

npmlog@^4.0.2:
version "4.1.2"
resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b"
Expand Down Expand Up @@ -2446,6 +2488,10 @@ output-file-sync@^1.1.2:
mkdirp "^0.5.1"
object-assign "^4.1.0"

p-finally@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae"

p-limit@^1.1.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.2.0.tgz#0e92b6bedcb59f022c13d0f1949dc82d15909f1c"
Expand Down Expand Up @@ -2495,6 +2541,10 @@ path-is-inside@^1.0.1, path-is-inside@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53"

path-key@^2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40"

path-parse@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1"
Expand Down Expand Up @@ -2916,6 +2966,20 @@ shebang-regex@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3"

shell-env@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/shell-env/-/shell-env-0.3.0.tgz#2250339022989165bda4eb7bf383afeaaa92dc34"
dependencies:
default-shell "^1.0.0"
execa "^0.5.0"
strip-ansi "^3.0.0"

shell-path@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/shell-path/-/shell-path-2.1.0.tgz#ea7d06ae1070874a1bac5c65bb9bdd62e4f67a38"
dependencies:
shell-env "^0.3.0"

signal-exit@^3.0.0, signal-exit@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d"
Expand Down Expand Up @@ -3029,6 +3093,10 @@ strip-bom@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3"

strip-eof@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf"

strip-json-comments@~2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a"
Expand Down