Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/erabossid/react-gh-pages
Deploy your react-app to gh-pages
https://github.com/erabossid/react-gh-pages
deploy gh-pages reactjs
Last synced: about 1 month ago
JSON representation
Deploy your react-app to gh-pages
- Host: GitHub
- URL: https://github.com/erabossid/react-gh-pages
- Owner: erabossid
- License: mit
- Created: 2020-09-09T05:25:27.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-12-24T17:10:40.000Z (about 4 years ago)
- Last Synced: 2024-11-15T01:44:24.611Z (about 2 months ago)
- Topics: deploy, gh-pages, reactjs
- Language: JavaScript
- Homepage: https://tradecoder.github.io/react-gh-pages
- Size: 325 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Deploy your React App to gh-pages
Bootstrapped by `create-react-app`
## Make an empty repo on github (no file)
## Install the app using this command
```javascript
npx create-react-app yourprojectname
```
## Go to your project```javascript
cd yourprojectname
```## Intall gh-pages
```javascript
npm install gh-pages
```
## Add a homepage to `package.json````javascript
"homepage":"https://yourgithubusername.github.io/yourprojectname"// example:
"homepage":"https://tradecoder.github.io/react-gh-pages"
```## Add the following code to the script section of `package.json`
```javascript
"predeploy":"npm run build",
"deploy":"gh-pages -d build"
```If you do not delete any code from the package.json file from the script,
your code may look like this after adding the above properties```javascript
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"predeploy":"npm run build",
"deploy":"gh-pages -d build"
}
```## Create a git repo
```javascript
git init
```## Add your github project remote url
```javascript
git remote add origin https://github.com/yourgithubusername/yourprojectname.git// We are adding our own
git remote add origin https://github.com/tradecoder/react-gh-pages
```## Setup is ok, now deploy your app to github gh-pages
```javascript
npm run deploy
```
Visit your project using the homepage you set earlier## Upload the source code to github
Add all the changes in your project```javascript
git add --all
```
Commit with a message
```javascript
git commit -m 'your message here'
```
Push your source codes to your github project```javascript
git push origin master
```
Source code uploaded to your github master branch## Done