diff --git a/.gitignore b/.gitignore index ff1ed318b..09ec932e4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,4 @@ -npm-debug.log node_modules -docs -.tern-project -.tern-config - +lerna-debug.log +npm-debug.log.* +npm-debug.log diff --git a/docs/contributing.md b/docs/contributing.md new file mode 100644 index 000000000..8892484fb --- /dev/null +++ b/docs/contributing.md @@ -0,0 +1,56 @@ +# Contributing + +### Getting Started + +Clone & switch to the right branch. + +``` +git clone git@github.com:skellock/reactotron.git +cd reactotron +git checkout next +``` + +Run the setup script to install the dependencies & run tests. + +``` +npm run welcome +``` + + +### Code Style + +We use [standard.js](https://github.com/feross/standard). It is passive-agressively enforced. +Stern looks will be handed out. For repeat offenders, there WILL be finger wagging. + + +### Monorepo & Lerna + +This is a monorepo: multiple JS packages in 1 git repo. + +We use [lerna](https://github.com/lerna/lerna) to help us. + + +### Funky internal dependencies + +`demo-react-native` is a React Native sample app. It depends on +`reactotron-react-native` which in turn depends on both `socket.io` and +`reactotron-core-client`. + +Usually npm handles this right? + +So why am I typing this? + +Well, React Native (<=0.30.0) makes this hard to link to the dependencies +within this repo. + +How we current get around this is by: + +1. adding `socket.io` to the deps of `demo-react-native` :( +1. copy built versions of `reactotron-core-client` and `reactotron-react-native` manually to `node_modules` :( + +Many tears were shed and this is the least shitty solution I could muster. + +In the root, you can run `npm copy-internal-deps` to make them copy over. + +But since you're copying built dependencies, you'll need to run `npm run build` first +if you're doing this to bring forward changes in those dependency libraries. diff --git a/docs/images/apisauce/apisauce.jpg b/docs/images/apisauce/apisauce.jpg new file mode 100644 index 000000000..443cf18da Binary files /dev/null and b/docs/images/apisauce/apisauce.jpg differ diff --git a/docs/images/quick-start-react-js/first-connect.jpg b/docs/images/quick-start-react-js/first-connect.jpg new file mode 100644 index 000000000..cac881dcf Binary files /dev/null and b/docs/images/quick-start-react-js/first-connect.jpg differ diff --git a/docs/images/quick-start-react-js/hello-1.jpg b/docs/images/quick-start-react-js/hello-1.jpg new file mode 100644 index 000000000..f151fab39 Binary files /dev/null and b/docs/images/quick-start-react-js/hello-1.jpg differ diff --git a/docs/images/quick-start-react-js/hello-2.jpg b/docs/images/quick-start-react-js/hello-2.jpg new file mode 100644 index 000000000..5ec1bcf32 Binary files /dev/null and b/docs/images/quick-start-react-js/hello-2.jpg differ diff --git a/docs/images/quick-start-react-js/installing.jpg b/docs/images/quick-start-react-js/installing.jpg new file mode 100644 index 000000000..23e149f90 Binary files /dev/null and b/docs/images/quick-start-react-js/installing.jpg differ diff --git a/docs/images/quick-start-react-js/react-demo-js-reactotron.jpg b/docs/images/quick-start-react-js/react-demo-js-reactotron.jpg new file mode 100644 index 000000000..65e9e64f6 Binary files /dev/null and b/docs/images/quick-start-react-js/react-demo-js-reactotron.jpg differ diff --git a/docs/images/quick-start-react-js/react-demo-js.jpg b/docs/images/quick-start-react-js/react-demo-js.jpg new file mode 100644 index 000000000..c38f7a811 Binary files /dev/null and b/docs/images/quick-start-react-js/react-demo-js.jpg differ diff --git a/docs/images/quick-start-react-js/spammy.jpg b/docs/images/quick-start-react-js/spammy.jpg new file mode 100644 index 000000000..14351204e Binary files /dev/null and b/docs/images/quick-start-react-js/spammy.jpg differ diff --git a/docs/images/quick-start-react-native/first-connect.jpg b/docs/images/quick-start-react-native/first-connect.jpg new file mode 100644 index 000000000..b3dcc8fa1 Binary files /dev/null and b/docs/images/quick-start-react-native/first-connect.jpg differ diff --git a/docs/images/quick-start-react-native/hello-1.jpg b/docs/images/quick-start-react-native/hello-1.jpg new file mode 100644 index 000000000..f414bd346 Binary files /dev/null and b/docs/images/quick-start-react-native/hello-1.jpg differ diff --git a/docs/images/quick-start-react-native/hello-2.jpg b/docs/images/quick-start-react-native/hello-2.jpg new file mode 100644 index 000000000..fc4e46a61 Binary files /dev/null and b/docs/images/quick-start-react-native/hello-2.jpg differ diff --git a/docs/images/quick-start-react-native/react-demo-native-reactotron.jpg b/docs/images/quick-start-react-native/react-demo-native-reactotron.jpg new file mode 100644 index 000000000..70fe92b44 Binary files /dev/null and b/docs/images/quick-start-react-native/react-demo-native-reactotron.jpg differ diff --git a/docs/images/quick-start-react-native/react-demo-native.jpg b/docs/images/quick-start-react-native/react-demo-native.jpg new file mode 100644 index 000000000..95658e5c8 Binary files /dev/null and b/docs/images/quick-start-react-native/react-demo-native.jpg differ diff --git a/docs/images/quick-start-react-native/spammy.jpg b/docs/images/quick-start-react-native/spammy.jpg new file mode 100644 index 000000000..0a0bcd925 Binary files /dev/null and b/docs/images/quick-start-react-native/spammy.jpg differ diff --git a/docs/images/readme/Reactotron-128.png b/docs/images/readme/Reactotron-128.png new file mode 100644 index 000000000..29527f8be Binary files /dev/null and b/docs/images/readme/Reactotron-128.png differ diff --git a/docs/images/readme/Reactotron-64.png b/docs/images/readme/Reactotron-64.png new file mode 100644 index 000000000..40951d16c Binary files /dev/null and b/docs/images/readme/Reactotron-64.png differ diff --git a/docs/images/readme/reactotron-demo-app.gif b/docs/images/readme/reactotron-demo-app.gif new file mode 100644 index 000000000..32060fd75 Binary files /dev/null and b/docs/images/readme/reactotron-demo-app.gif differ diff --git a/docs/images/readme/reactotron-demo-cli.gif b/docs/images/readme/reactotron-demo-cli.gif new file mode 100644 index 000000000..88c10c4f2 Binary files /dev/null and b/docs/images/readme/reactotron-demo-cli.gif differ diff --git a/docs/images/redux/dispatching.jpg b/docs/images/redux/dispatching.jpg new file mode 100644 index 000000000..92a537a2e Binary files /dev/null and b/docs/images/redux/dispatching.jpg differ diff --git a/docs/images/redux/redux-keys-values.jpg b/docs/images/redux/redux-keys-values.jpg new file mode 100644 index 000000000..1fc0931b2 Binary files /dev/null and b/docs/images/redux/redux-keys-values.jpg differ diff --git a/docs/images/redux/subscriptions.jpg b/docs/images/redux/subscriptions.jpg new file mode 100644 index 000000000..486e567f0 Binary files /dev/null and b/docs/images/redux/subscriptions.jpg differ diff --git a/docs/images/track-global-errors/stack-trace.jpg b/docs/images/track-global-errors/stack-trace.jpg new file mode 100644 index 000000000..b8be557d2 Binary files /dev/null and b/docs/images/track-global-errors/stack-trace.jpg differ diff --git a/docs/plugin-apisauce.md b/docs/plugin-apisauce.md new file mode 100644 index 000000000..748656041 --- /dev/null +++ b/docs/plugin-apisauce.md @@ -0,0 +1,44 @@ +# reactotron-apisauce + +[Apisauce](http://github.com/skellock/apisauce) is a lightweight wrapper around the fantastic [Axios](https://github.com/mzabriskie/axios) networking library. + +![API Response](./images/apisauce/apisauce.jpg) + +# Installing + +`npm i --save-dev reactotron-apisauce` + + +# Configuring + +In the place where you setup your reactotron configuration, you import `reactotron-apisauce` plugin and throw it at Reactotron. + +```js +import apisaucePlugin from 'reactotron-apisauce' // <--- import + +// then plug it in when you configure Reactotron. + +Reactotron + .configure() + .use(apisaucePlugin()) // <-- here we go!!! + .connect() +``` + +Next, wherever you create your api for you application, bring in Reactotron and attach the monitor to your apisauce instance. + +```js +import Reactotron from 'reactotron-react-js' +// import Reactotron from 'reactotron-react-native' // or use this for mobile + +// Apisauce has a feature where you can attach a handler to watch +// all requests/response flowing through your api. You can hook this up: +api.addMonitor(Reactotron.apisauce) + +// or ... + +// if you just wanted to track on 500's +api.addMonitor(response => { + if (response.problem === 'SERVER_ERROR') + Reactotron.apisauce(response) +}) +``` diff --git a/docs/plugin-redux.md b/docs/plugin-redux.md new file mode 100644 index 000000000..2580a221c --- /dev/null +++ b/docs/plugin-redux.md @@ -0,0 +1,88 @@ +# reactotron-redux + +[Redux](http://redux.js.org/) is library for managing global state. It's pretty damn awesome. + +And everyone knows when you combine two great things, you get a super-awesome thing. Except for toothpaste & orange juice. Keep those separate. + +![Keys and Values](./images/redux/redux-keys-values.jpg) + +![Dispatching](./images/redux/dispatching.jpg) + +![Subscriptions](./images/redux/subscriptions.jpg) + + +# Installing + +`reactotron-redux` is a plugin which lives in a different npm package. You can install it by typing: + +``` +npm install --save-dev reactotron-redux +``` + +# Features + +* track when actions are dispatch including timing +* subscribe to changes within the state tree +* pull values out on demand +* view list of keys +* dispatch actions from Reactotron + +# Setting Up + +This plugin connects Reactotron to Redux via Redux's [Store Enhancer](http://redux.js.org/docs/Glossary.html#store-enhancer) plugin system. + +You'll configure where you setup your Redux store. In that file, we'll import both `reactotron-redux` and Reactotron. + +```js +import Reactotron from 'reactotron-react-js' +// import Reactotron from 'reactotron-react-native' // if on mobile +import createReactotronEnhancer from 'reactotron-redux' +``` + +`createReactotronEnhancer` is a function that creates an enhancer ready to inject into Redux. There are 2 parameters. + +1. `reactotronInstance` (required) - `Reactotron` itself. It's the object that came out of the import at the top. +2. `options` (optional) - An object providing configuration option to the store enhancer. + +Use take the return value and put that into your call to `createStore()`. + +**IMPORTANT: Your enhancer should go first if there are multiple enhancers.** + +Here's a few examples in action: + +```js +const reactotronEnhancer = createReactotronEnhancer(Reactotron) + +// where there are no other enhancers +createStore(rootReducer, reactotronEnhancer) + +// using Redux's compose() to bring together multiple enhancers +createStore(rootReducer, compose(reactotronEnhancer, applyMiddleware(logger, sagaMiddleware))) +``` + +See the demos for more examples. + +# Options + +`createReactotronEnhancer` supports options as the 2nd parameter. + +`except` is an array of strings that match actions flowing through Redux. + +If you have some actions you'd rather just not see (for example, `redux-saga`) +triggers a little bit of noise, you can suppress them: + +```js +createReactotronEnhancer(Reactotron, { + except: ['EFFECT_TRIGGERED', 'EFFECT_RESOLVED', 'EFFECT_REJECTED'] +}) +``` + +`isActionImportant` is a way to mark certain actions as "important". Important messages are display in a bolder style that gets your attention within Reactotron. + +It is a function that accepts the action and returns a `boolean`. `true` is important. `false` is normal. + +```js +createReactotronEnhancer(Reactotron, { + isActionImportant: action => action.type === 'FORMAT_HARD_DRIVE' +}) +``` diff --git a/docs/plugin-track-global-errors.md b/docs/plugin-track-global-errors.md new file mode 100644 index 000000000..1a01e36a4 --- /dev/null +++ b/docs/plugin-track-global-errors.md @@ -0,0 +1,84 @@ +# Track Global Errors + +Both `reactotron-react-native` and `reactotron-react-js` ship with a plugin called `trackGlobalErrors`. + +The goal of this plugin is to ensure all errors will get thrown over to Reactotron for display. + +![Installing The App](./images/track-global-errors/stack-trace.jpg) + + +# Usage + +Wherever you setup your Reactotron in your app, you also add the additional plugin on the `import` line. + +```js +import Reactotron, { trackGlobalErrors } from 'reactotron-react-native' +``` + +or + +```js +import Reactotron, { trackGlobalErrors } from 'reactotron-react-js' +``` + +Next, add it as a plugin to Reactotron. + +```js +Reactotron + .configure() + .use(trackGlobalErrors()) // <--- here we go! + .connect() +``` + +One option `trackGlobalErrors()` supports is `veto`. Veto is function that allows you to some frames you would like to leave out of the stack trace passed along. + +For example, on React Native, perhaps you'd like to leave off any frames sourced from React Native itself? + +```js +Reactotron + .configure() + .use(trackGlobalErrors({ + veto: frame => frame.fileName.indexOf('/node_modules/react-native/') >= 0 + })) + .connect() +``` + +`veto` is a function that takes an `object` and returns a `boolean`. `true` = ditch it. `false` = keep it. + +The frame object passed into `veto` has these properties. + +``` +functionName: the name of the function or null if an anonymous function +lineNumber: the line number of the error +columnNumber: the column number of the error +fileName: the name of the file +``` + +### React JS Source Maps + +Source maps for projects in webpack need to have the `devtool` set to `source-map`. On `create-react-app`-based apps, they use `eval`, so this will not work. You will have to switch your development webpack configuration to support this. + +You also have the option to not do source map lookups, but still pass errors along by going into offline mode. + +```js +Reactotron + .configure() + .use(trackGlobalErrors({ + offline: true + })) + .connect() +``` + + +# How It Works Internally + +### React JS + +It hijacks the browser's `window.onerror` event, immediately calling the previous `onerror`, then attempts to resolve the source of the errors via a source-map lookup. If successful, it throws a message over to Reactotron. + + +### React Native + +On React Native, it hooks `NativeModules.ExceptionsManager.updateExceptionMessage`. This is a message that occurs after the source map lookup for React Native. It always calls the original function so it won't break anything internally. Your Red Box will still show. + +Because we're hooking a Facebook internal function, this is a bit fragile. I'll stay on top of any React Native upgrades that might cause problems should the API change. diff --git a/docs/quick-start-react-js.md b/docs/quick-start-react-js.md new file mode 100644 index 000000000..28c6ebaa5 --- /dev/null +++ b/docs/quick-start-react-js.md @@ -0,0 +1,140 @@ +# Quick Start for React JS + +## Installing Reactotron.app + +Let’s [download the desktop app](https://github.com/reactotron/reactotron/releases/download/v0.94.0/Reactotron.app.zip) to start. It’s OS X only at this point, but will shortly make available on Windows and Linux. + +Unzip & run. + +![Installing The App](./images/quick-start-react-js/installing.jpg) + + +## Humble Beginnings + +Did you B.Y.O.App? Skip to the next section. + +Let’s use [create-react-app](https://github.com/facebookincubator/create-react-app) to bootstrap a new React JS app because, wow, is it fantastic. + +Download `create-react-app` if you haven't yet: +``` +npm i -g create-react-app +``` + +Then spin up a brand new React web app. +``` +create-react-app this-better-work +cd this-better-work +``` + +## Installing Reactotron + +Let's install Reactotron as a dev dependency. + +``` +npm i --save-dev reactotron-react-js +``` + +I like a separate file for initializing. Create `src/ReactotronConfig.js` in your editor of choice and paste this: + +```js +import Reactotron from 'reactotron-react-js' + +Reactotron + .configure() // we can use plugins here -- more on this later + .connect() // let's connect! +``` + +Finally, we import this on startup in `src/index.js` on line 1: + +```js +import './ReactotronConfig' +``` + +At this point, Reactotron is hooked up. + +Refresh your web page (or start it up `npm start`) and have a look at Reactotron now. Do you see the `CONNECTION` line? Click that to expand. + +![We Have Contact](./images/quick-start-react-js/first-connect.jpg) + + +Go back to your web page and refresh the web page 5 or 6 times. Now look. + +![Chatty](./images/quick-start-react-js/spammy.jpg) + +Pretty underwhelming huh? + + +## Hello World + +Let's do some classic programming. + +Open up `src/App.js`. + +At the top, let's put + +```js +import Reactotron from 'reactotron-react-js' +``` + +Next, inside the `render()` function, put this as the first line: + +```js +Reactotron.log('hello rendering world') +``` + +Save that file and refresh your web page if you don't have live reloading. + +Now Reactotron looks like this: + +![Hello 1](./images/quick-start-react-js/hello-1.jpg) + +While collapsed, the grey area to the right shows a preview. Click to open. + +![Hello 2](./images/quick-start-react-js/hello-2.jpg) + +Let's change our log statement to: + +```js +Reactotron.log({ numbers: [1, 2, 3], boolean: false, nested: { here: 'we go' } }) +``` + +Or this + +```js +Reactotron.warn('*glares*') +``` + +Or this + +```js +Reactotron.error('Now you\'ve done it.') +``` + +Or this + +```js +Reactotron.display({ + name: 'KNOCK KNOCK', + preview: 'Who\'s there?', + value: 'Orange.' +}) + +Reactotron.display({ + name: 'ORANGE', + preview: 'Who?', + value: 'Orange you glad you don\'t know me in real life?', + important: true +}) +``` + +## Now What? + +Well, at this point, we have a complicated version of `console.log`. + +Where Reactotron starts to shine is when you start plugging into Redux, tracking global errors, and watching network requests. + +Check out our [Demo](../packages/demo-react-js) for more goodies. + +![Demo Web App](./images/quick-start-react-js/react-demo-js.jpg) + +![Demo Reactotron](./images/quick-start-react-js/react-demo-js-reactotron.jpg) diff --git a/docs/quick-start-react-native.md b/docs/quick-start-react-native.md new file mode 100644 index 000000000..b30e145d2 --- /dev/null +++ b/docs/quick-start-react-native.md @@ -0,0 +1,140 @@ +# Quick Start for React Native + +## Installing Reactotron.app + +Let’s [download the desktop app](https://github.com/reactotron/reactotron/releases/download/v0.94.0/Reactotron.app.zip) to start. It’s OS X only at this point, but will shortly make available on Windows and Linux. + +Unzip & run. + +![Installing The App](./images/quick-start-react-js/installing.jpg) + + +## From Scratch + +Let's start a brand new app from scratch. If you want to use your own, skip to the next section. + +Download `react-native-cli` if you haven't yet: +``` +npm i -g react-native-cli +``` + +Then spin up a brand new React Native app. +``` +react-native init ReactotronDemo +cd ReactotronDemo +``` + +You'll need to run this in an emulator for Android or the simulator for iOS. Facebook has some [great guides](http://facebook.github.io/react-native/docs/getting-started.html#content) on getting started. + +## Installing Reactotron + +Let's install Reactotron as a dev dependency. + +``` +npm i --save-dev reactotron-react-native +``` + +I like a separate file for initializing. Create `ReactotronConfig.js` in your editor of choice and paste this: + +```js +import Reactotron from 'reactotron-react-native' + +Reactotron + .configure() // we can use plugins here -- more on this later + .connect() // let's connect! +``` + +Finally, we import this on startup in `index.ios.js` and `index.android.js` on line 1: + +```js +import './ReactotronConfig' +``` + +At this point, Reactotron is hooked up. + +Refresh your app (or start it up `react-native start`) and have a look at Reactotron now. Do you see the `CONNECTION` line? Click that to expand. + +![We Have Contact](./images/quick-start-react-native/first-connect.jpg) + + +Go back to your app and refresh it 5 or 6 times. Now look. + +![Chatty](./images/quick-start-react-native/spammy.jpg) + +Pretty underwhelming huh? + + +## Hello World + +Let's do some classic programming. + +Open up `index.ios.js` or `index.android.js`. + +Right after the line you just added in the previous step lets put this: + +```js +import Reactotron from 'reactotron-react-native' +``` + +Next, inside the `render()` function, put this as the first line: + +```js +Reactotron.log('hello rendering world') +``` + +Save that file and refresh your web page if you don't have live reloading. + +Now Reactotron looks like this: + +![Hello 1](./images/quick-start-react-native/hello-1.jpg) + +While collapsed, the grey area to the right shows a preview. Click to open. + +![Hello 2](./images/quick-start-react-native/hello-2.jpg) + +Let's change our log statement to: + +```js +Reactotron.log({ numbers: [1, 2, 3], boolean: false, nested: { here: 'we go' } }) +``` + +Or this + +```js +Reactotron.warn('*glares*') +``` + +Or this + +```js +Reactotron.error('Now you\'ve done it.') +``` + +Or this + +```js +Reactotron.display({ + name: 'KNOCK KNOCK', + preview: 'Who\'s there?', + value: 'Orange.' +}) + +Reactotron.display({ + name: 'ORANGE', + preview: 'Who?', + value: 'Orange you glad you don\'t know me in real life?', + important: true +}) +``` + +## Now What? + +Well, at this point, we have a complicated version of `console.log`. + +Where Reactotron starts to shine is when you start plugging into Redux, tracking global errors, and watching network requests. + +Check out our [Demo](../packages/demo-react-native) for more goodies. + +![Demo Native App](./images/quick-start-react-native/react-demo-native.jpg) + +![Demo Reactotron](./images/quick-start-react-native/react-demo-native-reactotron.jpg) diff --git a/examples/ReactNativeExample/App/Config/ReactotronConfig.js b/examples/ReactNativeExample/App/Config/ReactotronConfig.js deleted file mode 100644 index 8c0602061..000000000 --- a/examples/ReactNativeExample/App/Config/ReactotronConfig.js +++ /dev/null @@ -1,9 +0,0 @@ -import Reactotron from '../../client' // in a real app, you would use 'reactotron' -import {Platform} from 'react-native' - -Reactotron.connect({ - enabled: true, - name: 'ReactNativeExample', - userAgent: Platform.OS -}) - diff --git a/examples/ReactNativeExample/App/Containers/RootContainer.js b/examples/ReactNativeExample/App/Containers/RootContainer.js deleted file mode 100644 index c0f644e9b..000000000 --- a/examples/ReactNativeExample/App/Containers/RootContainer.js +++ /dev/null @@ -1,57 +0,0 @@ -import React, { View, Text, TouchableOpacity } from 'react-native' -import { connect } from 'react-redux' -import Actions from '../Actions/Creators' -import Styles from './Styles/RootContainerStyles' -import Reactotron from '../../client' // in a real app, you would use 'reactotron' - -export default class RootContainer extends React.Component { - - constructor (props) { - super(props) - this.handlePress = this.handlePress.bind(this) - } - - handlePress () { - const {dispatch} = this.props - Reactotron.log('A touchable was pressed.🔥🦄') - dispatch(Actions.requestTemperature('Toronto')) - } - - componentWillMount () { - const { dispatch } = this.props - dispatch(Actions.startup()) - } - -// componentDidMount () { -// navigator.geolocation.getCurrentPosition( -// (position) => Reactotron.log(position), -// (error) => alert(error.message), -// {enableHighAccuracy: true, timeout: 20000, maximumAge: 1000} -// ) -// } - - render () { - const {city, temperature, fetching} = this.props - return ( - - - - {`The weather in ${city} is ${fetching ? 'loading' : temperature}.`} - - - - ) - } - -} - -const mapStateToProps = (state) => { - return { - city: state.weather.city, - temperature: state.weather.temperature, - fetching: state.weather.fetching - } -} - -export default connect(mapStateToProps)(RootContainer) - diff --git a/examples/ReactNativeExample/App/Sagas/WeatherSaga.js b/examples/ReactNativeExample/App/Sagas/WeatherSaga.js deleted file mode 100644 index e85a28ca4..000000000 --- a/examples/ReactNativeExample/App/Sagas/WeatherSaga.js +++ /dev/null @@ -1,42 +0,0 @@ -import { take, call, put } from 'redux-saga/effects' -import RS from 'ramdasauce' -import Types from '../Actions/Types' -import Actions from '../Actions/Creators' -import Reactotron from '../../client' // normally you would use 'reactotron' - -const SCALE = 'C' - -export function * getWeather (api, city) { - const bench = Reactotron.bench('weather check') - const response = yield call(api.get, '/find/name', { q: city }) - bench.step('after api') - if (response.ok) { - const kelvin = RS.dotPath('data.list.0.main.temp', response) - const celcius = kelvin - 273.15 - const farenheit = (celcius * 1.8000) + 32 - - bench.step('after mathy things') - if (SCALE === 'F') { - yield put(Actions.receiveTemperature(Math.round(farenheit))) - } else { - yield put(Actions.receiveTemperature(Math.round(celcius))) - } - } else { - yield put(Actions.receiveTemperatureFailure()) - } - bench.stop() -} - -export default (api) => { - function * watchWeatherRequest () { - while (true) { - const action = yield take(Types.TEMPERATURE_REQUEST) - const { city } = action - yield call(getWeather, api, city) - } - } - - return { - watchWeatherRequest - } -} diff --git a/examples/ReactNativeExample/App/Store/Store.js b/examples/ReactNativeExample/App/Store/Store.js deleted file mode 100644 index f1f05dc9f..000000000 --- a/examples/ReactNativeExample/App/Store/Store.js +++ /dev/null @@ -1,31 +0,0 @@ -import {createStore, applyMiddleware, compose} from 'redux' -import Config from '../Config/Config' -import createLogger from 'redux-logger' -import rootReducer from '../Reducers/' -import sagaMiddleware from 'redux-saga' -import sagas from '../Sagas/' -import R from 'ramda' -import Reactotron from '../../client' // in a real app, you would use 'reactotron' - -// the logger master switch -const USE_LOGGING = Config.sagas.logging -// silence these saga-based messages -const SAGA_LOGGING_BLACKLIST = ['EFFECT_TRIGGERED', 'EFFECT_RESOLVED', 'EFFECT_REJECTED'] -// creat the logger -const logger = createLogger({ - predicate: (getState, { type }) => USE_LOGGING && R.not(R.contains(type, SAGA_LOGGING_BLACKLIST)), - stateTransformer: (state) => R.map((v) => v.asMutable({deep: true}), state) -}) - -// a function which can create our store and auto-persist the data -export default () => { - const enhancer = compose( - applyMiddleware( - logger, - sagaMiddleware(...sagas) - ), - Reactotron.storeEnhancer() - ) - - return createStore(rootReducer, enhancer) -} diff --git a/examples/ReactNativeWebExample/App/Containers/Styles/RootContainerStyles.js b/examples/ReactNativeWebExample/App/Containers/Styles/RootContainerStyles.js deleted file mode 100644 index ad9513e1e..000000000 --- a/examples/ReactNativeWebExample/App/Containers/Styles/RootContainerStyles.js +++ /dev/null @@ -1,14 +0,0 @@ -import {StyleSheet} from 'react-native' - -export default StyleSheet.create({ - container: { - flex: 1, - justifyContent: 'center', - alignItems: 'center' - }, - welcome: { - textAlign: 'center', - padding: 50, - fontSize: 25 - } -}) diff --git a/examples/ReactNativeWebExample/App/Reducers/CreateReducer.js b/examples/ReactNativeWebExample/App/Reducers/CreateReducer.js deleted file mode 100644 index 42ce745f1..000000000 --- a/examples/ReactNativeWebExample/App/Reducers/CreateReducer.js +++ /dev/null @@ -1,11 +0,0 @@ -/** - Creates a reducer. - @param {string} initialState - The initial state for this reducer. - @param {object} handlers - Keys are action types (strings), values are reducers (functions). - @return {object} A reducer object. - */ -export default (initialState = null, handlers = {}) => (state = initialState, action) => { - if (!action && !action.type) return state - const handler = handlers[action.type] - return handler && handler(state, action) || state -} diff --git a/examples/ReactNativeWebExample/App/Reducers/WeatherReducer.js b/examples/ReactNativeWebExample/App/Reducers/WeatherReducer.js deleted file mode 100644 index a1bdaf75b..000000000 --- a/examples/ReactNativeWebExample/App/Reducers/WeatherReducer.js +++ /dev/null @@ -1,43 +0,0 @@ -import Types from '../Actions/Types' -import Immutable from 'seamless-immutable' -import createReducer from './CreateReducer' - -export const INITIAL_STATE = Immutable({ - temperature: null, - fetching: false, - error: null, - city: null -}) - -// request temp -const request = (state, action) => - state.merge({ - fetching: true, - city: action.city, - temperature: null - }) - -// receive temp -const receive = (state, action) => - state.merge({ - fetching: false, - error: null, - temperature: action.temperature - }) - -// temp failure -const failure = (state, action) => - state.merge({ - fetching: false, - error: true, - temperature: null - }) - -// map our types to our handlers -const ACTION_HANDLERS = { - [Types.TEMPERATURE_REQUEST]: request, - [Types.TEMPERATURE_RECEIVE]: receive, - [Types.TEMPERATURE_FAILURE]: failure -} - -export default createReducer(INITIAL_STATE, ACTION_HANDLERS) diff --git a/examples/ReactNativeWebExample/App/Reducers/index.js b/examples/ReactNativeWebExample/App/Reducers/index.js deleted file mode 100644 index 78733fef3..000000000 --- a/examples/ReactNativeWebExample/App/Reducers/index.js +++ /dev/null @@ -1,7 +0,0 @@ -import { combineReducers } from 'redux' -import WeatherReducer from './WeatherReducer' - -// glue all the reducers together into 1 root reducer -export default combineReducers({ - weather: WeatherReducer -}) diff --git a/examples/ReactNativeWebExample/App/Sagas/StartupSaga.js b/examples/ReactNativeWebExample/App/Sagas/StartupSaga.js deleted file mode 100644 index 98ded7b15..000000000 --- a/examples/ReactNativeWebExample/App/Sagas/StartupSaga.js +++ /dev/null @@ -1,16 +0,0 @@ -import { take, put, select } from 'redux-saga/effects' -import Types from '../Actions/Types' -import Actions from '../Actions/Creators' -import R from 'ramda' - -// process STARTUP actions -export function * watchStartup () { - while (true) { - yield take(Types.STARTUP) - const temp = yield select((state) => state.weather.temperature) - // only fetch new temps when we don't have one yet - if (!R.is(Number, temp)) { - yield put(Actions.requestTemperature('San Francisco')) - } - } -} diff --git a/examples/ReactNativeWebExample/App/Sagas/index.js b/examples/ReactNativeWebExample/App/Sagas/index.js deleted file mode 100644 index 0006d30f3..000000000 --- a/examples/ReactNativeWebExample/App/Sagas/index.js +++ /dev/null @@ -1,19 +0,0 @@ -import ApiSauce from 'apisauce' -import { watchStartup } from './StartupSaga' -import WeatherSaga from './WeatherSaga' -import Reactotron from '../../client' // in a real app, you would use 'reactotron' - -const api = ApiSauce.create({ - baseURL: 'http://openweathermap.org/data/2.1' -}) -api.addMonitor((response) => { - Reactotron.apiLog(response) -}) - -const {watchWeatherRequest} = WeatherSaga(api) - -// start the daemons -export default [ - watchStartup, - watchWeatherRequest -] diff --git a/.babelrc b/legacy/.babelrc similarity index 100% rename from .babelrc rename to legacy/.babelrc diff --git a/legacy/.gitignore b/legacy/.gitignore new file mode 100644 index 000000000..88602cb40 --- /dev/null +++ b/legacy/.gitignore @@ -0,0 +1,5 @@ +npm-debug.log +node_modules +docs +.tern-project +.tern-config diff --git a/.jsdoc.json b/legacy/.jsdoc.json similarity index 100% rename from .jsdoc.json rename to legacy/.jsdoc.json diff --git a/.npmignore b/legacy/.npmignore similarity index 100% rename from .npmignore rename to legacy/.npmignore diff --git a/CHANGES.md b/legacy/CHANGES.md similarity index 100% rename from CHANGES.md rename to legacy/CHANGES.md diff --git a/README.md b/legacy/README.md similarity index 100% rename from README.md rename to legacy/README.md diff --git a/bin/reactotron.js b/legacy/bin/reactotron.js similarity index 100% rename from bin/reactotron.js rename to legacy/bin/reactotron.js diff --git a/bump_client.sh b/legacy/bump_client.sh similarity index 100% rename from bump_client.sh rename to legacy/bump_client.sh diff --git a/client/client.js b/legacy/client/client.js similarity index 100% rename from client/client.js rename to legacy/client/client.js diff --git a/dist/client.js b/legacy/dist/client.js similarity index 100% rename from dist/client.js rename to legacy/dist/client.js diff --git a/dist/index.js b/legacy/dist/index.js similarity index 100% rename from dist/index.js rename to legacy/dist/index.js diff --git a/examples/README.md b/legacy/examples/README.md similarity index 100% rename from examples/README.md rename to legacy/examples/README.md diff --git a/examples/ReactDomExample/.gitignore b/legacy/examples/ReactDomExample/.gitignore similarity index 100% rename from examples/ReactDomExample/.gitignore rename to legacy/examples/ReactDomExample/.gitignore diff --git a/examples/ReactDomExample/App/Actions/CreateAction.js b/legacy/examples/ReactDomExample/App/Actions/CreateAction.js similarity index 100% rename from examples/ReactDomExample/App/Actions/CreateAction.js rename to legacy/examples/ReactDomExample/App/Actions/CreateAction.js diff --git a/examples/ReactDomExample/App/Actions/Creators.js b/legacy/examples/ReactDomExample/App/Actions/Creators.js similarity index 100% rename from examples/ReactDomExample/App/Actions/Creators.js rename to legacy/examples/ReactDomExample/App/Actions/Creators.js diff --git a/examples/ReactDomExample/App/Actions/Types.js b/legacy/examples/ReactDomExample/App/Actions/Types.js similarity index 100% rename from examples/ReactDomExample/App/Actions/Types.js rename to legacy/examples/ReactDomExample/App/Actions/Types.js diff --git a/examples/ReactDomExample/App/App.js b/legacy/examples/ReactDomExample/App/App.js similarity index 100% rename from examples/ReactDomExample/App/App.js rename to legacy/examples/ReactDomExample/App/App.js diff --git a/examples/ReactDomExample/App/Config/Config.js b/legacy/examples/ReactDomExample/App/Config/Config.js similarity index 100% rename from examples/ReactDomExample/App/Config/Config.js rename to legacy/examples/ReactDomExample/App/Config/Config.js diff --git a/examples/ReactDomExample/App/Config/ReactotronConfig.js b/legacy/examples/ReactDomExample/App/Config/ReactotronConfig.js similarity index 100% rename from examples/ReactDomExample/App/Config/ReactotronConfig.js rename to legacy/examples/ReactDomExample/App/Config/ReactotronConfig.js diff --git a/examples/ReactDomExample/App/Reducers/CreateReducer.js b/legacy/examples/ReactDomExample/App/Reducers/CreateReducer.js similarity index 100% rename from examples/ReactDomExample/App/Reducers/CreateReducer.js rename to legacy/examples/ReactDomExample/App/Reducers/CreateReducer.js diff --git a/examples/ReactDomExample/App/Reducers/GithubReducer.js b/legacy/examples/ReactDomExample/App/Reducers/GithubReducer.js similarity index 100% rename from examples/ReactDomExample/App/Reducers/GithubReducer.js rename to legacy/examples/ReactDomExample/App/Reducers/GithubReducer.js diff --git a/examples/ReactDomExample/App/Reducers/index.js b/legacy/examples/ReactDomExample/App/Reducers/index.js similarity index 100% rename from examples/ReactDomExample/App/Reducers/index.js rename to legacy/examples/ReactDomExample/App/Reducers/index.js diff --git a/examples/ReactDomExample/App/Root.js b/legacy/examples/ReactDomExample/App/Root.js similarity index 100% rename from examples/ReactDomExample/App/Root.js rename to legacy/examples/ReactDomExample/App/Root.js diff --git a/examples/ReactDomExample/App/Sagas/GithubSaga.js b/legacy/examples/ReactDomExample/App/Sagas/GithubSaga.js similarity index 100% rename from examples/ReactDomExample/App/Sagas/GithubSaga.js rename to legacy/examples/ReactDomExample/App/Sagas/GithubSaga.js diff --git a/examples/ReactDomExample/App/Sagas/StartupSaga.js b/legacy/examples/ReactDomExample/App/Sagas/StartupSaga.js similarity index 100% rename from examples/ReactDomExample/App/Sagas/StartupSaga.js rename to legacy/examples/ReactDomExample/App/Sagas/StartupSaga.js diff --git a/examples/ReactDomExample/App/Sagas/index.js b/legacy/examples/ReactDomExample/App/Sagas/index.js similarity index 100% rename from examples/ReactDomExample/App/Sagas/index.js rename to legacy/examples/ReactDomExample/App/Sagas/index.js diff --git a/examples/ReactDomExample/App/Store/Store.js b/legacy/examples/ReactDomExample/App/Store/Store.js similarity index 100% rename from examples/ReactDomExample/App/Store/Store.js rename to legacy/examples/ReactDomExample/App/Store/Store.js diff --git a/examples/ReactDomExample/App/index.js b/legacy/examples/ReactDomExample/App/index.js similarity index 100% rename from examples/ReactDomExample/App/index.js rename to legacy/examples/ReactDomExample/App/index.js diff --git a/examples/ReactDomExample/index.html b/legacy/examples/ReactDomExample/index.html similarity index 100% rename from examples/ReactDomExample/index.html rename to legacy/examples/ReactDomExample/index.html diff --git a/examples/ReactDomExample/package.json b/legacy/examples/ReactDomExample/package.json similarity index 100% rename from examples/ReactDomExample/package.json rename to legacy/examples/ReactDomExample/package.json diff --git a/examples/ReactDomExample/server.js b/legacy/examples/ReactDomExample/server.js similarity index 100% rename from examples/ReactDomExample/server.js rename to legacy/examples/ReactDomExample/server.js diff --git a/examples/ReactDomExample/webpack.config.js b/legacy/examples/ReactDomExample/webpack.config.js similarity index 100% rename from examples/ReactDomExample/webpack.config.js rename to legacy/examples/ReactDomExample/webpack.config.js diff --git a/examples/ReactNativeExample/.buckconfig b/legacy/examples/ReactNativeExample/.buckconfig similarity index 100% rename from examples/ReactNativeExample/.buckconfig rename to legacy/examples/ReactNativeExample/.buckconfig diff --git a/examples/ReactNativeExample/.flowconfig b/legacy/examples/ReactNativeExample/.flowconfig similarity index 100% rename from examples/ReactNativeExample/.flowconfig rename to legacy/examples/ReactNativeExample/.flowconfig diff --git a/examples/ReactNativeExample/.gitignore b/legacy/examples/ReactNativeExample/.gitignore similarity index 100% rename from examples/ReactNativeExample/.gitignore rename to legacy/examples/ReactNativeExample/.gitignore diff --git a/examples/ReactNativeExample/.watchmanconfig b/legacy/examples/ReactNativeExample/.watchmanconfig similarity index 100% rename from examples/ReactNativeExample/.watchmanconfig rename to legacy/examples/ReactNativeExample/.watchmanconfig diff --git a/examples/ReactNativeExample/android/app/BUCK b/legacy/examples/ReactNativeExample/android/app/BUCK similarity index 100% rename from examples/ReactNativeExample/android/app/BUCK rename to legacy/examples/ReactNativeExample/android/app/BUCK diff --git a/examples/ReactNativeExample/android/app/build.gradle b/legacy/examples/ReactNativeExample/android/app/build.gradle similarity index 100% rename from examples/ReactNativeExample/android/app/build.gradle rename to legacy/examples/ReactNativeExample/android/app/build.gradle diff --git a/examples/ReactNativeExample/android/app/proguard-rules.pro b/legacy/examples/ReactNativeExample/android/app/proguard-rules.pro similarity index 100% rename from examples/ReactNativeExample/android/app/proguard-rules.pro rename to legacy/examples/ReactNativeExample/android/app/proguard-rules.pro diff --git a/examples/ReactNativeExample/android/app/src/main/AndroidManifest.xml b/legacy/examples/ReactNativeExample/android/app/src/main/AndroidManifest.xml similarity index 100% rename from examples/ReactNativeExample/android/app/src/main/AndroidManifest.xml rename to legacy/examples/ReactNativeExample/android/app/src/main/AndroidManifest.xml diff --git a/examples/ReactNativeExample/android/app/src/main/java/com/reactnativeexample/MainActivity.java b/legacy/examples/ReactNativeExample/android/app/src/main/java/com/reactnativeexample/MainActivity.java similarity index 100% rename from examples/ReactNativeExample/android/app/src/main/java/com/reactnativeexample/MainActivity.java rename to legacy/examples/ReactNativeExample/android/app/src/main/java/com/reactnativeexample/MainActivity.java diff --git a/examples/ReactNativeExample/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/legacy/examples/ReactNativeExample/android/app/src/main/res/mipmap-hdpi/ic_launcher.png similarity index 100% rename from examples/ReactNativeExample/android/app/src/main/res/mipmap-hdpi/ic_launcher.png rename to legacy/examples/ReactNativeExample/android/app/src/main/res/mipmap-hdpi/ic_launcher.png diff --git a/examples/ReactNativeExample/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/legacy/examples/ReactNativeExample/android/app/src/main/res/mipmap-mdpi/ic_launcher.png similarity index 100% rename from examples/ReactNativeExample/android/app/src/main/res/mipmap-mdpi/ic_launcher.png rename to legacy/examples/ReactNativeExample/android/app/src/main/res/mipmap-mdpi/ic_launcher.png diff --git a/examples/ReactNativeExample/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/legacy/examples/ReactNativeExample/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png similarity index 100% rename from examples/ReactNativeExample/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png rename to legacy/examples/ReactNativeExample/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png diff --git a/examples/ReactNativeExample/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/legacy/examples/ReactNativeExample/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png similarity index 100% rename from examples/ReactNativeExample/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png rename to legacy/examples/ReactNativeExample/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png diff --git a/examples/ReactNativeExample/android/app/src/main/res/values/strings.xml b/legacy/examples/ReactNativeExample/android/app/src/main/res/values/strings.xml similarity index 100% rename from examples/ReactNativeExample/android/app/src/main/res/values/strings.xml rename to legacy/examples/ReactNativeExample/android/app/src/main/res/values/strings.xml diff --git a/examples/ReactNativeExample/android/app/src/main/res/values/styles.xml b/legacy/examples/ReactNativeExample/android/app/src/main/res/values/styles.xml similarity index 100% rename from examples/ReactNativeExample/android/app/src/main/res/values/styles.xml rename to legacy/examples/ReactNativeExample/android/app/src/main/res/values/styles.xml diff --git a/examples/ReactNativeExample/android/build.gradle b/legacy/examples/ReactNativeExample/android/build.gradle similarity index 100% rename from examples/ReactNativeExample/android/build.gradle rename to legacy/examples/ReactNativeExample/android/build.gradle diff --git a/examples/ReactNativeExample/android/gradle.properties b/legacy/examples/ReactNativeExample/android/gradle.properties similarity index 100% rename from examples/ReactNativeExample/android/gradle.properties rename to legacy/examples/ReactNativeExample/android/gradle.properties diff --git a/examples/ReactNativeExample/android/gradle/wrapper/gradle-wrapper.jar b/legacy/examples/ReactNativeExample/android/gradle/wrapper/gradle-wrapper.jar similarity index 100% rename from examples/ReactNativeExample/android/gradle/wrapper/gradle-wrapper.jar rename to legacy/examples/ReactNativeExample/android/gradle/wrapper/gradle-wrapper.jar diff --git a/examples/ReactNativeExample/android/gradle/wrapper/gradle-wrapper.properties b/legacy/examples/ReactNativeExample/android/gradle/wrapper/gradle-wrapper.properties similarity index 100% rename from examples/ReactNativeExample/android/gradle/wrapper/gradle-wrapper.properties rename to legacy/examples/ReactNativeExample/android/gradle/wrapper/gradle-wrapper.properties diff --git a/examples/ReactNativeExample/android/gradlew b/legacy/examples/ReactNativeExample/android/gradlew similarity index 100% rename from examples/ReactNativeExample/android/gradlew rename to legacy/examples/ReactNativeExample/android/gradlew diff --git a/examples/ReactNativeExample/android/gradlew.bat b/legacy/examples/ReactNativeExample/android/gradlew.bat similarity index 100% rename from examples/ReactNativeExample/android/gradlew.bat rename to legacy/examples/ReactNativeExample/android/gradlew.bat diff --git a/examples/ReactNativeExample/android/keystores/BUCK b/legacy/examples/ReactNativeExample/android/keystores/BUCK similarity index 100% rename from examples/ReactNativeExample/android/keystores/BUCK rename to legacy/examples/ReactNativeExample/android/keystores/BUCK diff --git a/examples/ReactNativeExample/android/keystores/debug.keystore.properties b/legacy/examples/ReactNativeExample/android/keystores/debug.keystore.properties similarity index 100% rename from examples/ReactNativeExample/android/keystores/debug.keystore.properties rename to legacy/examples/ReactNativeExample/android/keystores/debug.keystore.properties diff --git a/examples/ReactNativeExample/android/settings.gradle b/legacy/examples/ReactNativeExample/android/settings.gradle similarity index 100% rename from examples/ReactNativeExample/android/settings.gradle rename to legacy/examples/ReactNativeExample/android/settings.gradle diff --git a/examples/ReactNativeExample/ios/ReactNativeExample.xcodeproj/project.pbxproj b/legacy/examples/ReactNativeExample/ios/ReactNativeExample.xcodeproj/project.pbxproj similarity index 100% rename from examples/ReactNativeExample/ios/ReactNativeExample.xcodeproj/project.pbxproj rename to legacy/examples/ReactNativeExample/ios/ReactNativeExample.xcodeproj/project.pbxproj diff --git a/examples/ReactNativeExample/ios/ReactNativeExample.xcodeproj/xcshareddata/xcschemes/ReactNativeExample.xcscheme b/legacy/examples/ReactNativeExample/ios/ReactNativeExample.xcodeproj/xcshareddata/xcschemes/ReactNativeExample.xcscheme similarity index 100% rename from examples/ReactNativeExample/ios/ReactNativeExample.xcodeproj/xcshareddata/xcschemes/ReactNativeExample.xcscheme rename to legacy/examples/ReactNativeExample/ios/ReactNativeExample.xcodeproj/xcshareddata/xcschemes/ReactNativeExample.xcscheme diff --git a/examples/ReactNativeExample/ios/ReactNativeExample/AppDelegate.h b/legacy/examples/ReactNativeExample/ios/ReactNativeExample/AppDelegate.h similarity index 100% rename from examples/ReactNativeExample/ios/ReactNativeExample/AppDelegate.h rename to legacy/examples/ReactNativeExample/ios/ReactNativeExample/AppDelegate.h diff --git a/examples/ReactNativeExample/ios/ReactNativeExample/AppDelegate.m b/legacy/examples/ReactNativeExample/ios/ReactNativeExample/AppDelegate.m similarity index 100% rename from examples/ReactNativeExample/ios/ReactNativeExample/AppDelegate.m rename to legacy/examples/ReactNativeExample/ios/ReactNativeExample/AppDelegate.m diff --git a/examples/ReactNativeExample/ios/ReactNativeExample/Base.lproj/LaunchScreen.xib b/legacy/examples/ReactNativeExample/ios/ReactNativeExample/Base.lproj/LaunchScreen.xib similarity index 100% rename from examples/ReactNativeExample/ios/ReactNativeExample/Base.lproj/LaunchScreen.xib rename to legacy/examples/ReactNativeExample/ios/ReactNativeExample/Base.lproj/LaunchScreen.xib diff --git a/examples/ReactNativeExample/ios/ReactNativeExample/Images.xcassets/AppIcon.appiconset/Contents.json b/legacy/examples/ReactNativeExample/ios/ReactNativeExample/Images.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from examples/ReactNativeExample/ios/ReactNativeExample/Images.xcassets/AppIcon.appiconset/Contents.json rename to legacy/examples/ReactNativeExample/ios/ReactNativeExample/Images.xcassets/AppIcon.appiconset/Contents.json diff --git a/examples/ReactNativeExample/ios/ReactNativeExample/Info.plist b/legacy/examples/ReactNativeExample/ios/ReactNativeExample/Info.plist similarity index 100% rename from examples/ReactNativeExample/ios/ReactNativeExample/Info.plist rename to legacy/examples/ReactNativeExample/ios/ReactNativeExample/Info.plist diff --git a/examples/ReactNativeExample/ios/ReactNativeExample/main.m b/legacy/examples/ReactNativeExample/ios/ReactNativeExample/main.m similarity index 100% rename from examples/ReactNativeExample/ios/ReactNativeExample/main.m rename to legacy/examples/ReactNativeExample/ios/ReactNativeExample/main.m diff --git a/examples/ReactNativeExample/ios/ReactNativeExampleTests/Info.plist b/legacy/examples/ReactNativeExample/ios/ReactNativeExampleTests/Info.plist similarity index 100% rename from examples/ReactNativeExample/ios/ReactNativeExampleTests/Info.plist rename to legacy/examples/ReactNativeExample/ios/ReactNativeExampleTests/Info.plist diff --git a/examples/ReactNativeExample/ios/ReactNativeExampleTests/ReactNativeExampleTests.m b/legacy/examples/ReactNativeExample/ios/ReactNativeExampleTests/ReactNativeExampleTests.m similarity index 100% rename from examples/ReactNativeExample/ios/ReactNativeExampleTests/ReactNativeExampleTests.m rename to legacy/examples/ReactNativeExample/ios/ReactNativeExampleTests/ReactNativeExampleTests.m diff --git a/examples/ReactNativeExample/package.json b/legacy/examples/ReactNativeExample/package.json similarity index 100% rename from examples/ReactNativeExample/package.json rename to legacy/examples/ReactNativeExample/package.json diff --git a/examples/ReactNativeWebExample/.buckconfig b/legacy/examples/ReactNativeWebExample/.buckconfig similarity index 100% rename from examples/ReactNativeWebExample/.buckconfig rename to legacy/examples/ReactNativeWebExample/.buckconfig diff --git a/examples/ReactNativeWebExample/.flowconfig b/legacy/examples/ReactNativeWebExample/.flowconfig similarity index 100% rename from examples/ReactNativeWebExample/.flowconfig rename to legacy/examples/ReactNativeWebExample/.flowconfig diff --git a/examples/ReactNativeWebExample/.gitignore b/legacy/examples/ReactNativeWebExample/.gitignore similarity index 100% rename from examples/ReactNativeWebExample/.gitignore rename to legacy/examples/ReactNativeWebExample/.gitignore diff --git a/examples/ReactNativeWebExample/.watchmanconfig b/legacy/examples/ReactNativeWebExample/.watchmanconfig similarity index 100% rename from examples/ReactNativeWebExample/.watchmanconfig rename to legacy/examples/ReactNativeWebExample/.watchmanconfig diff --git a/examples/ReactNativeExample/App/Actions/CreateAction.js b/legacy/examples/ReactNativeWebExample/App/Actions/CreateAction.js similarity index 100% rename from examples/ReactNativeExample/App/Actions/CreateAction.js rename to legacy/examples/ReactNativeWebExample/App/Actions/CreateAction.js diff --git a/examples/ReactNativeExample/App/Actions/Creators.js b/legacy/examples/ReactNativeWebExample/App/Actions/Creators.js similarity index 100% rename from examples/ReactNativeExample/App/Actions/Creators.js rename to legacy/examples/ReactNativeWebExample/App/Actions/Creators.js diff --git a/examples/ReactNativeWebExample/App/Actions/Types.js b/legacy/examples/ReactNativeWebExample/App/Actions/Types.js similarity index 100% rename from examples/ReactNativeWebExample/App/Actions/Types.js rename to legacy/examples/ReactNativeWebExample/App/Actions/Types.js diff --git a/examples/ReactNativeExample/App/Config/Config.js b/legacy/examples/ReactNativeWebExample/App/Config/Config.js similarity index 100% rename from examples/ReactNativeExample/App/Config/Config.js rename to legacy/examples/ReactNativeWebExample/App/Config/Config.js diff --git a/examples/ReactNativeWebExample/App/Config/ReactotronConfig.js b/legacy/examples/ReactNativeWebExample/App/Config/ReactotronConfig.js similarity index 100% rename from examples/ReactNativeWebExample/App/Config/ReactotronConfig.js rename to legacy/examples/ReactNativeWebExample/App/Config/ReactotronConfig.js diff --git a/examples/ReactNativeExample/App/Containers/ReduxContainer.js b/legacy/examples/ReactNativeWebExample/App/Containers/ReduxContainer.js similarity index 100% rename from examples/ReactNativeExample/App/Containers/ReduxContainer.js rename to legacy/examples/ReactNativeWebExample/App/Containers/ReduxContainer.js diff --git a/examples/ReactNativeWebExample/App/Containers/RootContainer.js b/legacy/examples/ReactNativeWebExample/App/Containers/RootContainer.js similarity index 100% rename from examples/ReactNativeWebExample/App/Containers/RootContainer.js rename to legacy/examples/ReactNativeWebExample/App/Containers/RootContainer.js diff --git a/examples/ReactNativeExample/App/Containers/Styles/RootContainerStyles.js b/legacy/examples/ReactNativeWebExample/App/Containers/Styles/RootContainerStyles.js similarity index 100% rename from examples/ReactNativeExample/App/Containers/Styles/RootContainerStyles.js rename to legacy/examples/ReactNativeWebExample/App/Containers/Styles/RootContainerStyles.js diff --git a/examples/ReactNativeExample/App/Reducers/CreateReducer.js b/legacy/examples/ReactNativeWebExample/App/Reducers/CreateReducer.js similarity index 100% rename from examples/ReactNativeExample/App/Reducers/CreateReducer.js rename to legacy/examples/ReactNativeWebExample/App/Reducers/CreateReducer.js diff --git a/examples/ReactNativeExample/App/Reducers/WeatherReducer.js b/legacy/examples/ReactNativeWebExample/App/Reducers/WeatherReducer.js similarity index 100% rename from examples/ReactNativeExample/App/Reducers/WeatherReducer.js rename to legacy/examples/ReactNativeWebExample/App/Reducers/WeatherReducer.js diff --git a/examples/ReactNativeExample/App/Reducers/index.js b/legacy/examples/ReactNativeWebExample/App/Reducers/index.js similarity index 100% rename from examples/ReactNativeExample/App/Reducers/index.js rename to legacy/examples/ReactNativeWebExample/App/Reducers/index.js diff --git a/examples/ReactNativeExample/App/Sagas/StartupSaga.js b/legacy/examples/ReactNativeWebExample/App/Sagas/StartupSaga.js similarity index 100% rename from examples/ReactNativeExample/App/Sagas/StartupSaga.js rename to legacy/examples/ReactNativeWebExample/App/Sagas/StartupSaga.js diff --git a/examples/ReactNativeWebExample/App/Sagas/WeatherSaga.js b/legacy/examples/ReactNativeWebExample/App/Sagas/WeatherSaga.js similarity index 100% rename from examples/ReactNativeWebExample/App/Sagas/WeatherSaga.js rename to legacy/examples/ReactNativeWebExample/App/Sagas/WeatherSaga.js diff --git a/examples/ReactNativeExample/App/Sagas/index.js b/legacy/examples/ReactNativeWebExample/App/Sagas/index.js similarity index 100% rename from examples/ReactNativeExample/App/Sagas/index.js rename to legacy/examples/ReactNativeWebExample/App/Sagas/index.js diff --git a/examples/ReactNativeWebExample/App/Store/Store.js b/legacy/examples/ReactNativeWebExample/App/Store/Store.js similarity index 100% rename from examples/ReactNativeWebExample/App/Store/Store.js rename to legacy/examples/ReactNativeWebExample/App/Store/Store.js diff --git a/examples/ReactNativeWebExample/android/app/BUCK b/legacy/examples/ReactNativeWebExample/android/app/BUCK similarity index 100% rename from examples/ReactNativeWebExample/android/app/BUCK rename to legacy/examples/ReactNativeWebExample/android/app/BUCK diff --git a/examples/ReactNativeWebExample/android/app/build.gradle b/legacy/examples/ReactNativeWebExample/android/app/build.gradle similarity index 100% rename from examples/ReactNativeWebExample/android/app/build.gradle rename to legacy/examples/ReactNativeWebExample/android/app/build.gradle diff --git a/examples/ReactNativeWebExample/android/app/proguard-rules.pro b/legacy/examples/ReactNativeWebExample/android/app/proguard-rules.pro similarity index 100% rename from examples/ReactNativeWebExample/android/app/proguard-rules.pro rename to legacy/examples/ReactNativeWebExample/android/app/proguard-rules.pro diff --git a/examples/ReactNativeWebExample/android/app/src/main/AndroidManifest.xml b/legacy/examples/ReactNativeWebExample/android/app/src/main/AndroidManifest.xml similarity index 100% rename from examples/ReactNativeWebExample/android/app/src/main/AndroidManifest.xml rename to legacy/examples/ReactNativeWebExample/android/app/src/main/AndroidManifest.xml diff --git a/examples/ReactNativeWebExample/android/app/src/main/java/com/reactnativeexample/MainActivity.java b/legacy/examples/ReactNativeWebExample/android/app/src/main/java/com/reactnativeexample/MainActivity.java similarity index 100% rename from examples/ReactNativeWebExample/android/app/src/main/java/com/reactnativeexample/MainActivity.java rename to legacy/examples/ReactNativeWebExample/android/app/src/main/java/com/reactnativeexample/MainActivity.java diff --git a/examples/ReactNativeWebExample/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/legacy/examples/ReactNativeWebExample/android/app/src/main/res/mipmap-hdpi/ic_launcher.png similarity index 100% rename from examples/ReactNativeWebExample/android/app/src/main/res/mipmap-hdpi/ic_launcher.png rename to legacy/examples/ReactNativeWebExample/android/app/src/main/res/mipmap-hdpi/ic_launcher.png diff --git a/examples/ReactNativeWebExample/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/legacy/examples/ReactNativeWebExample/android/app/src/main/res/mipmap-mdpi/ic_launcher.png similarity index 100% rename from examples/ReactNativeWebExample/android/app/src/main/res/mipmap-mdpi/ic_launcher.png rename to legacy/examples/ReactNativeWebExample/android/app/src/main/res/mipmap-mdpi/ic_launcher.png diff --git a/examples/ReactNativeWebExample/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/legacy/examples/ReactNativeWebExample/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png similarity index 100% rename from examples/ReactNativeWebExample/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png rename to legacy/examples/ReactNativeWebExample/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png diff --git a/examples/ReactNativeWebExample/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/legacy/examples/ReactNativeWebExample/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png similarity index 100% rename from examples/ReactNativeWebExample/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png rename to legacy/examples/ReactNativeWebExample/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png diff --git a/examples/ReactNativeWebExample/android/app/src/main/res/values/strings.xml b/legacy/examples/ReactNativeWebExample/android/app/src/main/res/values/strings.xml similarity index 100% rename from examples/ReactNativeWebExample/android/app/src/main/res/values/strings.xml rename to legacy/examples/ReactNativeWebExample/android/app/src/main/res/values/strings.xml diff --git a/examples/ReactNativeWebExample/android/app/src/main/res/values/styles.xml b/legacy/examples/ReactNativeWebExample/android/app/src/main/res/values/styles.xml similarity index 100% rename from examples/ReactNativeWebExample/android/app/src/main/res/values/styles.xml rename to legacy/examples/ReactNativeWebExample/android/app/src/main/res/values/styles.xml diff --git a/examples/ReactNativeWebExample/android/build.gradle b/legacy/examples/ReactNativeWebExample/android/build.gradle similarity index 100% rename from examples/ReactNativeWebExample/android/build.gradle rename to legacy/examples/ReactNativeWebExample/android/build.gradle diff --git a/examples/ReactNativeWebExample/android/gradle.properties b/legacy/examples/ReactNativeWebExample/android/gradle.properties similarity index 100% rename from examples/ReactNativeWebExample/android/gradle.properties rename to legacy/examples/ReactNativeWebExample/android/gradle.properties diff --git a/examples/ReactNativeWebExample/android/gradle/wrapper/gradle-wrapper.jar b/legacy/examples/ReactNativeWebExample/android/gradle/wrapper/gradle-wrapper.jar similarity index 100% rename from examples/ReactNativeWebExample/android/gradle/wrapper/gradle-wrapper.jar rename to legacy/examples/ReactNativeWebExample/android/gradle/wrapper/gradle-wrapper.jar diff --git a/examples/ReactNativeWebExample/android/gradle/wrapper/gradle-wrapper.properties b/legacy/examples/ReactNativeWebExample/android/gradle/wrapper/gradle-wrapper.properties similarity index 100% rename from examples/ReactNativeWebExample/android/gradle/wrapper/gradle-wrapper.properties rename to legacy/examples/ReactNativeWebExample/android/gradle/wrapper/gradle-wrapper.properties diff --git a/examples/ReactNativeWebExample/android/gradlew b/legacy/examples/ReactNativeWebExample/android/gradlew similarity index 100% rename from examples/ReactNativeWebExample/android/gradlew rename to legacy/examples/ReactNativeWebExample/android/gradlew diff --git a/examples/ReactNativeWebExample/android/gradlew.bat b/legacy/examples/ReactNativeWebExample/android/gradlew.bat similarity index 100% rename from examples/ReactNativeWebExample/android/gradlew.bat rename to legacy/examples/ReactNativeWebExample/android/gradlew.bat diff --git a/examples/ReactNativeWebExample/android/keystores/BUCK b/legacy/examples/ReactNativeWebExample/android/keystores/BUCK similarity index 100% rename from examples/ReactNativeWebExample/android/keystores/BUCK rename to legacy/examples/ReactNativeWebExample/android/keystores/BUCK diff --git a/examples/ReactNativeWebExample/android/keystores/debug.keystore.properties b/legacy/examples/ReactNativeWebExample/android/keystores/debug.keystore.properties similarity index 100% rename from examples/ReactNativeWebExample/android/keystores/debug.keystore.properties rename to legacy/examples/ReactNativeWebExample/android/keystores/debug.keystore.properties diff --git a/examples/ReactNativeWebExample/android/settings.gradle b/legacy/examples/ReactNativeWebExample/android/settings.gradle similarity index 100% rename from examples/ReactNativeWebExample/android/settings.gradle rename to legacy/examples/ReactNativeWebExample/android/settings.gradle diff --git a/examples/ReactNativeWebExample/index.android.js b/legacy/examples/ReactNativeWebExample/index.android.js similarity index 100% rename from examples/ReactNativeWebExample/index.android.js rename to legacy/examples/ReactNativeWebExample/index.android.js diff --git a/examples/ReactNativeWebExample/index.ios.js b/legacy/examples/ReactNativeWebExample/index.ios.js similarity index 100% rename from examples/ReactNativeWebExample/index.ios.js rename to legacy/examples/ReactNativeWebExample/index.ios.js diff --git a/examples/ReactNativeWebExample/index.web.js b/legacy/examples/ReactNativeWebExample/index.web.js similarity index 100% rename from examples/ReactNativeWebExample/index.web.js rename to legacy/examples/ReactNativeWebExample/index.web.js diff --git a/examples/ReactNativeWebExample/ios/ReactNativeExample.xcodeproj/project.pbxproj b/legacy/examples/ReactNativeWebExample/ios/ReactNativeExample.xcodeproj/project.pbxproj similarity index 100% rename from examples/ReactNativeWebExample/ios/ReactNativeExample.xcodeproj/project.pbxproj rename to legacy/examples/ReactNativeWebExample/ios/ReactNativeExample.xcodeproj/project.pbxproj diff --git a/examples/ReactNativeWebExample/ios/ReactNativeExample.xcodeproj/xcshareddata/xcschemes/ReactNativeExample.xcscheme b/legacy/examples/ReactNativeWebExample/ios/ReactNativeExample.xcodeproj/xcshareddata/xcschemes/ReactNativeExample.xcscheme similarity index 100% rename from examples/ReactNativeWebExample/ios/ReactNativeExample.xcodeproj/xcshareddata/xcschemes/ReactNativeExample.xcscheme rename to legacy/examples/ReactNativeWebExample/ios/ReactNativeExample.xcodeproj/xcshareddata/xcschemes/ReactNativeExample.xcscheme diff --git a/examples/ReactNativeWebExample/ios/ReactNativeExample/AppDelegate.h b/legacy/examples/ReactNativeWebExample/ios/ReactNativeExample/AppDelegate.h similarity index 100% rename from examples/ReactNativeWebExample/ios/ReactNativeExample/AppDelegate.h rename to legacy/examples/ReactNativeWebExample/ios/ReactNativeExample/AppDelegate.h diff --git a/examples/ReactNativeWebExample/ios/ReactNativeExample/AppDelegate.m b/legacy/examples/ReactNativeWebExample/ios/ReactNativeExample/AppDelegate.m similarity index 100% rename from examples/ReactNativeWebExample/ios/ReactNativeExample/AppDelegate.m rename to legacy/examples/ReactNativeWebExample/ios/ReactNativeExample/AppDelegate.m diff --git a/examples/ReactNativeWebExample/ios/ReactNativeExample/Base.lproj/LaunchScreen.xib b/legacy/examples/ReactNativeWebExample/ios/ReactNativeExample/Base.lproj/LaunchScreen.xib similarity index 100% rename from examples/ReactNativeWebExample/ios/ReactNativeExample/Base.lproj/LaunchScreen.xib rename to legacy/examples/ReactNativeWebExample/ios/ReactNativeExample/Base.lproj/LaunchScreen.xib diff --git a/examples/ReactNativeWebExample/ios/ReactNativeExample/Images.xcassets/AppIcon.appiconset/Contents.json b/legacy/examples/ReactNativeWebExample/ios/ReactNativeExample/Images.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from examples/ReactNativeWebExample/ios/ReactNativeExample/Images.xcassets/AppIcon.appiconset/Contents.json rename to legacy/examples/ReactNativeWebExample/ios/ReactNativeExample/Images.xcassets/AppIcon.appiconset/Contents.json diff --git a/examples/ReactNativeWebExample/ios/ReactNativeExample/Info.plist b/legacy/examples/ReactNativeWebExample/ios/ReactNativeExample/Info.plist similarity index 100% rename from examples/ReactNativeWebExample/ios/ReactNativeExample/Info.plist rename to legacy/examples/ReactNativeWebExample/ios/ReactNativeExample/Info.plist diff --git a/examples/ReactNativeWebExample/ios/ReactNativeExample/main.m b/legacy/examples/ReactNativeWebExample/ios/ReactNativeExample/main.m similarity index 100% rename from examples/ReactNativeWebExample/ios/ReactNativeExample/main.m rename to legacy/examples/ReactNativeWebExample/ios/ReactNativeExample/main.m diff --git a/examples/ReactNativeWebExample/ios/ReactNativeExampleTests/Info.plist b/legacy/examples/ReactNativeWebExample/ios/ReactNativeExampleTests/Info.plist similarity index 100% rename from examples/ReactNativeWebExample/ios/ReactNativeExampleTests/Info.plist rename to legacy/examples/ReactNativeWebExample/ios/ReactNativeExampleTests/Info.plist diff --git a/examples/ReactNativeWebExample/ios/ReactNativeExampleTests/ReactNativeExampleTests.m b/legacy/examples/ReactNativeWebExample/ios/ReactNativeExampleTests/ReactNativeExampleTests.m similarity index 100% rename from examples/ReactNativeWebExample/ios/ReactNativeExampleTests/ReactNativeExampleTests.m rename to legacy/examples/ReactNativeWebExample/ios/ReactNativeExampleTests/ReactNativeExampleTests.m diff --git a/examples/ReactNativeWebExample/package.json b/legacy/examples/ReactNativeWebExample/package.json similarity index 100% rename from examples/ReactNativeWebExample/package.json rename to legacy/examples/ReactNativeWebExample/package.json diff --git a/examples/ReactNativeWebExample/web-html.ejs b/legacy/examples/ReactNativeWebExample/web-html.ejs similarity index 100% rename from examples/ReactNativeWebExample/web-html.ejs rename to legacy/examples/ReactNativeWebExample/web-html.ejs diff --git a/examples/ReactNativeWebExample/webpack.config.js b/legacy/examples/ReactNativeWebExample/webpack.config.js similarity index 100% rename from examples/ReactNativeWebExample/webpack.config.js rename to legacy/examples/ReactNativeWebExample/webpack.config.js diff --git a/gulpfile.js b/legacy/gulpfile.js similarity index 100% rename from gulpfile.js rename to legacy/gulpfile.js diff --git a/images/0.2.0.gif b/legacy/images/0.2.0.gif similarity index 100% rename from images/0.2.0.gif rename to legacy/images/0.2.0.gif diff --git a/images/0.6.0.png b/legacy/images/0.6.0.png similarity index 100% rename from images/0.6.0.png rename to legacy/images/0.6.0.png diff --git a/images/AllThreePlatforms.png b/legacy/images/AllThreePlatforms.png similarity index 100% rename from images/AllThreePlatforms.png rename to legacy/images/AllThreePlatforms.png diff --git a/images/Api.png b/legacy/images/Api.png similarity index 100% rename from images/Api.png rename to legacy/images/Api.png diff --git a/images/Dispatch.png b/legacy/images/Dispatch.png similarity index 100% rename from images/Dispatch.png rename to legacy/images/Dispatch.png diff --git a/images/MainInterface.png b/legacy/images/MainInterface.png similarity index 100% rename from images/MainInterface.png rename to legacy/images/MainInterface.png diff --git a/images/Reactotron.gif b/legacy/images/Reactotron.gif similarity index 100% rename from images/Reactotron.gif rename to legacy/images/Reactotron.gif diff --git a/images/ReduxActions.png b/legacy/images/ReduxActions.png similarity index 100% rename from images/ReduxActions.png rename to legacy/images/ReduxActions.png diff --git a/images/ReduxSubscriptions.png b/legacy/images/ReduxSubscriptions.png similarity index 100% rename from images/ReduxSubscriptions.png rename to legacy/images/ReduxSubscriptions.png diff --git a/images/ShowingPrompts.png b/legacy/images/ShowingPrompts.png similarity index 100% rename from images/ShowingPrompts.png rename to legacy/images/ShowingPrompts.png diff --git a/images/Yellowbox.png b/legacy/images/Yellowbox.png similarity index 100% rename from images/Yellowbox.png rename to legacy/images/Yellowbox.png diff --git a/index.js b/legacy/index.js similarity index 100% rename from index.js rename to legacy/index.js diff --git a/legacy/package.json b/legacy/package.json new file mode 100644 index 000000000..e8b558661 --- /dev/null +++ b/legacy/package.json @@ -0,0 +1,66 @@ +{ + "name": "reactotron", + "version": "0.9.0", + "description": "A console-based remote control for React and React Native.", + "main": "index.js", + "bin": { + "reactotron": "./bin/reactotron.js" + }, + "scripts": { + "test": "ava", + "docs": "node_modules/.bin/jsdoc --configure .jsdoc.json", + "dist": "npm run clean && mkdir bin && echo '#!/usr/bin/env node\n' > ./bin/reactotron.js && gulp build && cat dist/index.js >> ./bin/reactotron.js", + "clean": "rm -rf bin dist", + "gulp": "gulp build", + "start": "babel-node server/index.js", + "cpdistc": "rm examples/ReactDomExample/client.js && cp dist/client.js examples/ReactDomExample/ && rm examples/ReactNativeExample/client.js && cp dist/client.js examples/ReactNativeExample/ && rm examples/ReactNativeWebExample/client.js && cp dist/client.js examples/ReactNativeWebExample/", + "cprawc": "rm examples/ReactDomExample/client.js && cp client/client.js examples/ReactDomExample/ && rm examples/ReactNativeExample/client.js && cp client/client.js examples/ReactNativeExample/ && rm examples/ReactNativeWebExample/client.js && cp client/client.js examples/ReactNativeWebExample/", + "build:minor": "npm run dist && xyz -i minor -s bump_client.sh", + "build:patch": "npm run dist && xyz -i patch -s bump_client.sh" + }, + "repository": { + "type": "git", + "url": "https://github.com/skellock/reactotron.git" + }, + "author": { + "name": "Steve Kellock", + "email": "steve@kellock.ca" + }, + "license": "MIT", + "files": [ + "index.js", + "dist/*.js", + "bin/reactotron.js" + ], + "dependencies": { + "blessed": "^0.1.81", + "gemoji": "^1.0.0", + "moment": "^2.12.0", + "ramda": "^0.21.0", + "ramdasauce": "^1.0.0", + "socket.io": "^1.4.5", + "socket.io-client": "^1.4.5", + "strman": "^1.0.1" + }, + "devDependencies": { + "ava": "^0.14.0", + "babel-cli": "^6.7.5", + "babel-core": "^6.7.7", + "babel-plugin-transform-object-rest-spread": "^6.6.5", + "babel-preset-es2015": "^6.6.0", + "babel-preset-stage-0": "^6.5.0", + "docdash": "^0.1.0", + "gulp": "^3.9.1", + "gulp-babel": "^6.1.2", + "gulp-rollup": "^1.8.0", + "jsdoc": "^3.4.0", + "rollup": "^0.25.8", + "xyz": "^0.5.0" + }, + "ava": { + "require": [ + "babel-core/register" + ], + "babel": "inherit" + } +} diff --git a/lerna.json b/lerna.json new file mode 100644 index 000000000..9fc204ddf --- /dev/null +++ b/lerna.json @@ -0,0 +1,4 @@ +{ + "lerna": "2.0.0-beta.26", + "version": "0.94.0" +} diff --git a/package.json b/package.json index e8b558661..046c326a5 100644 --- a/package.json +++ b/package.json @@ -1,66 +1,17 @@ { - "name": "reactotron", - "version": "0.9.0", - "description": "A console-based remote control for React and React Native.", - "main": "index.js", - "bin": { - "reactotron": "./bin/reactotron.js" - }, "scripts": { - "test": "ava", - "docs": "node_modules/.bin/jsdoc --configure .jsdoc.json", - "dist": "npm run clean && mkdir bin && echo '#!/usr/bin/env node\n' > ./bin/reactotron.js && gulp build && cat dist/index.js >> ./bin/reactotron.js", - "clean": "rm -rf bin dist", - "gulp": "gulp build", - "start": "babel-node server/index.js", - "cpdistc": "rm examples/ReactDomExample/client.js && cp dist/client.js examples/ReactDomExample/ && rm examples/ReactNativeExample/client.js && cp dist/client.js examples/ReactNativeExample/ && rm examples/ReactNativeWebExample/client.js && cp dist/client.js examples/ReactNativeWebExample/", - "cprawc": "rm examples/ReactDomExample/client.js && cp client/client.js examples/ReactDomExample/ && rm examples/ReactNativeExample/client.js && cp client/client.js examples/ReactNativeExample/ && rm examples/ReactNativeWebExample/client.js && cp client/client.js examples/ReactNativeWebExample/", - "build:minor": "npm run dist && xyz -i minor -s bump_client.sh", - "build:patch": "npm run dist && xyz -i patch -s bump_client.sh" - }, - "repository": { - "type": "git", - "url": "https://github.com/skellock/reactotron.git" - }, - "author": { - "name": "Steve Kellock", - "email": "steve@kellock.ca" - }, - "license": "MIT", - "files": [ - "index.js", - "dist/*.js", - "bin/reactotron.js" - ], - "dependencies": { - "blessed": "^0.1.81", - "gemoji": "^1.0.0", - "moment": "^2.12.0", - "ramda": "^0.21.0", - "ramdasauce": "^1.0.0", - "socket.io": "^1.4.5", - "socket.io-client": "^1.4.5", - "strman": "^1.0.1" + "bootstrap": "lerna bootstrap", + "build": "lerna run build", + "clean": "lerna clean", + "test": "lerna run test", + "copy-internal-deps": "lerna run copy-internal-deps", + "welcome": "./scripts/welcome.sh", + "e2e": "npm run bootstrap && npm run build && npm run copy-internal-deps && npm run test" }, "devDependencies": { - "ava": "^0.14.0", - "babel-cli": "^6.7.5", - "babel-core": "^6.7.7", - "babel-plugin-transform-object-rest-spread": "^6.6.5", - "babel-preset-es2015": "^6.6.0", - "babel-preset-stage-0": "^6.5.0", - "docdash": "^0.1.0", - "gulp": "^3.9.1", - "gulp-babel": "^6.1.2", - "gulp-rollup": "^1.8.0", - "jsdoc": "^3.4.0", - "rollup": "^0.25.8", - "xyz": "^0.5.0" + "lerna": "2.0.0-beta.26" }, - "ava": { - "require": [ - "babel-core/register" - ], - "babel": "inherit" + "dependencies": { + "stringify-object": "^2.4.0" } } diff --git a/packages/demo-react-js/.gitignore b/packages/demo-react-js/.gitignore new file mode 100644 index 000000000..8e8b40aff --- /dev/null +++ b/packages/demo-react-js/.gitignore @@ -0,0 +1,11 @@ +# See http://help.github.com/ignore-files/ for more about ignoring files. + +# dependencies +node_modules + +# production +build + +# misc +.DS_Store +npm-debug.log diff --git a/packages/demo-react-js/README.md b/packages/demo-react-js/README.md new file mode 100644 index 000000000..79d5aaa25 --- /dev/null +++ b/packages/demo-react-js/README.md @@ -0,0 +1,20 @@ +## Reactotron Notes + +With `create-react-app`, the default devtool is `eval`. We need that set to `source-map` to +get the stack traces proper. + +Instead of ejecting for this demo, let's just reach into the node_modules and change it. + +SPARTA!!!!!! + +`atom ./node_modules/react-scripts/config/webpack.config.dev.js` + +Change the line that currently says + +` devtool: 'eval',` + +to + +`devtool: 'source-map',` + +It's the first line after the module exports. (line 18, but that will change as new version get put out) diff --git a/packages/demo-react-js/copy-internal-deps.sh b/packages/demo-react-js/copy-internal-deps.sh new file mode 100755 index 000000000..476faadb8 --- /dev/null +++ b/packages/demo-react-js/copy-internal-deps.sh @@ -0,0 +1,5 @@ +#!/bin/bash +cp ../reactotron-react-js/dist/index.js ./node_modules/reactotron-react-js/index.js +cp ../reactotron-core-client/dist/index.js ./node_modules/reactotron-core-client/index.js +cp ../reactotron-redux/dist/index.js ./node_modules/reactotron-redux/index.js +cp ../reactotron-apisauce/dist/index.js ./node_modules/reactotron-apisauce/index.js diff --git a/packages/demo-react-js/favicon.ico b/packages/demo-react-js/favicon.ico new file mode 100644 index 000000000..5c125de5d Binary files /dev/null and b/packages/demo-react-js/favicon.ico differ diff --git a/packages/demo-react-js/index.html b/packages/demo-react-js/index.html new file mode 100644 index 000000000..72e10e94c --- /dev/null +++ b/packages/demo-react-js/index.html @@ -0,0 +1,21 @@ + + + + + + React App + + +
+ + + diff --git a/packages/demo-react-js/package.json b/packages/demo-react-js/package.json new file mode 100644 index 000000000..fc7b07144 --- /dev/null +++ b/packages/demo-react-js/package.json @@ -0,0 +1,34 @@ +{ + "name": "demo-react-js", + "version": "0.94.0", + "private": true, + "devDependencies": { + "react-scripts": "0.2.1" + }, + "dependencies": { + "apisauce": "^0.3.0", + "ramda": "^0.22.1", + "ramdasauce": "^1.1.0", + "react": "^15.2.1", + "react-dom": "^15.2.1", + "react-redux": "^4.4.5", + "reactotron-apisauce": "^0.94.0", + "reactotron-core-client": "^0.94.0", + "reactotron-react-js": "^0.94.0", + "reactotron-redux": "^0.94.0", + "redux": "^3.5.2", + "redux-logger": "^2.6.1", + "redux-saga": "^0.11.0", + "socket.io": "^1.4.8", + "stacktrace-js": "^1.3.1" + }, + "scripts": { + "start": "react-scripts start", + "build-prod": "react-scripts build", + "eject": "react-scripts eject", + "copy-internal-deps": "./copy-internal-deps.sh" + }, + "eslintConfig": { + "extends": "./node_modules/react-scripts/config/eslint.js" + } +} diff --git a/packages/demo-react-js/src/App.css b/packages/demo-react-js/src/App.css new file mode 100644 index 000000000..074be41c0 --- /dev/null +++ b/packages/demo-react-js/src/App.css @@ -0,0 +1,19 @@ +.App { + text-align: center; +} + + +.App-header { + background-color: #222; + padding: 20px; + color: white; +} + +.App-intro { + font-size: large; +} + +@keyframes App-logo-spin { + from { transform: rotate(0deg); } + to { transform: rotate(360deg); } +} diff --git a/packages/demo-react-js/src/App.js b/packages/demo-react-js/src/App.js new file mode 100644 index 000000000..063a69dcd --- /dev/null +++ b/packages/demo-react-js/src/App.js @@ -0,0 +1,152 @@ +import React, { Component, PropTypes } from 'react'; +import logo from './logo.svg'; +import './App.css'; +import { connect } from 'react-redux' +import { Actions as StartupActions } from './Redux/Startup.redux' +import { Actions as LogoActions } from './Redux/Logo.redux' +import { Actions as RepoActions } from './Redux/Repo.redux' +import makeErrorForFun from './ErrorMaker' + +const Styles = { + button: { + fontSize: 15, + padding: 10, + margin: '10px 10px', + backgroundColor: '#333333', + border: 0, + borderRadius: 4, + color: '#eeeeee' + }, + avatar: { + height: 80, + width: 80, + borderRadius: 40 + } +} + + +class App extends Component { + + static propTypes = { + startup: PropTypes.func.isRequired, + message: PropTypes.string, + url: PropTypes.string, + name: PropTypes.string, + sha: PropTypes.string, + error: PropTypes.string, + fetching: PropTypes.bool + } + + componentWillMount () { + // this.props.startup() + } + + renderError () { + const { error } = this.props + return ( +
+

Big Ol Error

+

+ { error } +

+
+ ) + } + + renderMessage () { + const { fetching, name, url, message, sha } = this.props + if (fetching) { + return (

Hang tight

) + } + + return ( +
+

{name}

+

+ {message} +

+

{sha}

+
+ ) + } + + render () { + const { error, speed, size, repo, avatar } = this.props + const logoStyles = { + animation: `App-logo-spin infinite ${speed}s linear`, + height: `${size}px` + } + + return ( +
+
+

Reactotron Demo

+
+ + + + +
+ logo +
+ { repo && +

Latest Commit From {repo}

} + { avatar && +
avatar
+ } + + + + + + + { error ? this.renderError() : this.renderMessage() } + +
+ +
+ + +
+ ); + } +} + +const mapStateToProps = state => ({ ...state.repo, ...state.logo }) + +const mapDispatchToProps = dispatch => ({ + startup: () => dispatch(StartupActions.startup()), + faster: () => dispatch(LogoActions.changeSpeed(1)), + slower: () => dispatch(LogoActions.changeSpeed(20)), + bigger: () => dispatch(LogoActions.changeSize(160)), + smaller: () => dispatch(LogoActions.changeSize(40)), + requestReactotron: () => dispatch(RepoActions.request('reactotron/reactotron')), + requestReactNative: () => dispatch(RepoActions.request('facebook/react-native')), + requestMobx: () => dispatch(RepoActions.request('mobxjs/mobx')), + requestRedux: () => dispatch(RepoActions.request('reactjs/redux')), + requestBad: () => dispatch(RepoActions.request('zzzz/zzzzz')), + handleLogoPress: () => { + console.tron.log('wait for it...') + setTimeout(() => { makeErrorForFun('boom') }, 500) + }, + display: () => { + console.tron.display({ name: 'HELLO', value: 'You\'re awesome.', preview: 'Guess what?' }) + console.tron.display({ name: 'DANGER', value: 9001, important: true, preview: 'It\'s over 9000!' }) + console.tron.display({ name: 'ORDER', preview: 'Here\'s your order...', value: { + app: { + color: 'green', + vegetable: 'spinach', + variant: 'baby', + salad: true + }, + main: { + type: 'poutine' + }, + when: new Date() + } + }) + console.tron.display({ name: 'LIST', value: [1, 'a', true, new Date()], preview: '4 things' }) + } +}) + +export default connect(mapStateToProps, mapDispatchToProps)(App); diff --git a/packages/demo-react-js/src/ErrorMaker.js b/packages/demo-react-js/src/ErrorMaker.js new file mode 100644 index 000000000..f35a7a6e6 --- /dev/null +++ b/packages/demo-react-js/src/ErrorMaker.js @@ -0,0 +1,3 @@ +export default function makeErrorForFun(message) { + throw new Error(message) +} diff --git a/packages/demo-react-js/src/ReactotronConfig.js b/packages/demo-react-js/src/ReactotronConfig.js new file mode 100644 index 000000000..f9abd5fe6 --- /dev/null +++ b/packages/demo-react-js/src/ReactotronConfig.js @@ -0,0 +1,10 @@ +import Reactotron, { trackGlobalErrors } from 'reactotron-react-js' +import tronsauce from 'reactotron-apisauce' + +Reactotron + .configure({ name: 'Demo Time!', secure: false }) + .use(tronsauce()) + .use(trackGlobalErrors({ offline: false })) + .connect() + +console.tron = Reactotron diff --git a/packages/demo-react-js/src/Redux/Logo.redux.js b/packages/demo-react-js/src/Redux/Logo.redux.js new file mode 100644 index 000000000..3761507f1 --- /dev/null +++ b/packages/demo-react-js/src/Redux/Logo.redux.js @@ -0,0 +1,33 @@ +export const Types = { + Speed: 'logo.speed', + Size: 'logo.size', + Reset: 'logo.reset' +} + +export const Actions = { + changeSpeed: (speed) => ({ type: Types.Speed, speed }), + changeSize: (size) => ({ type: Types.Size, size }), + reset: () => ({ type: Types.Reset }) +} + +export const INITIAL_STATE = { + size: 100, + speed: 5 +} + +const changeSpeed = (state, { speed }) => ({ ...state, speed }) +const changeSize = (state, { size }) => ({ ...state, size }) +const reset = (state, { size }) => INITIAL_STATE + +// actions -> +const reducerMap = { + [Types.Speed]: changeSpeed, + [Types.Size]: changeSize, + [Types.Reset]: reset +} + +// our reducer +export const reducer = (state = INITIAL_STATE, action) => { + const handler = reducerMap[action.type] + return typeof handler === 'function' ? handler(state, action) : state +} diff --git a/packages/demo-react-js/src/Redux/Repo.redux.js b/packages/demo-react-js/src/Redux/Repo.redux.js new file mode 100644 index 000000000..9846cdc7e --- /dev/null +++ b/packages/demo-react-js/src/Redux/Repo.redux.js @@ -0,0 +1,48 @@ +export const Types = { + Request: 'repo.request', + Receive: 'repo.receive', + Failure: 'repo.failure' +} + +export const Actions = { + request: (repo) => ({ type: Types.Request, repo }), + receive: (message, url, name, sha, avatar) => ({ type: Types.Receive, message, url, name, sha, avatar }), + failure: (error) => ({ type: Types.Failure, error }) +} + +export const INITIAL_STATE = { + message: null, + repo: null, + url: null, + name: null, + sha: null, + fetching: false, + avatar: null, + error: null +} + +// we're going out for the repo message +const request = (state, { repo }) => + ({ ...INITIAL_STATE, fetching: true, repo }) + +// we've got a repo message +const receive = (state, { message, url, name, sha, avatar }) => { + return { ...state, fetching: false, message, url, name, sha, avatar } +} + +// we failed to get the repo message :( +const failure = (state, action) => + ({ ...state, fetching: false, error: action.error }) + +// actions -> +const reducerMap = { + [Types.Request]: request, + [Types.Receive]: receive, + [Types.Failure]: failure +} + +// our reducer +export const reducer = (state = INITIAL_STATE, action) => { + const handler = reducerMap[action.type] + return typeof handler === 'function' ? handler(state, action) : state +} diff --git a/packages/demo-react-js/src/Redux/RootReducer.js b/packages/demo-react-js/src/Redux/RootReducer.js new file mode 100644 index 000000000..6717b6f59 --- /dev/null +++ b/packages/demo-react-js/src/Redux/RootReducer.js @@ -0,0 +1,8 @@ +import { combineReducers } from 'redux' +import { reducer as repoReducer } from './Repo.redux' +import { reducer as logoReducer } from './Logo.redux' + +export default combineReducers({ + repo: repoReducer, + logo: logoReducer +}) diff --git a/packages/demo-react-js/src/Redux/Startup.redux.js b/packages/demo-react-js/src/Redux/Startup.redux.js new file mode 100644 index 000000000..65ad20f3e --- /dev/null +++ b/packages/demo-react-js/src/Redux/Startup.redux.js @@ -0,0 +1,7 @@ +export const Types = { + Startup: 'Startup' +} + +export const Actions = { + startup: () => ({ type: Types.Startup }) +} diff --git a/packages/demo-react-js/src/Redux/Store.js b/packages/demo-react-js/src/Redux/Store.js new file mode 100644 index 000000000..94c170b56 --- /dev/null +++ b/packages/demo-react-js/src/Redux/Store.js @@ -0,0 +1,36 @@ +import { not, contains } from 'ramda' +import {createStore, applyMiddleware, compose} from 'redux' +import createLogger from 'redux-logger' +import createSagaMiddleware from 'redux-saga' +import rootReducer from './RootReducer' +import rootSaga from '../Sagas' +import Reactotron from 'reactotron-react-js' +import createTronohancer from 'reactotron-redux' +import { Types as LogoTypes } from './Logo.redux' + +// the logger master switch +const USE_LOGGING = false + +// silence these saga-based messages +const SAGA_LOGGING_BLACKLIST = ['EFFECT_TRIGGERED', 'EFFECT_RESOLVED', 'EFFECT_REJECTED'] + +// create the logger +const logger = createLogger({ + predicate: (getState, { type }) => USE_LOGGING && not(contains(type, SAGA_LOGGING_BLACKLIST)) +}) + +// a function which can create our store and auto-persist the data +export default () => { + const sagaMiddleware = createSagaMiddleware() + const tracker = createTronohancer(Reactotron, { + isActionImportant: action => action.type === LogoTypes.Size && action.size > 100 + }) + const enhancers = compose( + tracker, + applyMiddleware(logger, sagaMiddleware) + ) + + const store = createStore(rootReducer, enhancers) + sagaMiddleware.run(rootSaga) + return store +} diff --git a/packages/demo-react-js/src/Sagas/Repo.sagas.js b/packages/demo-react-js/src/Sagas/Repo.sagas.js new file mode 100644 index 000000000..4a2f562b6 --- /dev/null +++ b/packages/demo-react-js/src/Sagas/Repo.sagas.js @@ -0,0 +1,23 @@ +import RS from 'ramdasauce' +import { delay } from 'redux-saga' +import { call, put } from 'redux-saga/effects' +import * as Repo from '../Redux/Repo.redux' + +export function * request (api, action) { + // make the call to github + const { repo } = action + const { ok, data, status, problem } = yield call(api.get, `/repos/${repo}/commits`) + yield call(delay, 200) + // are we good? + if (ok) { + const entry = RS.dotPath('0', data) + const { commit, author, html_url: url } = entry + const { message, tree } = commit + const { login, avatar_url } = author + const { sha } = tree + // record the last commit's message + yield put(Repo.Actions.receive(message, url, login, sha, avatar_url)) + } else { + yield put(Repo.Actions.failure(`uh oh: ${problem} status: ${status}`)) + } +} diff --git a/packages/demo-react-js/src/Sagas/Startup.sagas.js b/packages/demo-react-js/src/Sagas/Startup.sagas.js new file mode 100644 index 000000000..63810e1a4 --- /dev/null +++ b/packages/demo-react-js/src/Sagas/Startup.sagas.js @@ -0,0 +1,7 @@ +// import { put } from 'redux-saga/effects' +// import * as RepoMessage from '../Redux/RepoMessage.redux' + +// process STARTUP actions +export function * startup () { + // yield put(RepoMessage.Actions.request()) +} diff --git a/packages/demo-react-js/src/Sagas/index.js b/packages/demo-react-js/src/Sagas/index.js new file mode 100644 index 000000000..e0c9e72da --- /dev/null +++ b/packages/demo-react-js/src/Sagas/index.js @@ -0,0 +1,25 @@ +import { takeEvery, takeLatest } from 'redux-saga' +import ApiSauce from 'apisauce' +import Reactotron from 'reactotron-react-js' + +import * as Startup from '../Redux/Startup.redux' +import * as Repo from '../Redux/Repo.redux' + +import { startup } from './Startup.sagas' +import { request as requestRepo } from './Repo.sagas' + +const api = ApiSauce.create({ + baseURL: 'https://api.github.com', + headers: { + 'Accept': 'application/vnd.github.v3+json' + } +}) + +api.addMonitor(Reactotron.apisauce) + +export default function * rootSaga () { + yield [ + takeLatest(Repo.Types.Request, requestRepo, api), + takeEvery(Startup.Types.Startup, startup) + ] +} diff --git a/packages/demo-react-js/src/index.css b/packages/demo-react-js/src/index.css new file mode 100644 index 000000000..b4cc7250b --- /dev/null +++ b/packages/demo-react-js/src/index.css @@ -0,0 +1,5 @@ +body { + margin: 0; + padding: 0; + font-family: sans-serif; +} diff --git a/packages/demo-react-js/src/index.js b/packages/demo-react-js/src/index.js new file mode 100644 index 000000000..552d0d387 --- /dev/null +++ b/packages/demo-react-js/src/index.js @@ -0,0 +1,16 @@ +import './ReactotronConfig' // we put this guy first + +import React from 'react'; +import ReactDOM from 'react-dom'; +import App from './App'; +import './index.css'; + +import { Provider } from 'react-redux' +import createStore from './Redux/Store' + +const store = createStore() + +ReactDOM.render( + , + document.getElementById('root') +); diff --git a/packages/demo-react-js/src/logo.svg b/packages/demo-react-js/src/logo.svg new file mode 100644 index 000000000..6b60c1042 --- /dev/null +++ b/packages/demo-react-js/src/logo.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/examples/ReactNativeExample/.babelrc b/packages/demo-react-native/.babelrc similarity index 100% rename from examples/ReactNativeExample/.babelrc rename to packages/demo-react-native/.babelrc diff --git a/packages/demo-react-native/.buckconfig b/packages/demo-react-native/.buckconfig new file mode 100644 index 000000000..934256cb2 --- /dev/null +++ b/packages/demo-react-native/.buckconfig @@ -0,0 +1,6 @@ + +[android] + target = Google Inc.:Google APIs:23 + +[maven_repositories] + central = https://repo1.maven.org/maven2 diff --git a/packages/demo-react-native/.flowconfig b/packages/demo-react-native/.flowconfig new file mode 100644 index 000000000..e28e2f5bd --- /dev/null +++ b/packages/demo-react-native/.flowconfig @@ -0,0 +1,41 @@ +[ignore] + +# We fork some components by platform. +.*/*.android.js + +# Ignore templates with `@flow` in header +.*/local-cli/generator.* + +# Ignore malformed json +.*/node_modules/y18n/test/.*\.json + +[include] + +[libs] +node_modules/react-native/Libraries/react-native/react-native-interface.js +node_modules/react-native/flow +flow/ + +[options] +module.system=haste + +esproposal.class_static_fields=enable +esproposal.class_instance_fields=enable + +experimental.strict_type_args=true + +munge_underscores=true + +module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub' +module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub' + +suppress_type=$FlowIssue +suppress_type=$FlowFixMe +suppress_type=$FixMe + +suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-7]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) +suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-7]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ +suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy + +[version] +^0.27.0 diff --git a/packages/demo-react-native/.gitignore b/packages/demo-react-native/.gitignore new file mode 100644 index 000000000..eb1535e41 --- /dev/null +++ b/packages/demo-react-native/.gitignore @@ -0,0 +1,41 @@ +# OSX +# +.DS_Store + +# Xcode +# +build/ +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 +xcuserdata +*.xccheckout +*.moved-aside +DerivedData +*.hmap +*.ipa +*.xcuserstate +project.xcworkspace + +# Android/IJ +# +*.iml +.idea +.gradle +local.properties + +# node.js +# +node_modules/ +npm-debug.log + +# BUCK +buck-out/ +\.buckd/ +android/app/libs +android/keystores/debug.keystore diff --git a/packages/demo-react-native/.watchmanconfig b/packages/demo-react-native/.watchmanconfig new file mode 100644 index 000000000..9e26dfeeb --- /dev/null +++ b/packages/demo-react-native/.watchmanconfig @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/examples/ReactNativeWebExample/App/Actions/CreateAction.js b/packages/demo-react-native/App/Actions/CreateAction.js similarity index 100% rename from examples/ReactNativeWebExample/App/Actions/CreateAction.js rename to packages/demo-react-native/App/Actions/CreateAction.js diff --git a/examples/ReactNativeWebExample/App/Actions/Creators.js b/packages/demo-react-native/App/Actions/Creators.js similarity index 100% rename from examples/ReactNativeWebExample/App/Actions/Creators.js rename to packages/demo-react-native/App/Actions/Creators.js diff --git a/examples/ReactNativeExample/App/Actions/Types.js b/packages/demo-react-native/App/Actions/Types.js similarity index 100% rename from examples/ReactNativeExample/App/Actions/Types.js rename to packages/demo-react-native/App/Actions/Types.js diff --git a/packages/demo-react-native/App/Components/Button.js b/packages/demo-react-native/App/Components/Button.js new file mode 100644 index 000000000..bb3998fc9 --- /dev/null +++ b/packages/demo-react-native/App/Components/Button.js @@ -0,0 +1,22 @@ +import React, { Component, PropTypes } from 'react' +import { View, Text, TouchableOpacity } from 'react-native' +import Styles from './Styles/ButtonStyles' + +class Button extends Component { + + static propTypes = { + onPress: PropTypes.func, + text: PropTypes.string + } + + render () { + return ( + + {this.props.text} + + ) + } + +} + +export default Button diff --git a/packages/demo-react-native/App/Components/Repo.js b/packages/demo-react-native/App/Components/Repo.js new file mode 100644 index 000000000..ea50077d0 --- /dev/null +++ b/packages/demo-react-native/App/Components/Repo.js @@ -0,0 +1,101 @@ +import React, { Component, PropTypes } from 'react' +import { Animated, Easing, TouchableWithoutFeedback, View, Text, Image } from 'react-native' +import Styles from './Styles/RepoStyles' +import Button from './Button' +import { merge } from 'ramda' + +const ROTATION = { inputRange: [0, 1], outputRange: ['0deg', '360deg'] } + +class Repo extends Component { + + static propTypes = { + repo: PropTypes.string, + name: PropTypes.string, + avatar: PropTypes.string, + message: PropTypes.string, + bigger: PropTypes.func, + smaller: PropTypes.func, + faster: PropTypes.func, + slower: PropTypes.func, + reset: PropTypes.func, + size: PropTypes.number, + speed: PropTypes.number + } + + constructor (props) { + super(props) + this.state = { + spinny: new Animated.Value(0) + } + this.animate = this.animate.bind(this) + } + + componentWillReceiveProps (newProps) { + if (newProps.avatar && newProps.speed) { + // stop the current running animation + if (this.animation) { + this.animation.stop() + this.animation = null + } + setTimeout(this.animate, 10) + } + } + + animate () { + + const duration = 100 * this.props.speed + const easing = Easing.linear + this.state.spinny.setValue(0) + this.animation = Animated.sequence([ + Animated.timing(this.state.spinny, { toValue: 1, duration, easing }), + // Animated.timing(this.state.spinny, { toValue: 0, duration: 0 }) + ]).start( ({finished}) => { + if (finished) { + this.animate() + } else { + this.animation = null + } + }) + } + + + getAnimationStyle () { + return { + transform: [ + { rotate: this.state.spinny.interpolate(ROTATION) } + ] + } + } + + render () { + const { repo, name, avatar, message, size, speed } = this.props + const avatarSource = avatar && { uri: avatar } + + const avatarStyles = merge(Styles.avatar, { width: size, height: size, borderRadius: size * 0.5 }) + const centerStyles = merge(Styles.center, this.getAnimationStyle()) + return ( + + {repo || ' '} + + +