Skip to content

Commit 97d86c7

Browse files
authored
Merging Back 1.0 (infinitered#157)
* Removes legacy stuff to a sub-directory. * Moves the rest of the hidden files I forgot. * Adds lerna to manage publishing and linking. * Sets the lerna version to 0.1.0. * Imports the new core client library. 🚀 * Imports the new core server. 🦄 * Imports the start of the React Native client. 😻 * Adds the root package.json with the lerna dependency. * Adds build support to reactotron-core-server. * Salvages the current server as a starting point. * Bumps up a dependency to the correct version for dev. * Nukes the dist build of reactotron-react-native. * Ignores dist build of reactotron-react-native. * Plays nice with socket.io in both RN and node. * Sets the proper port for the reactotron-cli. * Starts on the React Native demo. Doesn't work. I'm sad. 😿 * Sidesteps React Native internal dependency issues. Good to go! * Translates peerDependencies from French to English. * Adds events for connect/disconnect to the core client. * Removes the reactotron-core-client dist build. * Ensures we never see dist again in git. 👋 * Adds start, stop, connect, and disconnect events to core server. * Allows events onConnect and onDisconnect in reactotron-react-native. * Hooks up the cli to connect/disconnect and start/stop. 🌟 * Use the *real* source for demo-react-native's internal deps. This is nicer for devs. But don't get wrong. It still sucks having to do this. * Switches to src in reactotron-core-server's package.json. This is just so we don't have to compile things into dist and copy 'em over. We'll have to rethink this for production deploys though. * Adds a plugin system to reactotron-core-client. * Adds the transports for socket.io back in. The sad part about this is that didn't work before the refactor. Now it does. Uh oh. * Guts the reactotron-react-native module. Gladly. Also, configure and connect are two different functions now. * Adds a logging plugin to the core client. * Hooks up the cli logging functionality. * Adds a demo of sending 3 log types in React Native. * Adds a stopwatch utility. * Updates the plugin interface to accept a config object. * Nicer plugins location and a new decorator plugin (infinitered#76) Adds onPlugin, a plugins directory, and a decorator plugin. * Adds benchmark support. (infinitered#77) * Adds reactotron-redux plugin with action tracking. (infinitered#78) * Adds a script that throws messages at the server for testing. (infinitered#81) * Adds state and api responses into core client. (infinitered#82) * Renames addPlugin to use. (infinitered#83) * Adds onCommand support to plugins. (infinitered#84) * Adds an apisauce plugin. (infinitered#85) * Adds redux keys & values. (infinitered#86) * Standardizes the plugin's interface. (infinitered#87) * Updates plugins to have the same reactotron interface. * Changes the plugin interface to () => reactotron => {}. * Removes the useless decorate plugin. * Adds an npm run e2e for my own sanity. * Fixes the decorator functionality I just removed. (infinitered#88) * Adds redux subscriptions. (infinitered#89) * Adds state.action.dispatch support. (infinitered#90) * Updates the version numbers getting ready for 1.0. (infinitered#91) * Bumps React Native deps to 0.31.0. (infinitered#92) * Resends the subscribed values when a fresh client connects. (infinitered#93) * Refactors the CLI and moves much goodies into core-server. (infinitered#94) * Adds a commands manager to hold the latest commands. * Adds a test for the maximum list size. * Converts connections to mobx. Holy crap. * Drives the connections ui through mobx. * Sends logs through the new command event system. * Organizes ui code by behaviour. * Adds the missing ui refactorage from the last commit. Bad Steve. * Removes the old console.error command. * Moves the ui code into its own directory. * Busts interactions out to it's own file. * Adds the actual interactions file. :/ * Moves api response drawing to it's new home. * Moves the benchmark report. * Refactors state.action.complete drawing. * Removes keys and values request into place. Also got some pro advice about using asFlat for the command queues. * Moves state.values.change into place. * Renames all redux things to state. * Moves send internal to the context object. * Moves keys and values requests up to the core server. * Moves subscription logic up to core server. * Fixes a broken test because of the onConnect message sent. * Moves dispatching to core-server and fixes some binding issues in redux. * Fixes some missed ui interactions. * Client server identification (infinitered#95) * Removes duplicate function. * Adds client identification. * Adds a react-js client with a create-react-app demo! (infinitered#97) * Electron Version Base Functionality (infinitered#99) * Adds Electron starting point and basic layout. * Tweaks the icons a bit. * Bridges reactotron-core-server over the 2 electron processes. * Adds logging to the app. * Updates the file structure of the app directory. * Adds a streaming mode. (infinitered#101) * Minimizes the UI footprint. (infinitered#102) * Adds client intro rendering. (infinitered#103) * Adds benchmark rendering. (infinitered#104) * Add a state modal to sample the workflow. (infinitered#105) * Simplifies server code, gladly. (infinitered#106) * Fixes up some React warnings. (infinitered#107) * Tidying up, delinting, and pruning. (infinitered#108) * Moves components around. * Fixes a rogue warning. * Removes linting issues. * Removes dead code. * Adds a state values renderer. (infinitered#109) * Adds pin-to-top, appearance animation, and perf boosts. (infinitered#110) * Cleans up the layout & lookup of our "tables". (infinitered#111) * Hoists text to the top prepping for i18n. (infinitered#112) * Adds support for state.keys.response. (infinitered#113) * Adds dispatch support. (infinitered#114) * Adds theme support. (infinitered#115) * Adds more guts to the react js demo. (infinitered#116) * Adds an errors plugin (reactjs) and stack traces. (infinitered#117) * Adds collapse/expand mechanism. Tuning colours. (infinitered#118) * Adds state watching support. (infinitered#119) * Adds an app icon. (infinitered#120) * Bumpity bump Lerna. (infinitered#121) * CLI fixes (infinitered#122) * Rounds the action milliseconds in the cli. * Fixes the welcome message when a client connects. * Ports over secure mode from current Reactotron. (infinitered#123) * Switch the app's dev port out of the way of the demo. (infinitered#124) * Adds react native stack traces! Reworks the rn demo. (infinitered#125) * Adds the icon to the footer. (infinitered#126) * Updates the Help menu. (infinitered#127) * Addresses issues with package.json and other busy work. (infinitered#128) * Bumps version to 0.91.0. * v0.92.0 * Add help dialog with CMD + ? (infinitered#133) * Basic show/hide new dialog working * Quickhelp is in place and styled * Adds an important flag to commands. (infinitered#134) * Adds a help icon and pushes a few pixels around. (infinitered#135) * Adds a codesigning script. (infinitered#136) * Adds a readme with a change log... rough for now. * v0.93.0 * Bumps the cli because Lerna didn't. My fault. * Adds an always on top menu item. (infinitered#137) * Renders actions with flat data as a table instead of a tree. (infinitered#138) * Adds a replay action button. (infinitered#139) * Adds subscriptions to the timeline (infinitered#140) * Adds subscriptions to the timeline. * Prevents duplicate subscription commands from showing. * Shows the scrollbar permanently dodging janky reflows. (infinitered#141) * Adds edit & dispatch support. (infinitered#142) * Adds subscription diffs. (infinitered#143) * Cleans up the tree. It's very noisy in there. (infinitered#144) * Organizes the api response. (infinitered#145) * Adds the display command type; for custom messages. (infinitered#146) * Adds tabs and help. (infinitered#147) * v0.94.0 * Updates the changelog. * Adds a publish script. * Adds stringify-object to the app. Oops. * Changes the text colour on important actions so eyes stop bleeding. (infinitered#148) * Fixes the codesigning script. * Adds a quick start guide for React JS. (infinitered#149) * Corrects some hyperlinking newbishness. * Simplifies the readme in demo-react-js. (infinitered#150) * Adds more substance to the quick start. (infinitered#151) * Adds a quick start guide for React Native. (infinitered#152) * Adds a better readme + gif demos. (infinitered#153) * Adds docs for the trackGlobalErrors plugin. (infinitered#154) * Fixes a formatting issue with the error docs. * Fixes and clarifies more with the error docs. * Adds reactotron-redux documentation. (infinitered#155) * Adds reactotron-apisauce documentation. (infinitered#156)
1 parent 962a0b5 commit 97d86c7

File tree

500 files changed

+12281
-1040
lines changed

Some content is hidden

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

500 files changed

+12281
-1040
lines changed

.gitignore

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
npm-debug.log
21
node_modules
3-
docs
4-
.tern-project
5-
.tern-config
6-
2+
lerna-debug.log
3+
npm-debug.log.*
4+
npm-debug.log

docs/contributing.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Contributing
2+
3+
### Getting Started
4+
5+
Clone & switch to the right branch.
6+
7+
```
8+
git clone [email protected]:skellock/reactotron.git
9+
cd reactotron
10+
git checkout next
11+
```
12+
13+
Run the setup script to install the dependencies & run tests.
14+
15+
```
16+
npm run welcome
17+
```
18+
19+
20+
### Code Style
21+
22+
We use [standard.js](https://github.com/feross/standard). It is passive-agressively enforced.
23+
Stern looks will be handed out. For repeat offenders, there WILL be finger wagging.
24+
25+
26+
### Monorepo & Lerna
27+
28+
This is a monorepo: multiple JS packages in 1 git repo.
29+
30+
We use [lerna](https://github.com/lerna/lerna) to help us.
31+
32+
33+
### Funky internal dependencies
34+
35+
`demo-react-native` is a React Native sample app. It depends on
36+
`reactotron-react-native` which in turn depends on both `socket.io` and
37+
`reactotron-core-client`.
38+
39+
Usually npm handles this right?
40+
41+
So why am I typing this?
42+
43+
Well, React Native (<=0.30.0) makes this hard to link to the dependencies
44+
within this repo.
45+
46+
How we current get around this is by:
47+
48+
1. adding `socket.io` to the deps of `demo-react-native` :(
49+
1. copy built versions of `reactotron-core-client` and `reactotron-react-native` manually to `node_modules` :(
50+
51+
Many tears were shed and this is the least shitty solution I could muster.
52+
53+
In the root, you can run `npm copy-internal-deps` to make them copy over.
54+
55+
But since you're copying built dependencies, you'll need to run `npm run build` first
56+
if you're doing this to bring forward changes in those dependency libraries.

docs/images/apisauce/apisauce.jpg

42.3 KB
Loading
Loading
29 KB
Loading
34.2 KB
Loading
28.6 KB
Loading
Loading
Loading
50.4 KB
Loading
Loading
39.7 KB
Loading
48.7 KB
Loading
Loading
Loading
72.2 KB
Loading

docs/images/readme/Reactotron-128.png

11 KB
Loading

docs/images/readme/Reactotron-64.png

4.57 KB
Loading
5.97 MB
Loading
317 KB
Loading

docs/images/redux/dispatching.jpg

43.2 KB
Loading
104 KB
Loading

docs/images/redux/subscriptions.jpg

65.6 KB
Loading
45.4 KB
Loading

docs/plugin-apisauce.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# reactotron-apisauce
2+
3+
[Apisauce](http://github.com/skellock/apisauce) is a lightweight wrapper around the fantastic [Axios](https://github.com/mzabriskie/axios) networking library.
4+
5+
![API Response](./images/apisauce/apisauce.jpg)
6+
7+
# Installing
8+
9+
`npm i --save-dev reactotron-apisauce`
10+
11+
12+
# Configuring
13+
14+
In the place where you setup your reactotron configuration, you import `reactotron-apisauce` plugin and throw it at Reactotron.
15+
16+
```js
17+
import apisaucePlugin from 'reactotron-apisauce' // <--- import
18+
19+
// then plug it in when you configure Reactotron.
20+
21+
Reactotron
22+
.configure()
23+
.use(apisaucePlugin()) // <-- here we go!!!
24+
.connect()
25+
```
26+
27+
Next, wherever you create your api for you application, bring in Reactotron and attach the monitor to your apisauce instance.
28+
29+
```js
30+
import Reactotron from 'reactotron-react-js'
31+
// import Reactotron from 'reactotron-react-native' // or use this for mobile
32+
33+
// Apisauce has a feature where you can attach a handler to watch
34+
// all requests/response flowing through your api. You can hook this up:
35+
api.addMonitor(Reactotron.apisauce)
36+
37+
// or ...
38+
39+
// if you just wanted to track on 500's
40+
api.addMonitor(response => {
41+
if (response.problem === 'SERVER_ERROR')
42+
Reactotron.apisauce(response)
43+
})
44+
```

docs/plugin-redux.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# reactotron-redux
2+
3+
[Redux](http://redux.js.org/) is library for managing global state. It's pretty damn awesome.
4+
5+
And everyone knows when you combine two great things, you get a super-awesome thing. Except for toothpaste & orange juice. Keep those separate.
6+
7+
![Keys and Values](./images/redux/redux-keys-values.jpg)
8+
9+
![Dispatching](./images/redux/dispatching.jpg)
10+
11+
![Subscriptions](./images/redux/subscriptions.jpg)
12+
13+
14+
# Installing
15+
16+
`reactotron-redux` is a plugin which lives in a different npm package. You can install it by typing:
17+
18+
```
19+
npm install --save-dev reactotron-redux
20+
```
21+
22+
# Features
23+
24+
* track when actions are dispatch including timing
25+
* subscribe to changes within the state tree
26+
* pull values out on demand
27+
* view list of keys
28+
* dispatch actions from Reactotron
29+
30+
# Setting Up
31+
32+
This plugin connects Reactotron to Redux via Redux's [Store Enhancer](http://redux.js.org/docs/Glossary.html#store-enhancer) plugin system.
33+
34+
You'll configure where you setup your Redux store. In that file, we'll import both `reactotron-redux` and Reactotron.
35+
36+
```js
37+
import Reactotron from 'reactotron-react-js'
38+
// import Reactotron from 'reactotron-react-native' // if on mobile
39+
import createReactotronEnhancer from 'reactotron-redux'
40+
```
41+
42+
`createReactotronEnhancer` is a function that creates an enhancer ready to inject into Redux. There are 2 parameters.
43+
44+
1. `reactotronInstance` (required) - `Reactotron` itself. It's the object that came out of the import at the top.
45+
2. `options` (optional) - An object providing configuration option to the store enhancer.
46+
47+
Use take the return value and put that into your call to `createStore()`.
48+
49+
**IMPORTANT: Your enhancer should go first if there are multiple enhancers.**
50+
51+
Here's a few examples in action:
52+
53+
```js
54+
const reactotronEnhancer = createReactotronEnhancer(Reactotron)
55+
56+
// where there are no other enhancers
57+
createStore(rootReducer, reactotronEnhancer)
58+
59+
// using Redux's compose() to bring together multiple enhancers
60+
createStore(rootReducer, compose(reactotronEnhancer, applyMiddleware(logger, sagaMiddleware)))
61+
```
62+
63+
See the demos for more examples.
64+
65+
# Options
66+
67+
`createReactotronEnhancer` supports options as the 2nd parameter.
68+
69+
`except` is an array of strings that match actions flowing through Redux.
70+
71+
If you have some actions you'd rather just not see (for example, `redux-saga`)
72+
triggers a little bit of noise, you can suppress them:
73+
74+
```js
75+
createReactotronEnhancer(Reactotron, {
76+
except: ['EFFECT_TRIGGERED', 'EFFECT_RESOLVED', 'EFFECT_REJECTED']
77+
})
78+
```
79+
80+
`isActionImportant` is a way to mark certain actions as "important". Important messages are display in a bolder style that gets your attention within Reactotron.
81+
82+
It is a function that accepts the action and returns a `boolean`. `true` is important. `false` is normal.
83+
84+
```js
85+
createReactotronEnhancer(Reactotron, {
86+
isActionImportant: action => action.type === 'FORMAT_HARD_DRIVE'
87+
})
88+
```

docs/plugin-track-global-errors.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Track Global Errors
2+
3+
Both `reactotron-react-native` and `reactotron-react-js` ship with a plugin called `trackGlobalErrors`.
4+
5+
The goal of this plugin is to ensure all errors will get thrown over to Reactotron for display.
6+
7+
![Installing The App](./images/track-global-errors/stack-trace.jpg)
8+
9+
10+
# Usage
11+
12+
Wherever you setup your Reactotron in your app, you also add the additional plugin on the `import` line.
13+
14+
```js
15+
import Reactotron, { trackGlobalErrors } from 'reactotron-react-native'
16+
```
17+
18+
or
19+
20+
```js
21+
import Reactotron, { trackGlobalErrors } from 'reactotron-react-js'
22+
```
23+
24+
Next, add it as a plugin to Reactotron.
25+
26+
```js
27+
Reactotron
28+
.configure()
29+
.use(trackGlobalErrors()) // <--- here we go!
30+
.connect()
31+
```
32+
33+
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.
34+
35+
For example, on React Native, perhaps you'd like to leave off any frames sourced from React Native itself?
36+
37+
```js
38+
Reactotron
39+
.configure()
40+
.use(trackGlobalErrors({
41+
veto: frame => frame.fileName.indexOf('/node_modules/react-native/') >= 0
42+
}))
43+
.connect()
44+
```
45+
46+
`veto` is a function that takes an `object` and returns a `boolean`. `true` = ditch it. `false` = keep it.
47+
48+
The frame object passed into `veto` has these properties.
49+
50+
```
51+
functionName: the name of the function or null if an anonymous function
52+
lineNumber: the line number of the error
53+
columnNumber: the column number of the error
54+
fileName: the name of the file
55+
```
56+
57+
### React JS Source Maps
58+
59+
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.
60+
61+
You also have the option to not do source map lookups, but still pass errors along by going into offline mode.
62+
63+
```js
64+
Reactotron
65+
.configure()
66+
.use(trackGlobalErrors({
67+
offline: true
68+
}))
69+
.connect()
70+
```
71+
72+
73+
# How It Works Internally
74+
75+
### React JS
76+
77+
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.
78+
79+
80+
### React Native
81+
82+
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.
83+
84+
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.

0 commit comments

Comments
 (0)