Skip to content

Commit 3e79705

Browse files
Add deploy to Firebase CDN on template's README (Closes facebook#374)
1 parent cdd17a6 commit 3e79705

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

Diff for: packages/react-scripts/template/README.md

+66
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ You can find the most recent version of this guide [here](https://github.com/fac
5454
- [Now](#now)
5555
- [S3 and CloudFront](#s3-and-cloudfront)
5656
- [Surge](#surge)
57+
- [Firebase](#firebase)
5758
- [Troubleshooting](#troubleshooting)
5859
- [Something Missing?](#something-missing)
5960

@@ -1092,6 +1093,71 @@ Install the Surge CLI if you haven't already by running `npm install -g surge`.
10921093
10931094
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).
10941095
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...
1149+
Uploading: [============================== ] 75%✔ hosting: build folder uploaded successfully
1150+
✔ hosting: 8 files uploaded successfully
1151+
i starting release process (may take several minutes)...
1152+
1153+
✔ Deploy complete!
1154+
1155+
Project Console: https://console.firebase.google.com/project/example-app-fd690/overview
1156+
Hosting URL: https://example-app-fd690.firebaseapp.com
1157+
```
1158+
1159+
For more information see [Add Firebase to your JavaScript Project](https://firebase.google.com/docs/web/setup).
1160+
10951161
## Troubleshooting
10961162
10971163
### `npm test` hangs on macOS Sierra

0 commit comments

Comments
 (0)