-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from mozilla-services/packaging
Prepare for packaging.
- Loading branch information
Showing
9 changed files
with
66 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,4 @@ | ||
{ | ||
"stage": 0, | ||
"env": { | ||
"development": { | ||
"plugins": ["react-transform"] | ||
} | ||
} | ||
"stage": 0 | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
src/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,5 +6,6 @@ node_js: | |
env: | ||
- ACTION=test | ||
- ACTION="run lint" | ||
- ACTION="run dist" | ||
script: | ||
- npm $ACTION |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,10 +9,22 @@ Requires React 0.14+. | |
|
||
## Installation | ||
|
||
As a npm-based project dependency: | ||
|
||
``` | ||
$ npm install react-jsonschema-form --save | ||
``` | ||
|
||
As an standalone CDN url: | ||
|
||
```html | ||
<script src="https://npmcdn.com/[email protected]/dist/react-jsonschema-form-0.1.0.js"></script> | ||
``` | ||
|
||
Source maps are available at [this url](https://npmcdn.com/[email protected]/dist/react-jsonschema-form-0.1.0.js.map). | ||
|
||
Note that the CDN version **does not** embed *react* nor *react-dom*. | ||
|
||
## Usage | ||
|
||
```js | ||
|
@@ -31,16 +43,20 @@ const schema = { | |
} | ||
}; | ||
|
||
const log = (type) => console.log.bind(console, type); | ||
|
||
const App = ({schema}) => { | ||
return <Form schema={schema} | ||
onChange={log("changed")} | ||
onSubmit={log("submitted")} | ||
onError={log("errors")} />; | ||
const formData = { | ||
title: "First task", | ||
done: true | ||
}; | ||
|
||
render(<App schema={schema} />, document.getElementById("app")); | ||
const log = (type) => console.log.bind(console, type); | ||
|
||
render(( | ||
<Form schema={schema} | ||
formData={formData} | ||
onChange={log("changed")} | ||
onSubmit={log("submitted")} | ||
onError={log("errors")} /> | ||
), document.getElementById("app")); | ||
``` | ||
|
||
## License | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
var pkg = require("./package"); | ||
|
||
module.exports = { | ||
cache: true, | ||
context: __dirname + "/src", | ||
entry: "./index.js", | ||
output: { | ||
path: "./dist", | ||
publicPath: "/dist/", | ||
filename: "react-jsonschema-form-" + pkg.version + ".js", | ||
library: "JSONSchemaForm", | ||
libraryTarget: "umd" | ||
}, | ||
devtool: "source-map", | ||
externals: { | ||
react: { | ||
root: "React", | ||
commonjs: "react", | ||
commonjs2: "react", | ||
amd: "react" | ||
} | ||
}, | ||
module: { | ||
loaders: [ | ||
{ | ||
test: /\.js$/, | ||
loaders: ["babel"], | ||
} | ||
] | ||
} | ||
}; |