Skip to content

Commit cea041d

Browse files
authored
Merge pull request #1 from co2-git/v0.1.1
V0.1.1
2 parents fd27c31 + f09467d commit cea041d

File tree

11 files changed

+159
-59
lines changed

11 files changed

+159
-59
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ npm-debug.log
99
yarn-error.log
1010

1111
dist/
12+
release/

README.md

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,17 @@
1-
ReactNativeRX
1+
ReactNative
22
===
33

4-
# Run
4+
This is a GUI for running React Native commands. It is built with electron so it works on Linux, Mac and Windows.
55

6-
```javascript
7-
reactors run web
8-
reactors run desktop
9-
reactors run ios
10-
reactors run android
11-
```
6+
# Downloads
127

13-
# Upgrade
8+
[v0.1.1](http://v1.1.1) is out! Choose your weapon.
149

15-
```javascript
16-
reactors run web
17-
reactors run desktop
18-
reactors run ios
19-
reactors run android
20-
```
2110

22-
More info about [reactors](https://github.com/co2-git/reactors).
11+
[<img alt="Mac" src="http://clinsite.com/wp-content/uploads/2017/01/Apple-logo-120x120.png" />](https://drive.google.com/open?id=12GdTnRph5DMrAj5b8Kmntykm0lXbOcT-)
12+
[<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)
13+
[<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)
14+
15+
# Screenshots
16+
17+
![alt text](https://raw.githubusercontent.com/co2-git/ReactNative/master/assets/screenshots/v0.1.1/Home.png)

app/components/Terminal/Console.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ class Terminal extends PureComponent<$TerminalProps, $TerminalState> {
4949
inputHandler(data.message, this.ps);
5050
}
5151
}));
52-
this.ps.on('error', error => this.setState({error}));
52+
this.ps.on('error', (error) => {
53+
console.log(error.stack);
54+
this.setState({error});
55+
});
5356
this.ps.on('done', () => this.setState({done: true, code: 0}, () => {
5457
if (typeof this.props.onDone === 'function') {
5558
this.props.onDone();
@@ -125,13 +128,13 @@ export default Terminal;
125128

126129
const styles = {
127130
console: {
128-
padding: 10,
129131
backgroundColor: '#000',
132+
borderRadius: 8,
133+
boxShadow: '1px 1px 2px 2px rgba(0, 0, 0, 0.25)',
130134
color: '#fff',
131-
maxHeight: 300,
132135
marginTop: 12,
133-
borderRadius: 8,
136+
maxHeight: 300,
134137
overflow: 'auto',
135-
boxShadow: '1px 1px 2px 2px rgba(0, 0, 0, 0.25)',
138+
padding: 10,
136139
},
137140
};

app/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
// @flow
22
import React from 'react';
33
import ReactDOM from 'react-dom';
4+
import fixPath from 'fix-path';
45

56
import App from './App';
67

8+
fixPath();
9+
710
const root = document.getElementById('root');
811

912
ReactDOM.render(<App />, root);

app/lib/exec.js

Lines changed: 34 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,42 +4,46 @@ import Emitter from 'events';
44
const $spawn = (cmd, options = {}) => {
55
const emitter = new Emitter();
66
setTimeout(() => {
7-
const [entry, ...bits] = cmd.trim().split(/\s+/);
8-
const ps = spawn(entry, bits, options);
9-
let done = false;
10-
emitter.emit('pid', ps.pid);
11-
ps
12-
.on('error', error => emitter.emit('error', error))
13-
.on('exit', (status) => {
14-
done = true;
15-
if (status === 0) {
16-
emitter.emit('done');
17-
} else {
18-
emitter.emit('failed', status);
19-
}
20-
})
21-
.on('close', (status) => {
22-
if (!done) {
7+
try {
8+
const [entry, ...bits] = cmd.trim().split(/\s+/);
9+
const ps = spawn(entry, bits, options);
10+
let done = false;
11+
emitter.emit('pid', ps.pid);
12+
ps
13+
.on('error', error => emitter.emit('error', error))
14+
.on('exit', (status) => {
2315
done = true;
2416
if (status === 0) {
2517
emitter.emit('done');
2618
} else {
2719
emitter.emit('failed', status);
2820
}
29-
}
30-
});
31-
ps.stdout.on('data', data => emitter.emit('data', {
32-
std: 'out',
33-
buffer: data,
34-
message: data.toString(),
35-
}));
36-
ps.stderr.on('data', data => emitter.emit('data', {
37-
std: 'err',
38-
buffer: data,
39-
message: data.toString(),
40-
}));
41-
emitter.on('write', message => ps.stdin.write(message));
42-
emitter.on('kill', () => $spawn(`kill -9 ${ps.pid}`));
21+
})
22+
.on('close', (status) => {
23+
if (!done) {
24+
done = true;
25+
if (status === 0) {
26+
emitter.emit('done');
27+
} else {
28+
emitter.emit('failed', status);
29+
}
30+
}
31+
});
32+
ps.stdout.on('data', data => emitter.emit('data', {
33+
std: 'out',
34+
buffer: data,
35+
message: data.toString(),
36+
}));
37+
ps.stderr.on('data', data => emitter.emit('data', {
38+
std: 'err',
39+
buffer: data,
40+
message: data.toString(),
41+
}));
42+
emitter.on('write', message => ps.stdin.write(message));
43+
emitter.on('kill', () => $spawn(`kill -9 ${ps.pid}`));
44+
} catch (error) {
45+
console.log(error.stack);
46+
}
4347
});
4448
return emitter;
4549
};

assets/screenshots/v0.1.1/Home.png

95.1 KB
Loading

index.html

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,23 @@
88
font: 12px/1.5em 'Trebuchet MS', Trebuchet, sans-serif;
99
background-color: #eee;
1010
}
11+
#splash {
12+
height: 100vh;
13+
width: 100vw;
14+
display: flex;
15+
justify-content: center;
16+
align-items: center;
17+
}
1118
</style>
1219
<link
1320
rel="stylesheet"
1421
href="https://cdn.jsdelivr.net/npm/animate.css@3.5.2/animate.min.css"
1522
/>
1623

1724
<section id="root">
18-
<img src="assets/icons/icon.png" />
25+
<div id="splash">
26+
<img src="assets/icons/icon.png" />
27+
</div>
1928
</section>
2029

2130
<script>

main.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,13 @@ let win;
1010

1111
function createWindow() {
1212
// Create the browser window.
13-
win = new BrowserWindow({width: 800, height: 600});
13+
win = new BrowserWindow({width: 600, height: 600});
1414

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

1818
// Open the DevTools.
19-
// if (process.env.NODE_ENV !== 'production') {
20-
// win.webContents.openDevTools();
21-
// }
19+
// win.webContents.openDevTools();
2220

2321
// Emitted when the window is closed.
2422
win.on('closed', () => {

package.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
{
22
"name": "ReactNative",
3-
"version": "0.1.0",
3+
"version": "0.1.1",
44
"scripts": {
55
"start": "electron main.js",
6-
"babel": "babel --out-dir dist/ app/"
6+
"babel": "babel --out-dir dist/ app/",
7+
"build": "bash scripts/build.sh $npm_package_name $npm_package_version",
8+
"build:osx": "bash scripts/build.sh $npm_package_name $npm_package_version darwin",
9+
"build:linux": "bash scripts/build.sh $npm_package_name $npm_package_version linux",
10+
"build:windows": "bash scripts/build.sh $npm_package_name $npm_package_version win32"
711
},
812
"dependencies": {
913
"babel-polyfill": "^6.26.0",
14+
"fix-path": "^2.1.0",
1015
"lodash": "^4.17.5",
1116
"material-ui": "^0.20.0",
1217
"open": "^0.0.5",

scripts/build.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#! /bin/bash
2+
APP_NAME="$1"
3+
APP_VERSION="$2"
4+
PLATFORM=${3:-all}
5+
ELECTRON_VERSION=1.7.0
6+
7+
electron-packager . $APP_NAME \
8+
--electron-version=$ELECTRON_VERSION \
9+
--platform=$PLATFORM \
10+
--version=$ELECTRON_VERSION \
11+
--icon=assets/icons/icon \
12+
--out=release/$APP_VERSION \
13+
--ignore=release
14+
--ignore=assets/screenshots

0 commit comments

Comments
 (0)