From 101cfd4bea48eff9ccb34a2de9a0ea31a611d9ba Mon Sep 17 00:00:00 2001 From: Brian Douglas Date: Sat, 2 Apr 2016 00:41:32 -0700 Subject: [PATCH 01/18] updates eslint --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 85856959..be3820f1 100644 --- a/package.json +++ b/package.json @@ -12,8 +12,8 @@ ] }, "dependencies": { - "babel-eslint": "^5.0.0", - "eslint": "^2.2.0", + "babel-eslint": "^5.0.4", + "eslint": "^2.3.0", "eslint-config-airbnb": "^6.0.2", "eslint-plugin-import": "^1.0.3", "eslint-plugin-react": "^4.1.0", From 538d474d513501891b96b4c45ab0fdb66fe61eaa Mon Sep 17 00:00:00 2001 From: Brian Douglas Date: Mon, 4 Apr 2016 22:47:28 -0700 Subject: [PATCH 02/18] updgrades babel-eslint --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index be3820f1..edaa2743 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ ] }, "dependencies": { - "babel-eslint": "^5.0.4", + "babel-eslint": "^6.0.0", "eslint": "^2.3.0", "eslint-config-airbnb": "^6.0.2", "eslint-plugin-import": "^1.0.3", From e0269257202f4307ce11bb73d1482a1f0877410b Mon Sep 17 00:00:00 2001 From: Brian Douglas Date: Mon, 4 Apr 2016 23:21:03 -0700 Subject: [PATCH 03/18] explicitly adds babel-core to test script --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index edaa2743..eacf6dc5 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "private": true, "scripts": { "start": "react-native start", - "test": "mocha --require react-native-mock/mock.js --opts test/mocha.opts --recursive App/**/__tests__/*.test.js" + "test": "mocha --require react-native-mock/mock.js --opts test/mocha.opts --compilers js:babel-core/register --recursive App/**/__tests__/*.test.js" }, "babel": { "presets": [ From e07586cc8e92facbff352223d28797ed4ecaf16e Mon Sep 17 00:00:00 2001 From: Brian Douglas Date: Mon, 4 Apr 2016 23:21:03 -0700 Subject: [PATCH 04/18] explicitly adds babel-core to test script --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index edaa2743..cf6fb180 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "private": true, "scripts": { "start": "react-native start", - "test": "mocha --require react-native-mock/mock.js --opts test/mocha.opts --recursive App/**/__tests__/*.test.js" + "test": "mocha --require js:babel-core/register react-native-mock/mock.js --opts test/mocha.opts --recursive App/**/__tests__/*.test.js" }, "babel": { "presets": [ From 579f4cce549555d1855007a4cf10fed344146cb8 Mon Sep 17 00:00:00 2001 From: Brian Douglas Date: Mon, 4 Apr 2016 23:37:04 -0700 Subject: [PATCH 05/18] explicitly adds babel-core --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index cf6fb180..123f2606 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ ] }, "dependencies": { + "babel-core": "^6.7.4", "babel-eslint": "^6.0.0", "eslint": "^2.3.0", "eslint-config-airbnb": "^6.0.2", From b1b804b4fa5c48389e6709bc98214c9486f1a1bd Mon Sep 17 00:00:00 2001 From: Brian Douglas Date: Mon, 4 Apr 2016 23:58:25 -0700 Subject: [PATCH 06/18] adds stage-o --- package.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index cf6fb180..93d0c3c5 100644 --- a/package.json +++ b/package.json @@ -4,11 +4,12 @@ "private": true, "scripts": { "start": "react-native start", - "test": "mocha --require js:babel-core/register react-native-mock/mock.js --opts test/mocha.opts --recursive App/**/__tests__/*.test.js" + "test": "mocha --require react-native-mock/mock.js --opts test/mocha.opts --recursive App/**/__tests__/*.test.js" }, "babel": { "presets": [ - "react-native" + "react-native", + "stage-0" ] }, "dependencies": { @@ -27,6 +28,7 @@ "devDependencies": { "babel-core": "^6.7.2", "babel-preset-react-native": "^1.5.2", + "babel-preset-stage-0": "^6.5.0", "chai": "^3.5.0", "enzyme": "^2.1.0", "react-dom": "^0.14.7", From ad3db083c534c75e14282b4d8ddcbc1c37d33ba1 Mon Sep 17 00:00:00 2001 From: Brian Douglas Date: Tue, 5 Apr 2016 00:03:39 -0700 Subject: [PATCH 07/18] adds all options to opt file --- package.json | 2 +- test/mocha.opts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index f85388e5..bf9b504b 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "private": true, "scripts": { "start": "react-native start", - "test": "mocha --require react-native-mock/mock.js --opts test/mocha.opts --recursive App/**/__tests__/*.test.js" + "test": "mocha --opts test/mocha.opts" }, "babel": { "presets": [ diff --git a/test/mocha.opts b/test/mocha.opts index 224ea762..f3bad66a 100644 --- a/test/mocha.opts +++ b/test/mocha.opts @@ -1 +1,3 @@ ---compilers js:test/compiler.js +--require react-native-mock/mock.js +--compilers js:babel-core/register +--recursive App/**/__tests__/*.test.js From f9b5b953932315ecefe2e6e2de18813a4bc4c0db Mon Sep 17 00:00:00 2001 From: Brian Douglas Date: Tue, 5 Apr 2016 00:06:52 -0700 Subject: [PATCH 08/18] removes test and mocha opts --- package.json | 2 +- test/compiler.js | 20 -------------------- test/mocha.opts | 3 --- 3 files changed, 1 insertion(+), 24 deletions(-) delete mode 100644 test/compiler.js delete mode 100644 test/mocha.opts diff --git a/package.json b/package.json index bf9b504b..0f0ed7e1 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "private": true, "scripts": { "start": "react-native start", - "test": "mocha --opts test/mocha.opts" + "test": "mocha --require react-native-mock/mock.js --compilers js:babel-core/register --recursive App/**/__tests__/*.test.js" }, "babel": { "presets": [ diff --git a/test/compiler.js b/test/compiler.js deleted file mode 100644 index 7cf26720..00000000 --- a/test/compiler.js +++ /dev/null @@ -1,20 +0,0 @@ -var fs = require('fs'); -var path = require('path'); -var babel = require('babel-core'); -var origJs = require.extensions['.js']; - -require.extensions['.js'] = function (module, fileName) { - var output; - if (fileName.indexOf('node_modules/react-native/Libraries/react-native/react-native.js') >= 0) { - fileName = path.resolve('./test/mocks/react-native.js'); - } - if (fileName.indexOf('node_modules/') >= 0) { - return (origJs || require.extensions['.js'])(module, fileName); - } - var src = fs.readFileSync(fileName, 'utf8'); - output = babel.transform(src, { - filename: fileName - }).code; - - return module._compile(output, fileName); -}; diff --git a/test/mocha.opts b/test/mocha.opts deleted file mode 100644 index f3bad66a..00000000 --- a/test/mocha.opts +++ /dev/null @@ -1,3 +0,0 @@ ---require react-native-mock/mock.js ---compilers js:babel-core/register ---recursive App/**/__tests__/*.test.js From 82f1d1696a30037eb1d1a487fd5015fbe553a4bc Mon Sep 17 00:00:00 2001 From: Brian Douglas Date: Tue, 5 Apr 2016 06:45:34 -0700 Subject: [PATCH 09/18] adds plugin preset for transform --- package.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 0f0ed7e1..d16fda84 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,8 @@ "babel": { "presets": [ "react-native", - "stage-0" + "stage-0", + "transform-runtime" ] }, "dependencies": { @@ -28,6 +29,8 @@ }, "devDependencies": { "babel-core": "^6.7.2", + "babel-plugin-transform-runtime": "^6.6.0", + "babel-polyfill": "^6.7.4", "babel-preset-react-native": "^1.5.2", "babel-preset-stage-0": "^6.5.0", "chai": "^3.5.0", From 743a023ad98fda2e4e40c90b3bb8700266abdc63 Mon Sep 17 00:00:00 2001 From: Brian Douglas Date: Tue, 5 Apr 2016 07:35:01 -0700 Subject: [PATCH 10/18] adds circle.yml --- circle.yml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 circle.yml diff --git a/circle.yml b/circle.yml new file mode 100644 index 00000000..efa5afc6 --- /dev/null +++ b/circle.yml @@ -0,0 +1,3 @@ +machine: + node: + version: 5.4.1 From 51dd85563995b1ef37166d284d87b2496d7a17a8 Mon Sep 17 00:00:00 2001 From: Brian Douglas Date: Tue, 5 Apr 2016 07:44:02 -0700 Subject: [PATCH 11/18] adds babel-runtime support --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d16fda84..fbf512c0 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,6 @@ ] }, "dependencies": { - "babel-core": "^6.7.4", "babel-eslint": "^6.0.0", "eslint": "^2.3.0", "eslint-config-airbnb": "^6.0.2", @@ -33,6 +32,7 @@ "babel-polyfill": "^6.7.4", "babel-preset-react-native": "^1.5.2", "babel-preset-stage-0": "^6.5.0", + "babel-runtime": "^6.6.1", "chai": "^3.5.0", "enzyme": "^2.1.0", "react-dom": "^0.14.7", From cea32c47da6ef0a2471d4c426a7930ab7fd1fbcd Mon Sep 17 00:00:00 2001 From: Brian Douglas Date: Tue, 5 Apr 2016 07:46:02 -0700 Subject: [PATCH 12/18] changes node version --- circle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/circle.yml b/circle.yml index efa5afc6..7d7725ca 100644 --- a/circle.yml +++ b/circle.yml @@ -1,3 +1,3 @@ machine: node: - version: 5.4.1 + version: 5.0.0 From efd356a3d142c366b46e1c2fd8c046c8ab7bfc8d Mon Sep 17 00:00:00 2001 From: Brian Douglas Date: Tue, 5 Apr 2016 07:50:53 -0700 Subject: [PATCH 13/18] removes circle.yml --- circle.yml | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 circle.yml diff --git a/circle.yml b/circle.yml deleted file mode 100644 index 7d7725ca..00000000 --- a/circle.yml +++ /dev/null @@ -1,3 +0,0 @@ -machine: - node: - version: 5.0.0 From 49dba813e95f6aa07e8b7fee43b3c7c3fe43f128 Mon Sep 17 00:00:00 2001 From: Brian Douglas Date: Tue, 5 Apr 2016 08:52:22 -0700 Subject: [PATCH 14/18] adds transform as plugin --- circle.yml | 3 +++ package.json | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 circle.yml diff --git a/circle.yml b/circle.yml new file mode 100644 index 00000000..2336744d --- /dev/null +++ b/circle.yml @@ -0,0 +1,3 @@ +machine: + node: + version: 4.1.1 diff --git a/package.json b/package.json index fbf512c0..1dab2774 100644 --- a/package.json +++ b/package.json @@ -9,9 +9,9 @@ "babel": { "presets": [ "react-native", - "stage-0", - "transform-runtime" - ] + "stage-0" + ], + "plugins": ["transform-runtime"] }, "dependencies": { "babel-eslint": "^6.0.0", From 6e852054bd043a8bf14abcf0bd7f6a4088421c40 Mon Sep 17 00:00:00 2001 From: Brian Douglas Date: Tue, 5 Apr 2016 08:55:41 -0700 Subject: [PATCH 15/18] 5.0.0 --- circle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/circle.yml b/circle.yml index 2336744d..7d7725ca 100644 --- a/circle.yml +++ b/circle.yml @@ -1,3 +1,3 @@ machine: node: - version: 4.1.1 + version: 5.0.0 From afd3fb03421f5590dc995324b0daba74d700dff0 Mon Sep 17 00:00:00 2001 From: Brian Douglas Date: Tue, 5 Apr 2016 08:58:17 -0700 Subject: [PATCH 16/18] adds react test dependencies --- package.json | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 1dab2774..e18d87a7 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,9 @@ "react-native", "stage-0" ], - "plugins": ["transform-runtime"] + "plugins": [ + "transform-runtime" + ] }, "dependencies": { "babel-eslint": "^6.0.0", @@ -35,7 +37,9 @@ "babel-runtime": "^6.6.1", "chai": "^3.5.0", "enzyme": "^2.1.0", - "react-dom": "^0.14.7", + "react": "^0.14.8", + "react-addons-test-utils": "^0.14.8", + "react-dom": "^0.14.8", "react-native-mock": "0.0.6" } } From be96343e844bf03b18cadba57a4763246caa52d4 Mon Sep 17 00:00:00 2001 From: Brian Douglas Date: Mon, 4 Apr 2016 22:47:28 -0700 Subject: [PATCH 17/18] updgrades babel-eslint Does not set session on auth token retrieval failure adds stage-o explicitly adds babel-core adds all options to opt file removes test and mocha opts adds plugin preset for transform adds circle.yml adds babel-runtime support adds transform as plugin adds react test dependencies --- App/Components/Login.js | 6 +++--- App/Components/Main.js | 8 +++++--- App/Components/MessageThreads.js | 2 +- App/Components/Settings.js | 12 +++++++----- App/Lib/Api.js | 10 ++++++---- circle.yml | 3 +++ package.json | 18 ++++++++++++++---- test/compiler.js | 20 -------------------- test/mocha.opts | 1 - 9 files changed, 39 insertions(+), 41 deletions(-) create mode 100644 circle.yml delete mode 100644 test/compiler.js delete mode 100644 test/mocha.opts diff --git a/App/Components/Login.js b/App/Components/Login.js index 7b8cca18..d824fd9c 100644 --- a/App/Components/Login.js +++ b/App/Components/Login.js @@ -120,9 +120,9 @@ export default class Login extends React.Component { } render() { - const _handleSubmit = this.handleSubmit; - const _handleEmailChange = this.handleEmailChange; - const _handlePasswordChange = this.handlePasswordChange; + const _handleSubmit = this.handleSubmit.bind(this); + const _handleEmailChange = this.handleEmailChange.bind(this); + const _handlePasswordChange = this.handlePasswordChange.bind(this); const showErr = ( this.state.error ? {this.state.error} : ); diff --git a/App/Components/Main.js b/App/Components/Main.js index fd697d0f..f7fb89c0 100644 --- a/App/Components/Main.js +++ b/App/Components/Main.js @@ -21,9 +21,11 @@ export default class Main extends React.Component { checkForKey() { store.get('session').then((session) => { - this.setState({ - auth_token: session.token - }); + if (session) { + this.setState({ + auth_token: session.token + }); + } }); } render() { diff --git a/App/Components/MessageThreads.js b/App/Components/MessageThreads.js index f5faa3b0..e79f55d1 100644 --- a/App/Components/MessageThreads.js +++ b/App/Components/MessageThreads.js @@ -76,7 +76,7 @@ export default class MessageThreads extends React.Component { dataSource: this.ds.cloneWithRows(data), }); }) - .catch((error) => console.error(`error: ${error}`)); + .catch((error) => console.log(`error: ${error}`)); } viewMessages(rowData) { diff --git a/App/Components/Settings.js b/App/Components/Settings.js index 1edc89ff..4883a8e1 100644 --- a/App/Components/Settings.js +++ b/App/Components/Settings.js @@ -38,10 +38,12 @@ export default class Settings extends React.Component { componentDidMount() { store.get('session').then((res) => { - this.setState({ - firstName: res.user.first_name, - lastName: res.user.last_name, - }); + if (res) { + this.setState({ + firstName: res.user.first_name, + lastName: res.user.last_name, + }); + } }); } @@ -54,7 +56,7 @@ export default class Settings extends React.Component { } render() { - const _logout = this.logOut; + const _logout = this.logOut.bind(this); return ( diff --git a/App/Lib/Api.js b/App/Lib/Api.js index 6d501d83..c395e942 100644 --- a/App/Lib/Api.js +++ b/App/Lib/Api.js @@ -20,10 +20,12 @@ const api = { .then((res) => { const resBody = JSON.parse(res._bodyText); - store.save('session', { - token: resBody.auth_token, - current_user: resBody.user, - }); + if (res.status < 400) { + store.save('session', { + token: resBody.auth_token, + current_user: resBody.user, + }); + } return resBody; }) diff --git a/circle.yml b/circle.yml new file mode 100644 index 00000000..7d7725ca --- /dev/null +++ b/circle.yml @@ -0,0 +1,3 @@ +machine: + node: + version: 5.0.0 diff --git a/package.json b/package.json index be3820f1..e18d87a7 100644 --- a/package.json +++ b/package.json @@ -4,15 +4,19 @@ "private": true, "scripts": { "start": "react-native start", - "test": "mocha --require react-native-mock/mock.js --opts test/mocha.opts --recursive App/**/__tests__/*.test.js" + "test": "mocha --require react-native-mock/mock.js --compilers js:babel-core/register --recursive App/**/__tests__/*.test.js" }, "babel": { "presets": [ - "react-native" + "react-native", + "stage-0" + ], + "plugins": [ + "transform-runtime" ] }, "dependencies": { - "babel-eslint": "^5.0.4", + "babel-eslint": "^6.0.0", "eslint": "^2.3.0", "eslint-config-airbnb": "^6.0.2", "eslint-plugin-import": "^1.0.3", @@ -26,10 +30,16 @@ }, "devDependencies": { "babel-core": "^6.7.2", + "babel-plugin-transform-runtime": "^6.6.0", + "babel-polyfill": "^6.7.4", "babel-preset-react-native": "^1.5.2", + "babel-preset-stage-0": "^6.5.0", + "babel-runtime": "^6.6.1", "chai": "^3.5.0", "enzyme": "^2.1.0", - "react-dom": "^0.14.7", + "react": "^0.14.8", + "react-addons-test-utils": "^0.14.8", + "react-dom": "^0.14.8", "react-native-mock": "0.0.6" } } diff --git a/test/compiler.js b/test/compiler.js deleted file mode 100644 index 7cf26720..00000000 --- a/test/compiler.js +++ /dev/null @@ -1,20 +0,0 @@ -var fs = require('fs'); -var path = require('path'); -var babel = require('babel-core'); -var origJs = require.extensions['.js']; - -require.extensions['.js'] = function (module, fileName) { - var output; - if (fileName.indexOf('node_modules/react-native/Libraries/react-native/react-native.js') >= 0) { - fileName = path.resolve('./test/mocks/react-native.js'); - } - if (fileName.indexOf('node_modules/') >= 0) { - return (origJs || require.extensions['.js'])(module, fileName); - } - var src = fs.readFileSync(fileName, 'utf8'); - output = babel.transform(src, { - filename: fileName - }).code; - - return module._compile(output, fileName); -}; diff --git a/test/mocha.opts b/test/mocha.opts deleted file mode 100644 index 224ea762..00000000 --- a/test/mocha.opts +++ /dev/null @@ -1 +0,0 @@ ---compilers js:test/compiler.js From 9d52ec65c384f68c652163bc61af4a1adec86f21 Mon Sep 17 00:00:00 2001 From: Brian Douglas Date: Tue, 5 Apr 2016 09:09:15 -0700 Subject: [PATCH 18/18] removes unused stage-o --- package.json | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/package.json b/package.json index e18d87a7..3be2a995 100644 --- a/package.json +++ b/package.json @@ -7,10 +7,7 @@ "test": "mocha --require react-native-mock/mock.js --compilers js:babel-core/register --recursive App/**/__tests__/*.test.js" }, "babel": { - "presets": [ - "react-native", - "stage-0" - ], + "presets": ["react-native"], "plugins": [ "transform-runtime" ] @@ -33,7 +30,6 @@ "babel-plugin-transform-runtime": "^6.6.0", "babel-polyfill": "^6.7.4", "babel-preset-react-native": "^1.5.2", - "babel-preset-stage-0": "^6.5.0", "babel-runtime": "^6.6.1", "chai": "^3.5.0", "enzyme": "^2.1.0",