Skip to content

Commit 2a1b0c9

Browse files
committed
merging master
2 parents 0a8b2b7 + aa5c877 commit 2a1b0c9

Some content is hidden

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

63 files changed

+12766
-2486
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ npm-debug.log
44
/coverage
55
/dist
66
/debug
7+
/node_modules
78

8-
.nyc_output
9+
.nyc_output

.nycrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
"plugins": ["transform-decorators-legacy"],
33
"require": [
44
"babel-register",
5-
"/react/test/testHelpers/requireSources.js"
5+
"./test/testHelpers/requireSources.js"
66
]
77
}

.travis.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
sudo: required
2-
32
services:
43
- docker
5-
64
before_install:
75
- ./docker/build-container.sh
8-
96
language: node_js
107
node_js:
11-
- "8"
8+
- "8"
9+
script:
10+
- ./docker/test.sh

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ MAINTAINER mac <[email protected]>
44
# install the node modules at container build time
55
RUN mkdir -p /react
66
ADD package.json /react/package.json
7-
RUN cd /react && npm install --silent
7+
RUN cd /react && npm install --save-dev --silent
88

99
# Now add our project code
1010
ADD . /react

README.md

Lines changed: 29 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
![alt text](https://github.com/mac-s-g/react-json-view/blob/master/doc/rjv-icon-alt.png?raw=true)
22

3-
[![npm](https://img.shields.io/npm/v/react-json-view.svg)](https://www.npmjs.com/package/react-json-view) [![npm](https://img.shields.io/npm/l/react-json-view.svg)](https://github.com/mac-s-g/react-json-view/blob/master/LISCENSE) [![Build Status](https://travis-ci.org/mac-s-g/react-json-view.svg)](https://travis-ci.org/mac-s-g/react-json-view) [![Coverage Status](https://coveralls.io/repos/github/mac-s-g/react-json-view/badge.svg?branch=master)](https://coveralls.io/github/mac-s-g/react-json-view?branch=master)
3+
[![npm](https://img.shields.io/npm/v/react-json-view.svg)](https://www.npmjs.com/package/react-json-view) [![npm](https://img.shields.io/npm/l/react-json-view.svg)](https://github.com/mac-s-g/react-json-view/blob/master/LISCENSE) [![Build Status](https://travis-ci.org/mac-s-g/react-json-view.svg)](https://travis-ci.org/mac-s-g/react-json-view) [![Coverage Status](https://coveralls.io/repos/github/mac-s-g/react-json-view/badge.svg?branch=master)](https://coveralls.io/github/mac-s-g/react-json-view?branch=master) [![Join the community on Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://spectrum.chat/react-json-view)
44

55
# react-json-view
66
RJV is a react component for displaying and editing javascript **arrays** and **JSON objects**.
@@ -48,6 +48,7 @@ Name|Type|Default|Description
4848
`indentWidth`|`integer`|4|Set the indent-width for nested objects
4949
`collapsed`|`boolean` or `integer`|`false`|When set to `true`, all nodes will be collapsed by default. Use an integer value to collapse at a particular depth.
5050
`collapseStringsAfterLength`|`integer`|`false`|When an integer value is assigned, strings will be cut off at that length. Collapsed strings are followed by an ellipsis. String content can be expanded and collapsed by clicking on the string value.
51+
`shouldCollapse`|`(field)=>{}`|`false`|Callback function to provide control over what objects and arrays should be collapsed by default. An object is passed to the callback containing `name`, `src`, `type` ("array" or "object") and `namespace`.
5152
`groupArraysAfterLength`|`integer`|`100`|When an integer value is assigned, arrays will be displayed in groups by count of the value. Groups are displayed with brakcet notation and can be expanded and collapsed by clickong on the brackets.
5253
`enableClipboard`|`boolean` or `(copy)=>{}`|`true`|When prop is not `false`, the user can copy objects and arrays to clipboard by clicking on the clipboard icon. Copy callbacks are supported.
5354
`displayObjectSize`|`boolean`|`true`|When set to `true`, objects and arrays are labeled with size
@@ -108,47 +109,36 @@ The following object will be passed to your method:
108109
Returning `false` from a callback method will prevent the src from being affected.
109110

110111
### Contributing to the source code
111-
#### Linux and Docker (Recommended)
112-
Use Docker to run the source code in a local development environment:
113-
1. Clone this repo
114-
2. Build the docker image
115-
* `cd react-json-view`
116-
* `./docker/build-container.sh`
117-
* *note:* you may need to use `sudo` to run docker commands
118-
3. Run the docker container on port 2000. This will run the webpack-dev-server with hot-reloading enabled.
119-
* `./docker/dev-server.sh`
120-
* *note:* you may need to use `sudo` to run the server file
121-
4. Open port 2000 in your browser
122-
* navigate to localhost:2000
123-
124-
Your source code will be mounted inside the docker container. The container is built on the latest `Node:slim` image.
125-
126-
Webpack-dev-server is running in the container and hot-reloading when changes are made locally.
127-
128-
All node modules are installed within the container, so make sure to rebuild your container if you make changes to package.json (see step 2, above).
129-
130-
#### Standard Workflow
131-
Development workflow is setup for linux users with Docker installed. You can contribute with other configurations but I have not tested them.
132-
133-
1. Clone this repo
134-
2. Install npm dependencies
112+
#### Run the Dev Server
113+
114+
```bash
115+
# clone this repository
116+
git clone [email protected]:mac-s-g/react-json-view.git && cd react-json-view
117+
# install dependencies
118+
npm install --save-dev
119+
# run the dev server with hot reloading
120+
npm run dev
135121
```
136-
cd react-json-view
137-
npm install
122+
Webpack Dev Server should automatically open up http://localhost:2000 in your web browser. If it does not, open a browser and navigate to port 2000. The hot reloader will automatically reload when files are modified in the `/src/` directory.
123+
124+
#### Run the Production Build
125+
126+
```bash
127+
# run the build (note: you may need to use `sudo` priveledges to run the build successfully)
128+
npm run build
138129
```
139-
3. Run webpack to start webpack-dev-server with hot-reloading enabled
140-
* `npm run dev:hot`
141-
4. Open port 2000 in your browser
142-
* navigate to localhost:2000
130+
Please add tests for your code before posting a pull request.
131+
132+
You can run the test suite with `npm run test` or `npm run test:watch` to automatically reload when files are modified.
133+
134+
#### Docker Tools
135+
136+
I recommend using docker for development because it enforces environmental consistency.
137+
138+
For information about contributing with Docker, see the [README in ./docker](https://github.com/mac-s-g/react-json-view/blob/master/docker/README.md#contributing-to-this-project-using-docker).
139+
143140

144141
### Inspiration
145142
I drew a ton of design ideas from [react-json-tree](https://github.com/alexkuz/react-json-tree). Thanks to the RJT contributors for putting together an awesome component!
146143

147-
I'm also inspired by users who come up with interesting feature requests. Reach out to me with ideas for this project or other projects you want to collaborate on. My email address is listed on my [github user page](https://github.com/mac-s-g).
148-
149-
### To-Do's
150-
1. Improve documentation for `onEdit`, `onAdd` and `onDelete` props
151-
2. Improve style organization
152-
3. Continue size analysis and remove larger dependencies from build where possible
153-
4. As always, improve test quality and coverage
154-
5. update screenshots and docs in README
144+
I'm also inspired by users who come up with interesting feature requests. Reach out to me with ideas for this project or other projects you want to collaborate on. My email address is listed on my [github user page](https://github.com/mac-s-g).

demo/dist/main.js

Lines changed: 4 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)