Skip to content

Commit 594b214

Browse files
jthegedustimneutkens
authored andcommitted
Update with-firebase-hosting. (#3032)
Simplify scripts.
1 parent 285b27b commit 594b214

File tree

4 files changed

+23
-23
lines changed

4 files changed

+23
-23
lines changed

examples/with-firebase-hosting/README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,16 @@ It is recommended to use a package manager that uses a lockfile and caching for
1515
- [pnpm](https://github.com/pnpm/pnpm)
1616

1717
Set up firebase:
18+
- install Firebase Tools: `npm i -g firebase-tools`
1819
- create a project through the [firebase web console](https://console.firebase.google.com/)
1920
- grab the projects ID from the web consoles URL: https://console.firebase.google.com/project/<projectId>
2021
- update the `.firebaserc` default project ID to the newly created project
2122

2223
Install project:
2324

24-
Each of the other commands pre-installs all dependencies
25+
```bash
26+
npm install
27+
```
2528

2629
Run Next.js development:
2730

@@ -35,7 +38,7 @@ Run Firebase locally for testing:
3538
npm run serve
3639
```
3740

38-
Deploy it to the cloud with Firebase
41+
Deploy it to the cloud with Firebase:
3942

4043
```bash
4144
npm run deploy
@@ -46,7 +49,7 @@ The goal is to host the Next.js app on Firebase Cloud Functions with Firebase Ho
4649

4750
This is based off of the work at https://github.com/geovanisouza92/serverless-firebase & https://github.com/jthegedus/firebase-functions-next-example as described [here](https://medium.com/@jthegedus/next-js-on-cloud-functions-for-firebase-with-firebase-hosting-7911465298f2).
4851

49-
## Important & Caveats
52+
## Important / Caveats
5053
* The empty `placeholder.html` file is so Firebase Hosting does not error on an empty `public/` folder and still hosts at the Firebase project URL.
5154
* `firebase.json` outlines the catchall rewrite rule for our Cloud Function.
5255
* Testing on Firebase locally requires a complete build of the Next.js app. `npm run serve` handles everything required.

examples/with-firebase-hosting/app/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"name": "app",
3-
"version": "1.0.0",
3+
"description": "Next.js React SSR App",
44
"dependencies": {
5-
"next": "beta",
6-
"react": "^15.6.1",
7-
"react-dom": "^15.6.1"
5+
"next": "4.0.0-beta.2",
6+
"react": "16.0.0",
7+
"react-dom": "16.0.0"
88
},
99
"scripts": {
1010
"dev": "next",
Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
{
22
"name": "functions",
33
"description": "Cloud Functions for Firebase",
4-
"version": "1.0.0",
54
"dependencies": {
6-
"firebase-admin": "^5.0.1",
7-
"firebase-functions": "^0.6.0",
8-
"next": "beta",
9-
"react": "^15.6.1",
10-
"react-dom": "^15.6.1"
11-
},
12-
"private": true
5+
"firebase-admin": "5.3.0",
6+
"firebase-functions": "0.6.3",
7+
"next": "4.0.0-beta.2",
8+
"react": "16.0.0",
9+
"react-dom": "16.0.0"
10+
}
1311
}
Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
{
22
"name": "with-firebase-hosting",
3-
"version": "1.0.0",
4-
"description": "Host Next.js SSR app on Firebase Cloud Functions with Firebase Hosting redirects.",
3+
"version": "2.0.0",
4+
"description":
5+
"Host Next.js SSR app on Firebase Cloud Functions with Firebase Hosting redirects.",
56
"scripts": {
6-
"next": "npm run build-firebase && cd \"app\" && npm i && npm run dev",
7+
"install-app": "cd \"app/\" && npm i",
8+
"install-functions": "cd \"functions/\" && npm i",
9+
"postinstall": "npm run install-app && npm run install-functions",
10+
"next": "cd \"app\" && npm run dev",
711
"preserve": "npm run build-all",
812
"serve": "firebase serve",
913
"predeploy": "npm run build-all",
1014
"deploy": "firebase deploy",
1115
"build-all": "npm run build-next && npm run build-firebase",
1216
"build-next": "cd \"app\" && npm i && npm run build",
1317
"build-firebase": "cd \"functions\" && npm i"
14-
},
15-
"dependencies": {
16-
"next": "^3.0.1-beta.8",
17-
"react": "^15.6.1",
18-
"react-dom": "^15.6.1"
1918
}
2019
}

0 commit comments

Comments
 (0)