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

Commit

Permalink
Merge pull request #745 from binary-com/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
arnabk committed Dec 7, 2017
2 parents a857201 + 9203236 commit 4e7b2b3
Show file tree
Hide file tree
Showing 130 changed files with 7,550 additions and 10,774 deletions.
32 changes: 32 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"compact": true,
"presets": [
"react",
["latest", { "es2015": { "modules": false }}],
"stage-1",
"stage-3"
],
"plugins": [
"transform-decorators-legacy",
"transform-inline-environment-variables",
"transform-flow-strip-types"
],
"env": {
"production": {
"plugins": [
"transform-react-constant-elements"
]
},
"test": {
"presets": [
["es2015"],
"react",
"stage-1",
"stage-3"
],
"plugins": [
"transform-decorators-legacy"
]
}
}
}
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"import/ignore": \.(scss|less|css)$,
"import/resolver": {
"webpack": {
"config": "webpack.config.js"
"config": "webpack.common.js"
}
},
"flowtype": {
Expand Down
4 changes: 3 additions & 1 deletion .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
.*/plugins
.*/.publish
.*/.cordova
.*/webpack.config.js
.*/webpack.common.js
.*/webpack.dev.js
.*/webpack.prod.js
.*/server.js

[include]
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ www/styles.css
www/styles.css.map
www/beta
temp-translations
ref
ref
www/*.bundle.js
www/*.bundle.js.map
11 changes: 0 additions & 11 deletions .istanbul.yml

This file was deleted.

49 changes: 40 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,46 @@
git:
depth: 1
language: node_js
language: android
android:
components:
- tools
- platform-tools
# The tools section appears twice on purpose as it’s
# required to get the newest Android SDK tools.
- tools
- build-tools-27.0.1
- android-26
matrix:
fast_finish: true
node_js:
- 6.0
notifications:
email:
- arnab@binary.com
- amin@binary.com
branches:
only:
- master
- dev
before_install:
- yarn
# cordova currently only works with node 6.x
- curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
- sudo apt-get install -y nodejs
- sudo npm install --global cordova
install:
- yarn install
- yarn test:full
- yarn test:coveralls
- cd build
- yarn
- yarn install
- cd ..
install: yarn test:full
after_success:
- yarn test:coveralls
script:
- cd build
- yarn build
- cd ..
after_success:
- if [ "$TRAVIS_BRANCH" = "dev" ] ; then rm -fR beta && mkdir beta && mv dist/* beta/ && mv beta dist/; fi
- mkdir gh-pages
- cd gh-pages
- git clone --branch gh-pages https://$GIT_KEY@github.com/binary-com/binary-next-gen --depth 1
- git clone --branch gh-pages https://$GIT_KEY@github.com/$TRAVIS_REPO_SLUG --depth 1
- cd binary-next-gen
- cp -R ../../dist/* .
- git config --global user.email "arnab@binary.com"
Expand All @@ -37,6 +51,23 @@ after_success:
- git push
- cd ../..
- rm -fR gh-pages
before_deploy:
- git tag "$(date +'%Y-%m-%dT%H%M')-$(git log --format=%h -1)"
- if [ "$TRAVIS_BRANCH" = "dev" ] ; then cp -R ./dist/beta/* ./www/; else cp -R ./dist/* ./www/; fi
- cordova platform add android
- yarn build:android
- mv ./platforms/android/build/outputs/apk/debug/android-debug.apk ./platforms/android/build/outputs/apk/debug/next-gen-beta.apk
deploy:
provider: releases
prerelease: true
name: Next-Gen Prerelease $(date +'%Y-%m-%d %H:%M:%S')
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).
api_key: $GIT_KEY
file: "./platforms/android/build/outputs/apk/debug/next-gen-beta.apk"
skip_cleanup: true
on:
repo: $TRAVIS_REPO_SLUG
branch: dev
env:
global:
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=
Expand Down
84 changes: 78 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,89 @@
# Next-Gen Binary
# Binary Next-Gen

[![Build Status](https://travis-ci.org/binary-com/binary-next-gen.svg?branch=master)](https://travis-ci.org/binary-com/binary-next-gen)
[![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)
[![Code Climate](https://codeclimate.com/github/binary-com/binary-next-gen/badges/gpa.svg)](https://codeclimate.com/github/binary-com/binary-next-gen)

[Build & Start](../../wiki/Build-&-Start)
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).

[Mobile App](../../wiki/Mobile-App)
> 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).
[Technologies Used](../../wiki/Technologies)
## Installation

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

[Learning Resources](../../wiki/learning)
## Contribute

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/)):
```
yarn test
```
> Note: When you send pull requests, remember to set the base branch to `dev`.
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).

## Change Endpoint

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):

```
setLocalEndpoint("www.binaryqa37.com", "1003")
```

To reset the endpoint to default values, execute:

```
resetLocalEndpoint()
```

## Deploy to Your Personal Github Pages

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.

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:
```
cd build
yarn install # <- if you have not done so
gulp deploy:test --appId 11108
```
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/).

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.

Alternatively (not recommended as it is quite complicated), you can [use travis to deploy your github pages](docs/travis-github-pages.md).

## Documentation
* [Build Instructions for iOS and Android](docs/build-instructions-ios-android.md)
* [Dealing with Translations](docs/translations.md)
* [Development Tools](docs/development-tools.md)
* [Using Travis on Your Personal Github Page](docs/travis-github-pages.md)

## Legacy Documentation
*Documentation listed in this section will be either updated or replaced in the future.*
* [Mobile App](docs/mobile-app.md)
* [Binary Next-Gen Technical Presentation](https://binary-com.github.io/binary-next-gen-technical-presentation/)

## Useful Links
### Technologies Used
* [React](https://reactjs.org/) - JavaScript library for building user interfaces.
* [React Router](https://github.com/ReactTraining/react-router) - for routing, mapping urls to views.
* [Redux](https://github.com/reactjs/redux) - state management.
* [Reselect](https://github.com/reactjs/reselect) - data selection and computation.
* [Immutable.js](https://facebook.github.io/immutable-js/) - immutable data structures.

### Learning Resources
* [Egghead](https://egghead.io/)
* [ES6 Cheatsheet](https://www.youtube.com/watch?v=AfWYO8t7ed4)
* [Live React: Hot Reloading with Time Travel](https://www.youtube.com/watch?v=xsSnOQynTHs)
* [Immutable Data and React](https://www.youtube.com/watch?v=I7IdS-PbEgI)
* [Immutable JavaScript: You can't change this](https://www.youtube.com/watch?v=wA98Coal4jk)
* [react-router increases your productivity](https://www.youtube.com/watch?v=XZfvW1a8Xac)
* [PERFORMANCE ENGINEERING WITH REACT](http://benchling.engineering/performance-engineering-with-react/)
* [A DEEP DIVE INTO REACT PERF DEBUGGING](http://benchling.engineering/deep-dive-react-perf-debugging/)

[![forthebadge](http://forthebadge.com/images/badges/built-by-hipsters.svg)](http://forthebadge.com)
35 changes: 14 additions & 21 deletions build/Gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,21 @@ const runSequence = require('run-sequence');
const del = require('del');
const file = require('gulp-file');
const ghPages = require('gulp-gh-pages');
const sass = require('gulp-sass');
const args = require('yargs').argv;
const replace = require('gulp-replace');
const gulpIf = require('gulp-if');
const hash = require('gulp-hash-src');
const bump = require('gulp-bump');
const path = require('path');
const run = require('gulp-run');

const modifyFile = require('gulp-modify-file');
const electron = require('gulp-atom-electron');
const zip = require('gulp-vinyl-zip');

const files = {
dist: '../dist',
js: '../src',
static: ['../www/**/*', '../config.xml', '../electron.js', '!../www/**/*.scss'],
sass: '../styles/*.scss',
};

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

gulp.task('styles', () =>
gulp.src(files.sass)
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest(files.dist))
);

gulp.task('styles:watch', () =>
gulp.watch('../www/**/*.scss', ['styles'])
);

// Handle general error
function errorHandler (error) {
console.log(error.toString());
Expand All @@ -58,7 +46,7 @@ function errorHandler (error) {

gulp.task('js', () =>
gulp.src(files.js)
.pipe(run('(cd ../ && node_modules/.bin/webpack --config ./webpack.config.js)'))
.pipe(run('(cd ../ && node_modules/.bin/webpack --config ./webpack.prod.js)'))
.on('error', errorHandler)
.pipe(gulp.dest(files.dist))
);
Expand All @@ -81,7 +69,7 @@ gulp.task('hash', () =>
);

gulp.task('build', callback =>
runSequence('cleanup', 'js', ['styles', 'static'], 'hash', callback)
runSequence('cleanup', 'js', 'static', 'hash', callback)
);

// gulp.task('download-electron', () =>
Expand Down Expand Up @@ -116,14 +104,19 @@ gulp.task('deploy&codepush', (done) => {
})
});

// pass in your app id via --appId and this task will set it accordingly
// before deploying to your gh-pages
gulp.task('deploy:test', ['build'], () =>
gulp.src(files.dist + '/**/*')
.pipe(gulpIf(args.appId, replace(
/window\.BinaryBoot\.appId = window\.cordova \? 1006 : 1001;/,
'window.BinaryBoot.appId = ' + args.appId + ';',
{ skipBinary: true }
)
))
.pipe(gulpIf(args.appId, modifyFile((content, path, file) => {
if (/(boot.js$)/i.test(path)) {
return content.replace(
'defaultAppID = 1001; //This is for PROD release',
`defaultAppID = ${args.appId}; // This is injected by Gulp`
);
}
return content;
})))
.pipe(ghPages())
);

Expand Down
7 changes: 4 additions & 3 deletions build/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"author": "",
"license": "MIT",
"dependencies": {
"del": "^3.0.0",
"gulp": "^3.9.1",
"gulp-atom-electron": "^1.9.0",
"gulp-bump": "^2.4.0",
Expand All @@ -24,11 +25,11 @@
"gulp-hash-src": "^0.1.6",
"gulp-if": "^2.0.1",
"gulp-minify-css": "^1.2.4",
"gulp-modify-file": "^1.0.0",
"gulp-replace": "^0.5.4",
"gulp-run": "^1.7.1",
"gulp-sass": "^2.3.2",
"run-sequence": "^1.2.2",
"webpack": "^3.0.0",
"del": "^3.0.0"
"yargs": "^6.4.0",
"webpack": "^3.0.0"
}
}
Loading

0 comments on commit 4e7b2b3

Please sign in to comment.