diff --git a/.travis.yml b/.travis.yml index 0e3b1f10..c1827fdb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,44 +8,63 @@ python: - pypy cache: directories: - - .cache/pip/ - - $HOME/.cache/pip - - docs/node_modules/ - - $HOME/docs/node_modules + - .cache/pip/ + - $HOME/.cache/pip + - docs/node_modules/ + - $HOME/docs/node_modules + - $(npm config get prefix)/bin/gatsby install: - | - if [ "$TEST_TYPE" = build ]; then - pip install --download-cache $HOME/.cache/pip/ pytest pytest-cov coveralls six pytest-django - pip install --download-cache $HOME/.cache/pip/ -e .[django] - python setup.py develop - elif [ "$TEST_TYPE" = lint ]; then - pip install --download-cache $HOME/.cache/pip/ flake8 - fi + if [ "$TEST_TYPE" = build ]; then + pip install --download-cache $HOME/.cache/pip/ pytest pytest-cov coveralls six pytest-django + pip install --download-cache $HOME/.cache/pip/ -e .[django] + python setup.py develop + elif [ "$TEST_TYPE" = lint ]; then + pip install --download-cache $HOME/.cache/pip/ flake8 + fi script: - | - if [ "$TEST_TYPE" = build_website ]; then - echo "Building the web." - nvm install 4.1 && cd docs && npm run deploy - exit - elif [ "$TEST_TYPE" = lint ]; then - echo "Checking Python code lint." - flake8 - exit - elif [ "$TEST_TYPE" = build ]; then - py.test --cov=graphene - fi + if [ "$TEST_TYPE" = build_website ]; then + echo "Building the web." + nvm install 4.0 + + GH_PAGES_DIR="$TRAVIS_BUILD_DIR"/docs/public + git config --global user.name "Travis CI" + git config --global user.email "travis@graphene-python.org" + git clone --branch gh-pages-seg --depth=50 \ + https://graphql-python-bot@github.com/graphql-python/graphene.git \ + $GH_PAGES_DIR + cd docs + npm run build + cd $GH_PAGES_DIR + git status + if ! git diff-index --quiet HEAD --; then + git add -A . + git commit -m "Rebuild website" + git push "https://${GITHUB_TOKEN}@github.com/graphql-python/graphene.git" gh-pages-seg + fi + exit + elif [ "$TEST_TYPE" = lint ]; then + echo "Checking Python code lint." + flake8 + exit + elif [ "$TEST_TYPE" = build ]; then + py.test --cov=graphene + fi after_success: - | - if [ "$TEST_TYPE" = build ]; then - coveralls - fi + if [ "$TEST_TYPE" = build ]; then + coveralls + fi env: + matrix: - TEST_TYPE=build + global: + secure: SQC0eCWCWw8bZxbLE8vQn+UjJOp3Z1m779s9SMK3lCLwJxro/VCLBZ7hj4xsrq1MtcFO2U2Kqf068symw4Hr/0amYI3HFTCFiwXAC3PAKXeURca03eNO2heku+FtnQcOjBanExTsIBQRLDXMOaUkf3MIztpLJ4LHqMfUupKmw9YSB0v40jDbSN8khBnndFykmOnVVHznFp8USoN5F0CiPpnfEvHnJkaX76lNf7Kc9XNShBTTtJsnsHMhuYQeInt0vg9HSjoIYC38Tv2hmMj1myNdzyrHF+LgRjI6ceGi50ApAnGepXC/DNRhXROfECKez+LON/ZSqBGdJhUILqC8A4WmWmIjNcwitVFp3JGBqO7LULS0BI96EtSLe8rD1rkkdTbjivajkbykM1Q0Tnmg1adzGwLxRUbTq9tJQlTTkHBCuXIkpKb1mAtb/TY7A6BqfnPi2xTc/++qEawUG7ePhscdTj0IBrUfZsUNUYZqD8E8XbSWKIuS3SHE+cZ+s/kdAsm4q+FFAlpZKOYGxIkwvgyfu4/Plfol4b7X6iAP9J3r1Kv0DgBVFst5CXEwzZs19/g0CgokQbCXf1N+xeNnUELl6/fImaR3RKP22EaABoil4z8vzl4EqxqVoH1nfhE+WlpryXsuSaF/1R+WklR7aQ1FwoCk8V8HxM2zrj4tI8k= matrix: fast_finish: true include: - - python: "2.7" - env: TEST_TYPE=build_website - secure: e0iu1FvUcGNcsKEDsGQiGTJZMJ8tJMAQ+c+KCuh7I11likoJbninI9FX85efMglG93Xu4GtND1rUwKWnANM94Cz5IrLrT9ga62Cg1sinbzD+JUOG9EobtmcYcLbfNvA1ybkZf4K0KvkYfH1XUxtL3v6jFI6lLjZ1vKa2M6i5t/38pjgUOOh9KlVGi+rqSp2TUsCyjZkMxE2Wwceen5N/B1yZJDn9yHPA+kiV2ScOMgZOuVMqQd0IAPcjhqTbNdaW2VjNQFtS8CQ8FOjJh9NepRAyA42oII7Aq65YzZbifzYL1eSPKKfUHHdc7Bs+vq1kGuaWz+XBqByZAQvw7OtpkecG+KrcO7XDV38y6z33vgCC5MPu9e0BZwITIvyuUOKmFA9vTAx/w963vBDSzHgskgqYtYswxzOoE55TS9tHsc5rgoSatEGW2VXyI8ytWpgkuluCNwT+/ZvNaQ33SCPTwN7mQGWx+DC+eyMBjI1sP9s4aYCaTggCSFNtwhRpQqqM/0HFa7hHDksK/zJhl4fhFUrbmyrJo6wm6Z7/s/WiSulk+zZkrLC9eBs1+XNtU7PzcmgfFmcsJnPGBmBF8WOa8WiX9hOn9DutBT4mLtlOod3YvU22U0Vwj2TjzhDvx8uyYCpDA03a/q9QjE4+klcI2Mw5UNhJsmTpCZQE06aHDKg= - - python: "2.7" - env: TEST_TYPE=lint + - python: '2.7' + env: TEST_TYPE=build_website + - python: '2.7' + env: TEST_TYPE=lint diff --git a/docs/assets/edit.png b/docs/css/images/edit.png similarity index 100% rename from docs/assets/edit.png rename to docs/css/images/edit.png diff --git a/docs/assets/edit@2x.png b/docs/css/images/edit@2x.png similarity index 100% rename from docs/assets/edit@2x.png rename to docs/css/images/edit@2x.png diff --git a/docs/assets/starwars-icon.png b/docs/css/images/starwars-icon.png similarity index 100% rename from docs/assets/starwars-icon.png rename to docs/css/images/starwars-icon.png diff --git a/docs/assets/starwars-icon@2x.png b/docs/css/images/starwars-icon@2x.png similarity index 100% rename from docs/assets/starwars-icon@2x.png rename to docs/css/images/starwars-icon@2x.png diff --git a/docs/css/main.styl b/docs/css/main.styl index 31049be9..e982b922 100644 --- a/docs/css/main.styl +++ b/docs/css/main.styl @@ -198,7 +198,7 @@ html, body top 20px height 32px width 32px - image '~!file-loader!../assets/starwars-icon.png' 32px 32px + // image 'images/starwars-icon.png' 32px 32px &:hover transform translateY(-3px) @@ -230,7 +230,7 @@ html, body top 8px height 16px width 16px - image '~!file-loader!../assets/edit.png' 16px 16px + // image 'images/edit.png' 16px 16px &:hover transform: rotate(270deg) translateX(100%) background #666 diff --git a/docs/gatsby.config.js b/docs/gatsby.config.js index 8aa39cdf..bbfddb16 100644 --- a/docs/gatsby.config.js +++ b/docs/gatsby.config.js @@ -1,18 +1,38 @@ var nib = require("nib"); var jeet = require("jeet"); var rupture = require("rupture"); +var path = require("path"); var ExtractTextPlugin = require("extract-text-webpack-plugin"); +var CopyWebpackPlugin = require('copy-webpack-plugin'); module.exports = function(config, env) { var IS_STATIC = env === 'static'; config.merge({ stylus: { use: [nib(), jeet(), rupture()] + }, + resolveLoader: { + root: path.join(__dirname, "node_modules"), + modulesDirectories: ['./'], + alias: { + 'copy': 'file-loader?name=[path][name].[ext]&context=./static', + } + }, + resolve: { + root: path.join(__dirname, "node_modules"), + alias: { + 'original-react': path.join(__dirname, "node_modules", "react"), + 'react/lib': path.join(__dirname, "node_modules", "react", "lib"), + 'react': path.join(__dirname, 'patched-react.js') + }, + modulesDirectories: ['./'] } }); if (IS_STATIC) { config.plugin('extract-css', ExtractTextPlugin, ["app.css"]); } + config.plugin('static', CopyWebpackPlugin, [[{ from: '../static'}]]); + config.loader('stylus', function(cfg) { cfg.test = /\.styl$/; if (IS_STATIC) { @@ -23,5 +43,11 @@ module.exports = function(config, env) { } return cfg }); + config.removeLoader('png'); + config.loader('png', function(cfg) { + cfg.test = /\.png$/; + cfg.loader = 'file-loader' + return cfg + }) return config; }; diff --git a/docs/html.js b/docs/html.js index e93eda04..0b96a36d 100644 --- a/docs/html.js +++ b/docs/html.js @@ -11,7 +11,7 @@ export default class Html extends React.Component { {title} - + diff --git a/docs/package.json b/docs/package.json index 79e04946..79172095 100644 --- a/docs/package.json +++ b/docs/package.json @@ -13,8 +13,10 @@ ], "license": "MIT", "dependencies": { + "copy-webpack-plugin": "^0.2.0", "extract-text-webpack-plugin": "^0.9.1", "jeet": "^6.1.2", + "lodash": "^3.10.1", "nib": "^1.1.0", "react": "^0.14.3", "react-document-title": "^2.0.1", diff --git a/docs/patched-react.js b/docs/patched-react.js new file mode 100644 index 00000000..8b05d3e1 --- /dev/null +++ b/docs/patched-react.js @@ -0,0 +1,10 @@ +// React patched version for render in server side always with same ids +if (typeof window === "undefined") { + var ServerReactRootIndex = require('react/lib/ServerReactRootIndex'); + console.log(ServerReactRootIndex); + ServerReactRootIndex.createReactRootIndex = function(){ + return "graphene"; + }; +} + +module.exports = require('original-react'); diff --git a/docs/static/CNAME b/docs/static/CNAME new file mode 100644 index 00000000..3e3b78e4 --- /dev/null +++ b/docs/static/CNAME @@ -0,0 +1 @@ +graphene-python.org \ No newline at end of file diff --git a/docs/static/favicon.png b/docs/static/favicon.png new file mode 100644 index 00000000..aad79966 Binary files /dev/null and b/docs/static/favicon.png differ