Skip to content

Commit 9fa262f

Browse files
guilhermebruzzialexdriaguine
authored andcommitted
Add deploy to Firebase CDN on template's README (Closes facebook#374) (facebook#1143)
* Add deploy to Firebase CDN on template's README (Closes facebook#374) * Move section and minor tweaks
1 parent d52ae67 commit 9fa262f

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

packages/react-scripts/template/README.md

+63
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ You can find the most recent version of this guide [here](https://github.com/fac
4949
- [Deployment](#deployment)
5050
- [Serving Apps with Client-Side Routing](#serving-apps-with-client-side-routing)
5151
- [Building for Relative Paths](#building-for-relative-paths)
52+
- [Firebase](#firebase)
5253
- [GitHub Pages](#github-pages)
5354
- [Heroku](#heroku)
5455
- [Modulus](#modulus)
@@ -1015,6 +1016,68 @@ To override this, specify the `homepage` in your `package.json`, for example:
10151016
10161017
This will let Create React App correctly infer the root path to use in the generated HTML file.
10171018
1019+
1020+
### Firebase
1021+
1022+
Install the Firebase CLI if you haven't already by running `npm install -g firebase-tools`. Sign up for a [Firebase account](https://console.firebase.google.com/) and create a new project. Run `firebase login` and login with your previous created Firebase account.
1023+
1024+
Then run the `firebase init` command from your project's root. You need to choose the **Hosting: Configure and deploy Firebase Hosting sites** and choose the Firebase project you created in the previous step. You will need to agree with `database.rules.json` being created, choose `build` as the public directory, and also agree to **Configure as a single-page app** by replying with `y`.
1025+
1026+
```sh
1027+
=== Project Setup
1028+
1029+
First, let's associate this project directory with a Firebase project.
1030+
You can create multiple project aliases by running firebase use --add,
1031+
but for now we'll just set up a default project.
1032+
1033+
? What Firebase project do you want to associate as default? Example app (example-app-fd690)
1034+
1035+
=== Database Setup
1036+
1037+
Firebase Realtime Database Rules allow you to define how your data should be
1038+
structured and when your data can be read from and written to.
1039+
1040+
? What file should be used for Database Rules? database.rules.json
1041+
✔ Database Rules for example-app-fd690 have been downloaded to database.rules.json.
1042+
Future modifications to database.rules.json will update Database Rules when you run
1043+
firebase deploy.
1044+
1045+
=== Hosting Setup
1046+
1047+
Your public directory is the folder (relative to your project directory) that
1048+
will contain Hosting assets to uploaded with firebase deploy. If you
1049+
have a build process for your assets, use your build's output directory.
1050+
1051+
? What do you want to use as your public directory? build
1052+
? Configure as a single-page app (rewrite all urls to /index.html)? Yes
1053+
✔ Wrote build/index.html
1054+
1055+
i Writing configuration info to firebase.json...
1056+
i Writing project information to .firebaserc...
1057+
1058+
✔ Firebase initialization complete!
1059+
```
1060+
1061+
Now, after you create a production build with `npm run build`, you can deploy it by running `firebase deploy`.
1062+
1063+
```sh
1064+
=== Deploying to 'example-app-fd690'...
1065+
1066+
i deploying database, hosting
1067+
✔ database: rules ready to deploy.
1068+
i hosting: preparing build directory for upload...
1069+
Uploading: [============================== ] 75%✔ hosting: build folder uploaded successfully
1070+
✔ hosting: 8 files uploaded successfully
1071+
i starting release process (may take several minutes)...
1072+
1073+
✔ Deploy complete!
1074+
1075+
Project Console: https://console.firebase.google.com/project/example-app-fd690/overview
1076+
Hosting URL: https://example-app-fd690.firebaseapp.com
1077+
```
1078+
1079+
For more information see [Add Firebase to your JavaScript Project](https://firebase.google.com/docs/web/setup).
1080+
10181081
### GitHub Pages
10191082
10201083
>Note: this feature is available with `react-scripts@0.2.0` and higher.

0 commit comments

Comments
 (0)