From 594b214a23f877fc893099309d31751fa3da460d Mon Sep 17 00:00:00 2001 From: James Hegedus Date: Thu, 5 Oct 2017 17:28:46 +1100 Subject: [PATCH] Update with-firebase-hosting. (#3032) Simplify scripts. --- examples/with-firebase-hosting/README.md | 9 ++++++--- examples/with-firebase-hosting/app/package.json | 8 ++++---- .../with-firebase-hosting/functions/package.json | 14 ++++++-------- examples/with-firebase-hosting/package.json | 15 +++++++-------- 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/examples/with-firebase-hosting/README.md b/examples/with-firebase-hosting/README.md index d420b9bc89..a189d5d520 100644 --- a/examples/with-firebase-hosting/README.md +++ b/examples/with-firebase-hosting/README.md @@ -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/ - 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. diff --git a/examples/with-firebase-hosting/app/package.json b/examples/with-firebase-hosting/app/package.json index 984c807bbc..638f73d513 100644 --- a/examples/with-firebase-hosting/app/package.json +++ b/examples/with-firebase-hosting/app/package.json @@ -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", diff --git a/examples/with-firebase-hosting/functions/package.json b/examples/with-firebase-hosting/functions/package.json index 32303e164a..d3351eeb6e 100644 --- a/examples/with-firebase-hosting/functions/package.json +++ b/examples/with-firebase-hosting/functions/package.json @@ -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" + } } diff --git a/examples/with-firebase-hosting/package.json b/examples/with-firebase-hosting/package.json index 5d05e4bead..7cfa892912 100644 --- a/examples/with-firebase-hosting/package.json +++ b/examples/with-firebase-hosting/package.json @@ -1,9 +1,13 @@ { "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", @@ -11,10 +15,5 @@ "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" } } -- GitLab