Skip to content

Commit e8d98cc

Browse files
committed
Reorganized the project to conform to NWB React Component.
1 parent c551caa commit e8d98cc

18 files changed

+6560
-8696
lines changed

.gitignore

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
node_modules/
2-
build/
1+
/coverage
2+
/demo/dist
3+
/es
4+
/lib
5+
/node_modules
6+
/umd
7+
npm-debug.log*
38
.DS_Store
49
yarn-error.log

.npmignore

-1
This file was deleted.

.travis.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
sudo: false
2+
3+
language: node_js
4+
node_js:
5+
- 8
6+
7+
before_install:
8+
- npm install codecov.io coveralls
9+
10+
after_success:
11+
- cat ./coverage/lcov.info | ./node_modules/codecov.io/bin/codecov.io.js
12+
- cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
13+
14+
branches:
15+
only:
16+
- master

CONTRIBUTING.md

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
## Prerequisites
2+
3+
[Node.js](http://nodejs.org/) >= 6 must be installed.
4+
5+
## Installation
6+
7+
- Running `npm install` in the component's root directory will install everything you need for development.
8+
9+
## Demo Development Server
10+
11+
- `npm start` will run a development server with the component's demo app at [http://localhost:3000](http://localhost:3000) with hot module reloading.
12+
13+
## Running Tests
14+
15+
- `npm test` will run the tests once.
16+
17+
- `npm run test:coverage` will run the tests and produce a coverage report in `coverage/`.
18+
19+
- `npm run test:watch` will run the tests on every change.
20+
21+
## Building
22+
23+
- `npm run build` will build the component for publishing to npm and also bundle the demo app.
24+
25+
- `npm run clean` will delete built resources.

README

-1
This file was deleted.

README.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# react-jsonschema-form-ui
2+
3+
[![Travis][build-badge]][build]
4+
[![npm package][npm-badge]][npm]
5+
[![Coveralls][coveralls-badge]][coveralls]
6+
7+
Describe react-jsonschema-form-ui here.
8+
9+
[build-badge]: https://img.shields.io/travis/user/repo/master.png?style=flat-square
10+
[build]: https://travis-ci.org/user/repo
11+
12+
[npm-badge]: https://img.shields.io/npm/v/npm-package.png?style=flat-square
13+
[npm]: https://www.npmjs.org/package/npm-package
14+
15+
[coveralls-badge]: https://img.shields.io/coveralls/user/repo/master.png?style=flat-square
16+
[coveralls]: https://coveralls.io/github/user/repo
File renamed without changes.

sandbox/src/App.js demo/src/App.js

+16-20
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import React from 'react';
22
import Form from 'react-jsonschema-form';
3-
import bootstrap from 'bootstrap';
4-
import "../node_modules/bootstrap/dist/css/bootstrap.min.css";
5-
import { ArrayFieldTemplate } from './components/fields';
3+
import { ArrayFieldTemplate } from '../../src/fields';
64
import { CurrencyWidget, ReactDatePickerWidget, ReactSelectWidget } from '../../src/widgets';
75
import './App.css';
86

@@ -87,23 +85,21 @@ const uiSchema = {
8785
function App() {
8886
return (
8987
<div className="App">
90-
<div className="container">
91-
<br /><br />
92-
<div className="row">
93-
<div className="col-md-4">
94-
<h1>Test Form</h1>
95-
<br />
96-
<Form
97-
schema={schema}
98-
uiSchema={uiSchema}
99-
formData={{date: "2015-08-02T00:00:00.000Z"}}
100-
ArrayFieldTemplate={ArrayFieldTemplate}
101-
widgets={widgets}
102-
onChange={log("changed")}
103-
onSubmit={log("submitted")}
104-
onError={log("errors")}>
105-
</Form>
106-
</div>
88+
<br /><br />
89+
<div className="row">
90+
<div className="col-md-4">
91+
<h2>Test Form</h2>
92+
<br />
93+
<Form
94+
schema={schema}
95+
uiSchema={uiSchema}
96+
formData={{date: "2015-08-02T00:00:00.000Z"}}
97+
ArrayFieldTemplate={ArrayFieldTemplate}
98+
widgets={widgets}
99+
onChange={log("changed")}
100+
onSubmit={log("submitted")}
101+
onError={log("errors")}>
102+
</Form>
107103
</div>
108104
</div>
109105
</div>
File renamed without changes.

demo/src/index.js

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import React, {Component} from 'react';
2+
import {render} from 'react-dom';
3+
import bootstrap from 'bootstrap';
4+
import "../../node_modules/bootstrap/dist/css/bootstrap.min.css";
5+
import './index.css';
6+
import App from './App';
7+
8+
class Demo extends Component {
9+
render() {
10+
return (
11+
<div className="container">
12+
<br /><br />
13+
<h1>React JSON-Schema UI Fields &amp; Widgets</h1>
14+
<App />
15+
</div>
16+
)
17+
}
18+
}
19+
20+
render(<Demo/>, document.querySelector('#demo'))

nwb.config.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
type: 'react-component',
3+
npm: {
4+
esModules: true,
5+
umd: false
6+
}
7+
}

package.json

+35-22
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,51 @@
11
{
22
"name": "react-jsonschema-form-ui",
3-
"version": "0.1.3",
3+
"version": "0.1.4",
44
"private": false,
5+
"description": "react-jsonschema-form-ui React component",
6+
"main": "lib/index.js",
7+
"module": "es/index.js",
8+
"files": [
9+
"css",
10+
"es",
11+
"lib",
12+
"umd"
13+
],
14+
"scripts": {
15+
"build": "nwb build-react-component",
16+
"clean": "nwb clean-module && nwb clean-demo",
17+
"prepublishOnly": "npm run build",
18+
"start": "nwb serve-react-demo",
19+
"test": "nwb test-react",
20+
"test:coverage": "nwb test-react --coverage",
21+
"test:watch": "nwb test-react --server"
22+
},
523
"dependencies": {
624
"accounting": "^0.4.1",
725
"bootstrap": "^4.4.1",
826
"jquery": "^3.4.1",
927
"popper.js": "^1.16.1",
1028
"prop-types": "^15.7.2",
11-
"react": "^16.13.0",
1229
"react-datepicker": "^2.13.0",
13-
"react-dom": "^16.13.0",
1430
"react-dropzone": "^10.2.1",
31+
"react-jsonschema-form": "^1.8.1",
1532
"react-jsonschema-form-bs4": "^1.7.1",
16-
"react-scripts": "^3.4.0",
1733
"react-select": "^3.0.8"
1834
},
19-
"scripts": {
20-
"start": "react-scripts start",
21-
"build": "react-scripts build",
22-
"test": "react-scripts test",
23-
"eject": "react-scripts eject"
35+
"peerDependencies": {
36+
"react": "16.x"
37+
},
38+
"devDependencies": {
39+
"nwb": "0.23.x",
40+
"react": "^16.13.0",
41+
"react-dom": "^16.13.0"
2442
},
25-
"main": "src/index.js",
26-
"browserslist": {
27-
"production": [
28-
">0.2%",
29-
"not dead",
30-
"not op_mini all"
31-
],
32-
"development": [
33-
"last 1 chrome version",
34-
"last 1 firefox version",
35-
"last 1 safari version"
36-
]
37-
}
43+
"author": "Matt Monihan",
44+
"homepage": "",
45+
"license": "MIT",
46+
"repository": "",
47+
"keywords": [
48+
"react-component",
49+
"widgets"
50+
]
3851
}

sandbox/index.html

-13
This file was deleted.

sandbox/src/index.js

-12
This file was deleted.

sandbox/src/serviceWorker.js

-135
This file was deleted.

tests/.eslintrc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"env": {
3+
"mocha": true
4+
}
5+
}

0 commit comments

Comments
 (0)