diff --git a/.travis.yml b/.travis.yml index cbaecbc301b73250c5f91a71ff7901bece76a054..cc8a5822a40f0588d27d8e81a5c613b940fcde2d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,33 +3,27 @@ sudo: false dist: trusty node_js: - 6 -- 'node' cache: directories: - node_modules env: global: - - BASE_PATH=/scratch-gui/ - NODE_ENV=production install: - npm --production=false install - npm --production=false update -after_script: -- | - # RELEASE_BRANCHES and NPM_TOKEN defined in Travis settings panel - declare exitCode - $(npm bin)/travis-after-all - exitCode=$? - if [[ - # Execute after all jobs finish successfully - $exitCode = 0 && - # Only release on release branches - $RELEASE_BRANCHES =~ $TRAVIS_BRANCH && - # Don't release on PR builds - $TRAVIS_PULL_REQUEST = "false" - ]]; then - # Publish to gh-pages as most recent committer - git config --global user.email $(git log --pretty=format:"%ae" -n1) - git config --global user.name $(git log --pretty=format:"%an" -n1) - npm run --silent deploy -- -x -r https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git - fi +before_deploy: +- git config --global user.email $(git log --pretty=format:"%ae" -n1) +- git config --global user.name $(git log --pretty=format:"%an" -n1) +deploy: +- provider: script + on: + all_branches: true + condition: $TRAVIS_BRANCH != master + skip_cleanup: true + script: npm run deploy -- -x -e $TRAVIS_BRANCH -r https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git +- provider: script + on: + branch: master + skip_cleanup: true + script: npm run --silent deploy -- -x -a -r https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git diff --git a/package.json b/package.json index 0f623cc656f27b77492450bceeaaf66c7aaa88e7..5493ddeca111ad38185233f2394f6fe9e926f99a 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,8 @@ "deploy": "touch build/.nojekyll && gh-pages -t -d build -m \"Build for $(git log --pretty=format:%H -n1)\"", "lint": "eslint . --ext .js,.jsx", "start": "webpack-dev-server", - "test": "npm run lint && npm run build" + "test": "npm run lint && npm run build", + "watch": "webpack --progress --colors --watch" }, "author": "Massachusetts Institute of Technology", "license": "BSD-3-Clause", @@ -36,7 +37,7 @@ "eslint": "^3.16.1", "eslint-config-scratch": "^3.0.0", "eslint-plugin-react": "^7.0.1", - "gh-pages": "^1.0.0", + "gh-pages": "github:rschamp/gh-pages#publish-branch-to-subfolder", "html-webpack-plugin": "2.28.0", "immutable": "3.8.1", "lodash.bindall": "4.4.0", @@ -69,7 +70,6 @@ "style-loader": "^0.18.0", "svg-to-image": "1.1.3", "svg-url-loader": "2.0.2", - "travis-after-all": "^1.4.4", "webpack": "^2.4.1", "webpack-dev-server": "^2.4.1", "xhr": "2.4.0" diff --git a/src/components/gui/gui.jsx b/src/components/gui/gui.jsx index 47fb1b327a32a91fc25b4851a5e457b9364add5e..6d0bb59dc94f0f187c9d900c699791f40a0c980f 100644 --- a/src/components/gui/gui.jsx +++ b/src/components/gui/gui.jsx @@ -119,6 +119,6 @@ GUIComponent.propTypes = { vm: PropTypes.instanceOf(VM).isRequired }; GUIComponent.defaultProps = { - basePath: '/' + basePath: './' }; module.exports = GUIComponent; diff --git a/src/index.jsx b/src/index.jsx index 80917de8591634f3bc664b281298602b60a0c6f2..1c9a61f9092a44ad6b4dc122b047f141f91ebd5a 100644 --- a/src/index.jsx +++ b/src/index.jsx @@ -1,4 +1,3 @@ -const PropTypes = require('prop-types'); const React = require('react'); const ReactDOM = require('react-dom'); const {Provider} = require('react-redux'); @@ -52,17 +51,12 @@ class App extends React.Component { if (this.state.projectData === null) return null; return ( <GUI - basePath={this.props.basePath} projectData={this.state.projectData} /> ); } } -App.propTypes = { - basePath: PropTypes.string -}; - const appTarget = document.createElement('div'); appTarget.className = styles.app; document.body.appendChild(appTarget); @@ -74,6 +68,6 @@ const store = applyMiddleware( ); ReactDOM.render(( <Provider store={store}> - <App basePath={process.env.BASE_PATH} /> + <App /> </Provider> ), appTarget); diff --git a/webpack.config.js b/webpack.config.js index 409bb72a25d4435c5c25c693964fafa0df2b54a2..532ff10cb97cafc4303f76431eb643bdf7c3f338 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -75,7 +75,6 @@ module.exports = { plugins: [ new webpack.DefinePlugin({ 'process.env.NODE_ENV': '"' + process.env.NODE_ENV + '"', - 'process.env.BASE_PATH': '"' + (process.env.BASE_PATH || '/') + '"', 'process.env.DEBUG': Boolean(process.env.DEBUG) }), new webpack.optimize.CommonsChunkPlugin({