Skip to content
This repository was archived by the owner on Sep 2, 2023. It is now read-only.

Commit 4e7b2b3

Browse files
authored
Merge pull request #745 from binary-com/dev
Dev
2 parents a857201 + 9203236 commit 4e7b2b3

File tree

130 files changed

+7550
-10774
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

130 files changed

+7550
-10774
lines changed

.babelrc

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"compact": true,
3+
"presets": [
4+
"react",
5+
["latest", { "es2015": { "modules": false }}],
6+
"stage-1",
7+
"stage-3"
8+
],
9+
"plugins": [
10+
"transform-decorators-legacy",
11+
"transform-inline-environment-variables",
12+
"transform-flow-strip-types"
13+
],
14+
"env": {
15+
"production": {
16+
"plugins": [
17+
"transform-react-constant-elements"
18+
]
19+
},
20+
"test": {
21+
"presets": [
22+
["es2015"],
23+
"react",
24+
"stage-1",
25+
"stage-3"
26+
],
27+
"plugins": [
28+
"transform-decorators-legacy"
29+
]
30+
}
31+
}
32+
}

.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"import/ignore": \.(scss|less|css)$,
5555
"import/resolver": {
5656
"webpack": {
57-
"config": "webpack.config.js"
57+
"config": "webpack.common.js"
5858
}
5959
},
6060
"flowtype": {

.flowconfig

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
.*/plugins
1313
.*/.publish
1414
.*/.cordova
15-
.*/webpack.config.js
15+
.*/webpack.common.js
16+
.*/webpack.dev.js
17+
.*/webpack.prod.js
1618
.*/server.js
1719

1820
[include]

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,6 @@ www/styles.css
1919
www/styles.css.map
2020
www/beta
2121
temp-translations
22-
ref
22+
ref
23+
www/*.bundle.js
24+
www/*.bundle.js.map

.istanbul.yml

Lines changed: 0 additions & 11 deletions
This file was deleted.

.travis.yml

Lines changed: 40 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,46 @@
11
git:
22
depth: 1
3-
language: node_js
3+
language: android
4+
android:
5+
components:
6+
- tools
7+
- platform-tools
8+
# The tools section appears twice on purpose as it’s
9+
# required to get the newest Android SDK tools.
10+
- tools
11+
- build-tools-27.0.1
12+
- android-26
413
matrix:
514
fast_finish: true
6-
node_js:
7-
- 6.0
815
notifications:
916
email:
1017
18+
1119
branches:
1220
only:
1321
- master
1422
- dev
1523
before_install:
16-
- yarn
24+
# cordova currently only works with node 6.x
25+
- curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
26+
- sudo apt-get install -y nodejs
27+
- sudo npm install --global cordova
28+
install:
29+
- yarn install
30+
- yarn test:full
31+
- yarn test:coveralls
1732
- cd build
18-
- yarn
33+
- yarn install
1934
- cd ..
20-
install: yarn test:full
21-
after_success:
22-
- yarn test:coveralls
35+
script:
2336
- cd build
2437
- yarn build
2538
- cd ..
39+
after_success:
2640
- if [ "$TRAVIS_BRANCH" = "dev" ] ; then rm -fR beta && mkdir beta && mv dist/* beta/ && mv beta dist/; fi
2741
- mkdir gh-pages
2842
- cd gh-pages
29-
- git clone --branch gh-pages https://[email protected]/binary-com/binary-next-gen --depth 1
43+
- git clone --branch gh-pages https://[email protected]/$TRAVIS_REPO_SLUG --depth 1
3044
- cd binary-next-gen
3145
- cp -R ../../dist/* .
3246
- git config --global user.email "[email protected]"
@@ -37,6 +51,23 @@ after_success:
3751
- git push
3852
- cd ../..
3953
- rm -fR gh-pages
54+
before_deploy:
55+
- git tag "$(date +'%Y-%m-%dT%H%M')-$(git log --format=%h -1)"
56+
- if [ "$TRAVIS_BRANCH" = "dev" ] ; then cp -R ./dist/beta/* ./www/; else cp -R ./dist/* ./www/; fi
57+
- cordova platform add android
58+
- yarn build:android
59+
- mv ./platforms/android/build/outputs/apk/debug/android-debug.apk ./platforms/android/build/outputs/apk/debug/next-gen-beta.apk
60+
deploy:
61+
provider: releases
62+
prerelease: true
63+
name: Next-Gen Prerelease $(date +'%Y-%m-%d %H:%M:%S')
64+
body: Release for QA testing! For official android app [Install from Google Play Store](https://play.google.com/store/apps/details?id=app.binary.com).
65+
api_key: $GIT_KEY
66+
file: "./platforms/android/build/outputs/apk/debug/next-gen-beta.apk"
67+
skip_cleanup: true
68+
on:
69+
repo: $TRAVIS_REPO_SLUG
70+
branch: dev
4071
env:
4172
global:
4273
secure: TNtKNXrrpzNHvxffdoRKup1JjkRAkN79QhmHJ3s0MiU4QMyGM8Q/3MGhyWlbu1Uk/2BztsQhVy6qonS826QbjCquJkU4Rfs7cXvKnok8OOrQ8To3rSJazip4Bu4hPoW1QC60Jg/wZCzl7Htw6UP69akn5FLRT6REm6ScuzJRHrRfyyse5cztXO/3bokx5vULd+RhcmkUm+/o+4g6g0KtaPA84SC5EQZVGj0Z2Wckw/SsoGv++61sEFnmANFrvzJc6CsriRETSeU8eYxNqMQOPNJijXB22UUWdq+oDFzc52xi+cUpZNt/L+REv0r4XSunUY4OyaxZzciDril7hV4BuIrbuwoTZHaYv3FK2Oc36vbWVbT2Gkp+kUcuKI1QoTkMlXAMmfi39uwCizXVsU7e1fjDczIS+v8eu1gibKW93E2rMbcW/+n/T6d5VHPHPryNDjTW6cDOiZCugwhU5a9ovbcgsdK+3Uq76OXbQWKgaHm6Mj7DCoMwT7jf6BmCbwoaDUostueKrW9vxYNuaCYkiz8rrgBg24q4PO/XC+hExeIo7ZsD2J0PzEwMBqFgFGU19XQblioSLdy5jkMCYLjFX/BsLniHt4Lvm0bUdJw5ORRGRYfc3W2lwL/kf4jayNeP6rbIAKNEvU54ScBnMKHsiRRtVTgZUXDUasn8uM8dN+8=

README.md

Lines changed: 78 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,89 @@
1-
# Next-Gen Binary
1+
# Binary Next-Gen
22

33
[![Build Status](https://travis-ci.org/binary-com/binary-next-gen.svg?branch=master)](https://travis-ci.org/binary-com/binary-next-gen)
44
[![Coverage Status](https://coveralls.io/repos/github/binary-com/binary-next-gen/badge.svg?branch=master)](https://coveralls.io/github/binary-com/binary-next-gen?branch=master)
55
[![Code Climate](https://codeclimate.com/github/binary-com/binary-next-gen/badges/gpa.svg)](https://codeclimate.com/github/binary-com/binary-next-gen)
66

7-
[Build & Start](../../wiki/Build-&-Start)
7+
This repository contains the source code for the Binary Next-Gen [webapp](https://app.binary.com/) and [Android app](https://play.google.com/store/apps/details?id=app.binary.com).
88

9-
[Mobile App](../../wiki/Mobile-App)
9+
> Note: As of Nov 2017, we no longer develop and publish the iOS version of next-gen, in accordance to App Store [Guideline 3.2.2 (viii)](https://developer.apple.com/app-store/review/guidelines/#unacceptable).
1010
11-
[Technologies Used](../../wiki/Technologies)
11+
## Installation
1212

13-
[i18n](../../wiki/i18n)
13+
Once you downloaded the repo, `cd` to project root and execute (you will need [yarn](https://yarnpkg.com)):
14+
```
15+
yarn install
16+
yarn start
17+
```
18+
Now in your web browser go to http://localhost:3000 to see your app.
1419

15-
[Learning Resources](../../wiki/learning)
20+
## Contribute
21+
22+
To contribute to Binary Next-Gen, fork this project and checkout the `dev` branch. When adding features or performing bug fixes, it is recommended you make a separate branch off `dev`. Prior to sending pull requests, make sure all unit tests passed (this project uses [Jest](https://facebook.github.io/jest/)):
23+
```
24+
yarn test
25+
```
26+
> Note: When you send pull requests, remember to set the base branch to `dev`.
27+
28+
Once your changes have been merged to `dev`, it will immediately deployed to [app.binary.com/beta](https://app.binary.com/beta), and a new prerelease will appear in the [github releases page](https://github.com/binary-com/binary-next-gen/releases).
29+
30+
## Change Endpoint
31+
32+
If you are a QA engineer, what you may want to do is change the endpoint. You can do this by executing the following code in the developer console (where `www.binaryqa37.com` is your endpoint and `1003` is your appId):
33+
34+
```
35+
setLocalEndpoint("www.binaryqa37.com", "1003")
36+
```
37+
38+
To reset the endpoint to default values, execute:
39+
40+
```
41+
resetLocalEndpoint()
42+
```
43+
44+
## Deploy to Your Personal Github Pages
45+
46+
There may be cases when you want to visit your webapp on devices other than your development environment. To do this you can deploy on your personal github.io project page.
47+
48+
This deployment process is automated using [gulp](https://gulpjs.com/) tasks in the `build` folder. After you have installed gulp globally (`npm install -g gulp`), execute the following from your project root:
49+
```
50+
cd build
51+
yarn install # <- if you have not done so
52+
gulp deploy:test --appId 11108
53+
```
54+
Replace `11108` above with your app id. If you do not have an app id, you can [register for a free app id here](https://developers.binary.com/applications/).
55+
56+
If the command executes successfully, the site will be hosted on `https://YOUR_USERNAME.github.io/binary-next-gen/`, where `YOUR_USERNAME` is your username. Note that if you login from there it will redirect you to `https://YOUR_USERNAME.github.io`. Just change the URL and your app will be up and running again.
57+
58+
Alternatively (not recommended as it is quite complicated), you can [use travis to deploy your github pages](docs/travis-github-pages.md).
59+
60+
## Documentation
61+
* [Build Instructions for iOS and Android](docs/build-instructions-ios-android.md)
62+
* [Dealing with Translations](docs/translations.md)
63+
* [Development Tools](docs/development-tools.md)
64+
* [Using Travis on Your Personal Github Page](docs/travis-github-pages.md)
65+
66+
## Legacy Documentation
67+
*Documentation listed in this section will be either updated or replaced in the future.*
68+
* [Mobile App](docs/mobile-app.md)
69+
* [Binary Next-Gen Technical Presentation](https://binary-com.github.io/binary-next-gen-technical-presentation/)
70+
71+
## Useful Links
72+
### Technologies Used
73+
* [React](https://reactjs.org/) - JavaScript library for building user interfaces.
74+
* [React Router](https://github.com/ReactTraining/react-router) - for routing, mapping urls to views.
75+
* [Redux](https://github.com/reactjs/redux) - state management.
76+
* [Reselect](https://github.com/reactjs/reselect) - data selection and computation.
77+
* [Immutable.js](https://facebook.github.io/immutable-js/) - immutable data structures.
78+
79+
### Learning Resources
80+
* [Egghead](https://egghead.io/)
81+
* [ES6 Cheatsheet](https://www.youtube.com/watch?v=AfWYO8t7ed4)
82+
* [Live React: Hot Reloading with Time Travel](https://www.youtube.com/watch?v=xsSnOQynTHs)
83+
* [Immutable Data and React](https://www.youtube.com/watch?v=I7IdS-PbEgI)
84+
* [Immutable JavaScript: You can't change this](https://www.youtube.com/watch?v=wA98Coal4jk)
85+
* [react-router increases your productivity](https://www.youtube.com/watch?v=XZfvW1a8Xac)
86+
* [PERFORMANCE ENGINEERING WITH REACT](http://benchling.engineering/performance-engineering-with-react/)
87+
* [A DEEP DIVE INTO REACT PERF DEBUGGING](http://benchling.engineering/deep-dive-react-perf-debugging/)
1688

1789
[![forthebadge](http://forthebadge.com/images/badges/built-by-hipsters.svg)](http://forthebadge.com)

build/Gulpfile.js

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,21 @@ const runSequence = require('run-sequence');
33
const del = require('del');
44
const file = require('gulp-file');
55
const ghPages = require('gulp-gh-pages');
6-
const sass = require('gulp-sass');
76
const args = require('yargs').argv;
87
const replace = require('gulp-replace');
98
const gulpIf = require('gulp-if');
109
const hash = require('gulp-hash-src');
1110
const bump = require('gulp-bump');
1211
const path = require('path');
1312
const run = require('gulp-run');
14-
13+
const modifyFile = require('gulp-modify-file');
1514
const electron = require('gulp-atom-electron');
1615
const zip = require('gulp-vinyl-zip');
1716

1817
const files = {
1918
dist: '../dist',
2019
js: '../src',
2120
static: ['../www/**/*', '../config.xml', '../electron.js', '!../www/**/*.scss'],
22-
sass: '../styles/*.scss',
2321
};
2422

2523
const tools = {
@@ -40,16 +38,6 @@ gulp.task('static', () =>
4038
.pipe(gulp.dest(files.dist))
4139
);
4240

43-
gulp.task('styles', () =>
44-
gulp.src(files.sass)
45-
.pipe(sass().on('error', sass.logError))
46-
.pipe(gulp.dest(files.dist))
47-
);
48-
49-
gulp.task('styles:watch', () =>
50-
gulp.watch('../www/**/*.scss', ['styles'])
51-
);
52-
5341
// Handle general error
5442
function errorHandler (error) {
5543
console.log(error.toString());
@@ -58,7 +46,7 @@ function errorHandler (error) {
5846

5947
gulp.task('js', () =>
6048
gulp.src(files.js)
61-
.pipe(run('(cd ../ && node_modules/.bin/webpack --config ./webpack.config.js)'))
49+
.pipe(run('(cd ../ && node_modules/.bin/webpack --config ./webpack.prod.js)'))
6250
.on('error', errorHandler)
6351
.pipe(gulp.dest(files.dist))
6452
);
@@ -81,7 +69,7 @@ gulp.task('hash', () =>
8169
);
8270

8371
gulp.task('build', callback =>
84-
runSequence('cleanup', 'js', ['styles', 'static'], 'hash', callback)
72+
runSequence('cleanup', 'js', 'static', 'hash', callback)
8573
);
8674

8775
// gulp.task('download-electron', () =>
@@ -116,14 +104,19 @@ gulp.task('deploy&codepush', (done) => {
116104
})
117105
});
118106

107+
// pass in your app id via --appId and this task will set it accordingly
108+
// before deploying to your gh-pages
119109
gulp.task('deploy:test', ['build'], () =>
120110
gulp.src(files.dist + '/**/*')
121-
.pipe(gulpIf(args.appId, replace(
122-
/window\.BinaryBoot\.appId = window\.cordova \? 1006 : 1001;/,
123-
'window.BinaryBoot.appId = ' + args.appId + ';',
124-
{ skipBinary: true }
125-
)
126-
))
111+
.pipe(gulpIf(args.appId, modifyFile((content, path, file) => {
112+
if (/(boot.js$)/i.test(path)) {
113+
return content.replace(
114+
'defaultAppID = 1001; //This is for PROD release',
115+
`defaultAppID = ${args.appId}; // This is injected by Gulp`
116+
);
117+
}
118+
return content;
119+
})))
127120
.pipe(ghPages())
128121
);
129122

build/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"author": "",
1212
"license": "MIT",
1313
"dependencies": {
14+
"del": "^3.0.0",
1415
"gulp": "^3.9.1",
1516
"gulp-atom-electron": "^1.9.0",
1617
"gulp-bump": "^2.4.0",
@@ -24,11 +25,11 @@
2425
"gulp-hash-src": "^0.1.6",
2526
"gulp-if": "^2.0.1",
2627
"gulp-minify-css": "^1.2.4",
28+
"gulp-modify-file": "^1.0.0",
2729
"gulp-replace": "^0.5.4",
2830
"gulp-run": "^1.7.1",
29-
"gulp-sass": "^2.3.2",
3031
"run-sequence": "^1.2.2",
31-
"webpack": "^3.0.0",
32-
"del": "^3.0.0"
32+
"yargs": "^6.4.0",
33+
"webpack": "^3.0.0"
3334
}
3435
}

0 commit comments

Comments
 (0)