You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: packages/react-scripts/template/README.md
+63
Original file line number
Diff line number
Diff line change
@@ -48,6 +48,7 @@ You can find the most recent version of this guide [here](https://github.com/fac
48
48
-[Deployment](#deployment)
49
49
-[Serving Apps with Client-Side Routing](#serving-apps-with-client-side-routing)
50
50
-[Building for Relative Paths](#building-for-relative-paths)
51
+
-[Firebase](#firebase)
51
52
-[GitHub Pages](#github-pages)
52
53
-[Heroku](#heroku)
53
54
-[Modulus](#modulus)
@@ -1010,6 +1011,68 @@ To override this, specify the `homepage` in your `package.json`, for example:
1010
1011
1011
1012
This will let Create React App correctly infer the root path to use in the generated HTML file.
1012
1013
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...
0 commit comments