Repository: xkawi/create-react-app-now Branch: master Commit: 65a14fc8ea50 Files: 12 Total size: 8.5 KB Directory structure: gitextract_fx40rvmw/ ├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── package.json ├── public/ │ └── index.html └── src/ ├── About.js ├── App.css ├── App.js ├── App.test.js ├── index.css └── index.js ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitignore ================================================ # See http://help.github.com/ignore-files/ for more about ignoring files. # dependencies node_modules # testing coverage # production build # misc .DS_Store .env # Logs logs *.log npm-debug.log* # Runtime data pids *.pid *.seed # Directory for instrumented libs generated by jscoverage/JSCover lib-cov # Coverage directory used by tools like istanbul coverage # nyc test coverage .nyc_output # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) .grunt # node-waf configuration .lock-wscript # Compiled binary addons (http://nodejs.org/api/addons.html) build/Release # Dependency directories jspm_packages # Optional npm cache directory .npm # Optional REPL history .node_repl_history ================================================ FILE: .travis.yml ================================================ language: node_js node_js: - "4" - "5" - "6" - "stable" sudo: false before_script: - export DISPLAY=:99.0 - sh -e /etc/init.d/xvfb start script: - npm install - npm test ================================================ FILE: LICENSE ================================================ MIT License Copyright (c) 2016 Kawi Xiao Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: README.md ================================================ # create-react-app-now Deploy React.js Static Web Apps generated with [facebook/create-react-app](https://github.com/facebook/create-react-app) to Zeit's awesome [Now.sh](https://zeit.co/now/) service. I wrote an article about this project here: [Zero Configuration Deployment for React app with Zeit Now](https://medium.com/@kawixiao/zero-configuration-deployment-for-react-apps-with-zeits-now-4f002be98c#.eyvj3mjdb) # Important UPDATE: create-react-app now officially recommend using "serve" to deploy your create-react-app project. The documentation can be found here: https://create-react-app.dev/docs/deployment I personally and strongly recommend you to check out [Next.js](https://zeit.co/blog/next) by Zeit team. That will be my personal go to choice as well when creating new React project, and deploy to now seamlessly. Though create-react-app-now can serves as an example on how you can use create-react-app and zeit's now together. Having said that, it is likely that I will not actively maintain this repo anymore (e.g. update the dependencies). I will still accept PR though. # Why create-react-app-now is created using [facebook/create-react-app](https://github.com/facebook/create-react-app). Although it supports deployment to github pages and heroku, it does not feel intuitive just yet, as we need to run lots of commands. This project is specifically to solve just that, with just 1 command: `npm run deploy` This is achieved by using Zeit's awesome [Now.sh](https://zeit.co/now/) service. It is fast, easy, and intuitive way of deploying your React app. # How Simply follow this step from getting started to deployment: ``` $ npm install -g now $ git clone https://github.com/xkawi/create-react-app-now $ npm install $ npm run deploy ``` First command installs the `now` cli globally as npm package. Another (or suggested) approach is to install [Now Desktop](https://zeit.co/desktop) to ensure automatic updates of `now` cli. Subsequent commands simply clone this repo, install necessary npm packages and deploy it to Now. Whenever you want to deploy new changes, just run `npm run deploy` again to get new public link, for free! :smile: You will enjoy all the benefits that Now offers out-of-the-box: real-time and immutable deployments all within 1 command. ## Note You might see some red text appears or warnings in the log. You can safely ignore this, because your project will still be deployed successfully. # Alternatives Deployment If you prefer something else, please refer to create-react-app documentation [here](https://create-react-app.dev/docs/deployment#other-solutions). # More Read more about create-react-app [here](https://github.com/facebook/create-react-app) Read more about Zeit's Now.sh [here](https://zeit.co/now) ================================================ FILE: package.json ================================================ { "name": "create-react-app-now", "version": "0.1.0", "private": true, "devDependencies": { "react-scripts": "0.9.5", "serve": "^6.0.6" }, "dependencies": { "react": "^15.4.0", "react-dom": "^15.4.0", "react-router": "^4.0.0", "react-router-dom": "^4.0.0" }, "scripts": { "now-start": "cd build && serve -s ./", "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test --env=jsdom", "eject": "react-scripts eject", "deploy": "now -e REACT_APP_SECRET_CODE=secretcode" } } ================================================ FILE: public/index.html ================================================ React App
================================================ FILE: src/About.js ================================================ import React, { Component } from 'react'; import { Link } from 'react-router-dom'; class About extends Component { render() { return (
About page here back | or Test Not Found Page
); } } export default About; ================================================ FILE: src/App.css ================================================ .App { text-align: center; } .App-logo { animation: App-logo-spin infinite 20s linear; height: 80px; } .App-header { background-color: #222; height: 150px; padding: 20px; color: white; } .App-intro { font-size: large; } @keyframes App-logo-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } } ================================================ FILE: src/App.js ================================================ import React, { Component } from 'react'; import { BrowserRouter as Router, Route, Link, Switch, } from 'react-router-dom' import About from './About'; import logo from './logo.svg'; import './App.css'; const NoMatch = ({ location }) => (

No Match for {location.pathname}

go back
) class App extends Component { render() { const secretCode = process.env.REACT_APP_SECRET_CODE; return (
logo

Welcome to React

To get started, edit src/App.js and save to reload.

REACT_APP_SECRET_CODE: { !secretCode ? 'env not set yet' : secretCode }

about us

); } } const BasicApp = () => (
) export default BasicApp; ================================================ FILE: src/App.test.js ================================================ import React from 'react'; import ReactDOM from 'react-dom'; import App from './App'; it('renders without crashing', () => { const div = document.createElement('div'); ReactDOM.render(, div); }); ================================================ FILE: src/index.css ================================================ body { margin: 0; padding: 0; font-family: sans-serif; } ================================================ FILE: src/index.js ================================================ import React from 'react'; import ReactDOM from 'react-dom'; import App from './App'; import './index.css'; ReactDOM.render( , document.getElementById('root') );