Skip to content
Permalink
Browse files
Update with-firebase-hosting. (#3032)
Simplify scripts.
  • Loading branch information
jthegedus authored and timneutkens committed Oct 5, 2017
1 parent 285b27b commit 594b214a23f877fc893099309d31751fa3da460d
Showing 4 changed files with 23 additions and 23 deletions.
@@ -15,13 +15,16 @@ It is recommended to use a package manager that uses a lockfile and caching for
- [pnpm](https://github.com/pnpm/pnpm)

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

Install project:

Each of the other commands pre-installs all dependencies
```bash
npm install
```

Run Next.js development:

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

Deploy it to the cloud with Firebase
Deploy it to the cloud with Firebase:

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

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).

## Important & Caveats
## Important / Caveats
* 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.
* `firebase.json` outlines the catchall rewrite rule for our Cloud Function.
* Testing on Firebase locally requires a complete build of the Next.js app. `npm run serve` handles everything required.
@@ -1,10 +1,10 @@
{
"name": "app",
"version": "1.0.0",
"description": "Next.js React SSR App",
"dependencies": {
"next": "beta",
"react": "^15.6.1",
"react-dom": "^15.6.1"
"next": "4.0.0-beta.2",
"react": "16.0.0",
"react-dom": "16.0.0"
},
"scripts": {
"dev": "next",
@@ -1,13 +1,11 @@
{
"name": "functions",
"description": "Cloud Functions for Firebase",
"version": "1.0.0",
"dependencies": {
"firebase-admin": "^5.0.1",
"firebase-functions": "^0.6.0",
"next": "beta",
"react": "^15.6.1",
"react-dom": "^15.6.1"
},
"private": true
"firebase-admin": "5.3.0",
"firebase-functions": "0.6.3",
"next": "4.0.0-beta.2",
"react": "16.0.0",
"react-dom": "16.0.0"
}
}
@@ -1,20 +1,19 @@
{
"name": "with-firebase-hosting",
"version": "1.0.0",
"description": "Host Next.js SSR app on Firebase Cloud Functions with Firebase Hosting redirects.",
"version": "2.0.0",
"description":
"Host Next.js SSR app on Firebase Cloud Functions with Firebase Hosting redirects.",
"scripts": {
"next": "npm run build-firebase && cd \"app\" && npm i && npm run dev",
"install-app": "cd \"app/\" && npm i",
"install-functions": "cd \"functions/\" && npm i",
"postinstall": "npm run install-app && npm run install-functions",
"next": "cd \"app\" && npm run dev",
"preserve": "npm run build-all",
"serve": "firebase serve",
"predeploy": "npm run build-all",
"deploy": "firebase deploy",
"build-all": "npm run build-next && npm run build-firebase",
"build-next": "cd \"app\" && npm i && npm run build",
"build-firebase": "cd \"functions\" && npm i"
},
"dependencies": {
"next": "^3.0.1-beta.8",
"react": "^15.6.1",
"react-dom": "^15.6.1"
}
}

0 comments on commit 594b214

Please sign in to comment.