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
+66
Original file line number
Diff line number
Diff line change
@@ -54,6 +54,7 @@ You can find the most recent version of this guide [here](https://github.com/fac
54
54
-[Now](#now)
55
55
-[S3 and CloudFront](#s3-and-cloudfront)
56
56
-[Surge](#surge)
57
+
-[Firebase](#firebase)
57
58
-[Troubleshooting](#troubleshooting)
58
59
-[Something Missing?](#something-missing)
59
60
@@ -1092,6 +1093,71 @@ Install the Surge CLI if you haven't already by running `npm install -g surge`.
1092
1093
1093
1094
Note that in order to support routers that use HTML5 `pushState` API, you may want to rename the `index.html` in your build folder to `200.html` before deploying to Surge. This [ensures that every URL falls back to that file](https://surge.sh/help/adding-a-200-page-for-client-side-routing).
1094
1095
1096
+
### Firebase
1097
+
1098
+
Install the Firebase CLI if you haven't already by running `npm install -g firebase-tools`.
1099
+
1100
+
Sign up for a [Firebase account](https://console.firebase.google.com/) and create a new project.
1101
+
1102
+
Run the `firebase login` command and login with your previous created Firebase account.
1103
+
1104
+
Then run the `firebase init` command from your project's root. You need to choose the *Hosting: Configure and deploy Firebase Hosting sites* option, choose your previous created project, accept *database.rules.json* to be created, choose *build* as public directory and accept to *Configure as a single-page app* with the *y* option.
1105
+
1106
+
```sh
1107
+
=== Project Setup
1108
+
1109
+
First, let's associate this project directory with a Firebase project.
1110
+
You can create multiple project aliases by running firebase use --add,
1111
+
but for now we'll just set up a default project.
1112
+
1113
+
? What Firebase project do you want to associate as default? Example app (example-app-fd690)
1114
+
1115
+
=== Database Setup
1116
+
1117
+
Firebase Realtime Database Rules allow you to define how your data should be
1118
+
structured and when your data can be read from and written to.
1119
+
1120
+
? What file should be used for Database Rules? database.rules.json
1121
+
✔ Database Rules for example-app-fd690 have been downloaded to database.rules.json.
1122
+
Future modifications to database.rules.json will update Database Rules when you run
1123
+
firebase deploy.
1124
+
1125
+
=== Hosting Setup
1126
+
1127
+
Your public directory is the folder (relative to your project directory) that
1128
+
will contain Hosting assets to uploaded with firebase deploy. If you
1129
+
have a build process for your assets, use your build's output directory.
1130
+
1131
+
? What do you want to use as your public directory? build
1132
+
? Configure as a single-page app (rewrite all urls to /index.html)? Yes
1133
+
✔ Wrote build/index.html
1134
+
1135
+
i Writing configuration info to firebase.json...
1136
+
i Writing project information to .firebaserc...
1137
+
1138
+
✔ Firebase initialization complete!
1139
+
```
1140
+
1141
+
After creating the build folder with `npm run build`, you can deploy to firebase with the `firebase deploy` command.
1142
+
1143
+
```sh
1144
+
=== Deploying to 'example-app-fd690'...
1145
+
1146
+
i deploying database, hosting
1147
+
✔ database: rules ready to deploy.
1148
+
i hosting: preparing build directory for upload...
0 commit comments