Skip to content

Commit f1a9c37

Browse files
guilhermebruzzirandycoulman
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 5f1b30b commit f1a9c37

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

0 commit comments

Comments
 (0)