From 78374357185031ebfcc4baea9a13ebf61e0a49bc Mon Sep 17 00:00:00 2001 From: Mark Finger Date: Sun, 28 Jun 2015 21:05:32 +1000 Subject: [PATCH 001/116] Docs --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 88880dc..77094a6 100644 --- a/README.md +++ b/README.md @@ -281,7 +281,9 @@ Running the tests ----------------- ```bash -mkvirtualenv django-react pip install -r requirements.txt +cd tests +npm install +cd .. python runtests.py ``` From ccb39e8e26bcf774b31beb360ff8cc280920170c Mon Sep 17 00:00:00 2001 From: Mark Finger Date: Sun, 28 Jun 2015 21:18:28 +1000 Subject: [PATCH 002/116] Bump js-host --- example/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/package.json b/example/package.json index d0c027f..460b40e 100644 --- a/example/package.json +++ b/example/package.json @@ -4,7 +4,7 @@ "babel-core": "^5.4.3", "babel-loader": "^5.1.0", "jquery": "^2.1.4", - "js-host": "^0.11.4", + "js-host": "^0.12.0", "marked": "^0.3.3", "node-libs-browser": "^0.5.0", "react": "^0.13.3", From 917cd1fbb0d180250ec19542a9d0add3bf17c4b1 Mon Sep 17 00:00:00 2001 From: Mark Finger Date: Sun, 28 Jun 2015 21:18:38 +1000 Subject: [PATCH 003/116] Bump js-host --- tests/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/package.json b/tests/package.json index c248bfe..251a5d3 100644 --- a/tests/package.json +++ b/tests/package.json @@ -3,7 +3,7 @@ "dependencies": { "babel-core": "^5.4.3", "babel-loader": "^5.1.0", - "js-host": "^0.11.4", + "js-host": "^0.12.0", "node-libs-browser": "^0.5.0", "react": "^0.13.3", "react-render": "^0.3.0", From 56aa2713304d206cc6e193adcced6ed6fff8b02f Mon Sep 17 00:00:00 2001 From: Mark Finger Date: Tue, 7 Jul 2015 14:43:22 +1000 Subject: [PATCH 004/116] Removed the js-host and webpack integrations. Mindful of the issues experienced with js-host and the limited workflow offered by the webpack integration, the project is being shifted towards a utility role. Pre-rendering is the only thing that the library will perform. Access to a render server will be opt-in, rather than required. --- example/README.md | 2 +- example/host.config.js | 9 - example/package.json | 2 + example/requirements.txt | 1 - example/static/css/main.css | 15 - example/static/jsx/Comment.jsx | 16 - example/static/jsx/CommentBox.jsx | 58 - example/static/jsx/CommentForm.jsx | 38 - example/static/jsx/CommentList.jsx | 19 - .../vendor/bootstrap/css/bootstrap-theme.css | 476 - .../bootstrap/css/bootstrap-theme.css.map | 1 - .../bootstrap/css/bootstrap-theme.min.css | 5 - .../static/vendor/bootstrap/css/bootstrap.css | 6566 ------ .../vendor/bootstrap/css/bootstrap.css.map | 1 - .../vendor/bootstrap/css/bootstrap.min.css | 5 - .../fonts/glyphicons-halflings-regular.eot | Bin 20127 -> 0 bytes .../fonts/glyphicons-halflings-regular.svg | 288 - .../fonts/glyphicons-halflings-regular.ttf | Bin 45404 -> 0 bytes .../fonts/glyphicons-halflings-regular.woff | Bin 23424 -> 0 bytes .../fonts/glyphicons-halflings-regular.woff2 | Bin 18028 -> 0 bytes .../static/vendor/bootstrap/js/bootstrap.js | 2306 -- .../vendor/bootstrap/js/bootstrap.min.js | 7 - example/static/vendor/bootstrap/js/npm.js | 13 - example/static/vendor/react/react-0.13.1.js | 19541 ---------------- example/templates/index.html | 36 +- package.json | 10 + react/bundle.py | 142 - react/conf.py | 9 +- react/exceptions.py | 6 +- react/render.py | 117 +- react/server.py | 32 + react/templates.py | 12 - tests/__init__.py | 29 +- tests/host.config.js | 11 - tests/package.json | 13 - tests/perf.py | 4 - tests/settings.py | 26 +- tests/test_bundling.py | 193 - tests/test_django_integration.py | 11 +- tests/test_rendering.py | 79 +- tests/test_server.js | 32 + tests/utils.py | 28 - 42 files changed, 144 insertions(+), 30015 deletions(-) delete mode 100644 example/host.config.js delete mode 100644 example/static/css/main.css delete mode 100644 example/static/jsx/Comment.jsx delete mode 100644 example/static/jsx/CommentBox.jsx delete mode 100644 example/static/jsx/CommentForm.jsx delete mode 100644 example/static/jsx/CommentList.jsx delete mode 100644 example/static/vendor/bootstrap/css/bootstrap-theme.css delete mode 100644 example/static/vendor/bootstrap/css/bootstrap-theme.css.map delete mode 100644 example/static/vendor/bootstrap/css/bootstrap-theme.min.css delete mode 100644 example/static/vendor/bootstrap/css/bootstrap.css delete mode 100644 example/static/vendor/bootstrap/css/bootstrap.css.map delete mode 100644 example/static/vendor/bootstrap/css/bootstrap.min.css delete mode 100644 example/static/vendor/bootstrap/fonts/glyphicons-halflings-regular.eot delete mode 100644 example/static/vendor/bootstrap/fonts/glyphicons-halflings-regular.svg delete mode 100644 example/static/vendor/bootstrap/fonts/glyphicons-halflings-regular.ttf delete mode 100644 example/static/vendor/bootstrap/fonts/glyphicons-halflings-regular.woff delete mode 100644 example/static/vendor/bootstrap/fonts/glyphicons-halflings-regular.woff2 delete mode 100644 example/static/vendor/bootstrap/js/bootstrap.js delete mode 100644 example/static/vendor/bootstrap/js/bootstrap.min.js delete mode 100644 example/static/vendor/bootstrap/js/npm.js delete mode 100644 example/static/vendor/react/react-0.13.1.js create mode 100644 package.json delete mode 100644 react/bundle.py create mode 100644 react/server.py delete mode 100644 react/templates.py delete mode 100644 tests/host.config.js delete mode 100644 tests/package.json delete mode 100644 tests/test_bundling.py create mode 100644 tests/test_server.js delete mode 100644 tests/utils.py diff --git a/example/README.md b/example/README.md index 3b61e8c..fc5add6 100644 --- a/example/README.md +++ b/example/README.md @@ -18,4 +18,4 @@ npm install python example.py ``` -And visit [http://127.0.0.1:8000](http://127.0.0.1:8000) +And visit [http://127.0.0.1:5000](http://127.0.0.1:5000) diff --git a/example/host.config.js b/example/host.config.js deleted file mode 100644 index 66cfe60..0000000 --- a/example/host.config.js +++ /dev/null @@ -1,9 +0,0 @@ -var reactRender = require('react-render'); -var webpackWrapper = require('webpack-wrapper'); - -module.exports = { - functions: { - react: reactRender, - webpack: webpackWrapper - } -}; \ No newline at end of file diff --git a/example/package.json b/example/package.json index d0c027f..cd48dbf 100644 --- a/example/package.json +++ b/example/package.json @@ -3,6 +3,8 @@ "dependencies": { "babel-core": "^5.4.3", "babel-loader": "^5.1.0", + "body-parser": "^1.13.2", + "express": "^4.13.1", "jquery": "^2.1.4", "js-host": "^0.11.4", "marked": "^0.3.3", diff --git a/example/requirements.txt b/example/requirements.txt index 9d5b9f8..0ae014d 100644 --- a/example/requirements.txt +++ b/example/requirements.txt @@ -1,3 +1,2 @@ flask==0.10.1 -js-host react \ No newline at end of file diff --git a/example/static/css/main.css b/example/static/css/main.css deleted file mode 100644 index 0a33023..0000000 --- a/example/static/css/main.css +++ /dev/null @@ -1,15 +0,0 @@ -h1 { - border-bottom: 1px solid #ddd; -} - -h2 { - border-bottom: 1px solid #eee; -} - -form label { - display: block; -} - -form button { - margin-left: 5px; -} \ No newline at end of file diff --git a/example/static/jsx/Comment.jsx b/example/static/jsx/Comment.jsx deleted file mode 100644 index 6df14e7..0000000 --- a/example/static/jsx/Comment.jsx +++ /dev/null @@ -1,16 +0,0 @@ -import React from 'react'; -import marked from 'marked'; - -export default React.createClass({ - render() { - var rawMarkup = marked(this.props.text); - return ( -
-

- {this.props.author} -

- -
- ); - } -}); \ No newline at end of file diff --git a/example/static/jsx/CommentBox.jsx b/example/static/jsx/CommentBox.jsx deleted file mode 100644 index c5bf0b3..0000000 --- a/example/static/jsx/CommentBox.jsx +++ /dev/null @@ -1,58 +0,0 @@ -import React from 'react'; -import $ from 'jquery'; -import CommentList from './CommentList.jsx'; -import CommentForm from './CommentForm.jsx'; - -export default React.createClass({ - getInitialState() { - return {comments: this.props.comments}; - }, - handleCommentSubmit(comment) { - var comments = this.state.comments; - comments.push(comment); - this.setState({comments: comments}, () => { - this.postComment(comment); - }); - }, - postComment(comment) { - $.ajax({ - url: this.props.url, - type: 'POST', - dataType: 'json', - data: comment, - success: (data) => { - this.setState({comments: data.comments}); - }, - error: (xhr, status, err) => { - console.error(this.props.url, status, err.toString()); - } - }); - }, - getComments() { - $.ajax({ - url: this.props.url, - dataType: 'json', - success: (data) => { - this.setState({comments: data.comments}); - }, - error: (xhr, status, err) => { - console.error(this.props.url, status, err.toString()); - }, - complete: this.pollForNewComments - }); - }, - pollForNewComments() { - setTimeout(this.getComments, this.props.pollInterval); - }, - componentDidMount() { - this.pollForNewComments(); - }, - render() { - return ( -
- - -
- ); - } -}); \ No newline at end of file diff --git a/example/static/jsx/CommentForm.jsx b/example/static/jsx/CommentForm.jsx deleted file mode 100644 index 1c657f2..0000000 --- a/example/static/jsx/CommentForm.jsx +++ /dev/null @@ -1,38 +0,0 @@ -import React from 'react'; - -export default React.createClass({ - handleSubmit(e) { - e.preventDefault(); - var author = this.refs.author.getDOMNode().value.trim(); - var text = this.refs.text.getDOMNode().value.trim(); - if (!text || !author) { - return; - } - this.props.onCommentSubmit({author: author, text: text}); - this.refs.author.getDOMNode().value = ''; - this.refs.text.getDOMNode().value = ''; - }, - render() { - return ( -
-

Submit a comment

-
- -
-
-