Skip to content

Commit 7e16090

Browse files
jaredlyShubham kanodia
authored andcommitted
Add npm package for standalone devtools app (facebook#487)
* debugging electron connection * add npm package * ignore copied files * add readme * cleanup
1 parent c50acd8 commit 7e16090

7 files changed

Lines changed: 989 additions & 3 deletions

File tree

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,7 @@
1717
/backend/integration/build
1818
/shells/firefox/*.xpi
1919
npm-debug.log
20+
/package/index.html
21+
/package/index.js
22+
/package/build
23+
/package/node_modules

package/Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
build:
3+
@echo "Copying files from electron"
4+
@cp -r ../shells/electron/index.js ../shells/electron/index.html ../shells/electron/build ./
5+
6+
.PHONY: build

package/README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# `npm install react-devtools`
2+
3+
## Why use this?
4+
If you need to debug a react page somewhere other than Chrome on desktop (a
5+
mobile browser, an embedded webview, safari, etc), the `react-devtools`
6+
package is for you!
7+
8+
## Usage
9+
1) Add `import 'react-devtools'` to the top of your entry file
10+
```
11+
import 'react-devtools'
12+
import React, {Component} from 'react'
13+
```
14+
15+
2) Run the react-devtools standalone app.
16+
```
17+
./node_modules/.bin/react-devtools
18+
```
19+
20+
3) Profit!
21+
Make sure that your `react-devtools` import comes *before* your `react`
22+
import.
23+
24+
## Usage with non-localhost
25+
This is not supported yet - stay tuned!
26+
27+
## Developing
28+
1) `(cd ../shells/electron && npm run build)`
29+
2) `make`
30+
3) `npm publish`

package/bin.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/usr/bin/env electron
2+
require('./index.js')

package/package.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "react-devtools",
3+
"version": "1.0.3",
4+
"description": "Use react-devtools outside of the browser",
5+
"main": "./build/embed.js",
6+
"repository": {
7+
"url": "https://github.com/facebook/react-devtools.git",
8+
"type": "git"
9+
},
10+
"bin": {
11+
"react-devtools": "./bin.js"
12+
},
13+
"author": "Jared Forsyth",
14+
"license": "BSD-3-Clause",
15+
"dependencies": {
16+
"electron": "^1.4.15",
17+
"ip": "^1.1.4",
18+
"ws": "^1.1.1"
19+
}
20+
}

0 commit comments

Comments
 (0)