diff --git a/examples/with-firebase-hosting/.gitignore b/examples/with-firebase-hosting/.gitignore index 77738287..2b949593 100644 --- a/examples/with-firebase-hosting/.gitignore +++ b/examples/with-firebase-hosting/.gitignore @@ -1 +1,4 @@ -dist/ \ No newline at end of file +dist/ + +# Firebase cache +.firebase/ \ No newline at end of file diff --git a/examples/with-firebase-hosting/README.md b/examples/with-firebase-hosting/README.md index 021f35a1..7eb9c9f8 100644 --- a/examples/with-firebase-hosting/README.md +++ b/examples/with-firebase-hosting/README.md @@ -80,7 +80,10 @@ If you're having issues, feel free to tag @jthegedus in the [issue you create on * 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. -* The [Firebase predeploy](https://firebase.google.com/docs/cli/#predeploy_and_postdeploy_hooks) hooks run most of the npm scripts when `npm run deploy` runs `firebase deploy`. The only scripts you should need are `clean`, `dev`, `serve` and `deploy`. +* Specifying [`"engines": {"node": "8"}`](package.json#L5-L7) in the `package.json` is required for firebase functions + to be deployed on Node 8 rather than Node 6 + ([Firebase Blog Announcement](https://firebase.googleblog.com/2018/08/cloud-functions-for-firebase-config-node-8-timeout-memory-region.html)) + . This is matched in [`src/functions/.babelrc`](src/functions/.babelrc) so that babel output somewhat compacter and moderner code. ### Customization diff --git a/examples/with-firebase-hosting/package.json b/examples/with-firebase-hosting/package.json index 26d0adac..09e00985 100644 --- a/examples/with-firebase-hosting/package.json +++ b/examples/with-firebase-hosting/package.json @@ -1,36 +1,35 @@ { "name": "with-firebase-hosting", "version": "4.0.1", - "description": - "Host Next.js SSR app on Firebase Cloud Functions with Firebase Hosting redirects.", + "description": "Host Next.js SSR app on Firebase Cloud Functions with Firebase Hosting redirects.", + "engines": { + "node": "8" + }, "scripts": { "dev": "next \"src/app/\"", - "preserve": - "npm run build-public && npm run build-funcs && npm run build-app && npm run copy-deps && npm run install-deps", - "serve": "NODE_ENV=production firebase serve", - "predeploy": - "npm run build-public && npm run build-funcs && npm run build-app && npm run copy-deps", + "preserve": "npm run build-public && npm run build-funcs && npm run build-app && npm run copy-deps && npm run install-deps", + "serve": "cross-env NODE_ENV=production firebase serve", + "predeploy": "npm run build-public && npm run build-funcs && npm run build-app && npm run copy-deps", "deploy": "firebase deploy", "clean": "rimraf \"dist/functions/**\" && rimraf \"dist/public\"", "build-public": "cpx \"src/public/**/*.*\" \"dist/public\" -C", "build-funcs": "babel \"src/functions\" --out-dir \"dist/functions\"", "build-app": "next build \"src/app/\"", - "copy-deps": - "cpx \"*{package.json,package-lock.json,yarn.lock}\" \"dist/functions\" -C", + "copy-deps": "cpx \"*{package.json,package-lock.json,yarn.lock}\" \"dist/functions\" -C", "install-deps": "cd \"dist/functions\" && npm i" }, "dependencies": { - "firebase-admin": "^5.12.1", - "firebase-functions": "^1.0.2", - "next": "^6.0.3", - "react": "^16.3.2", - "react-dom": "^16.3.2" + "firebase-admin": "^6.3.0", + "firebase-functions": "^2.1.0", + "next": "^7.0.0", + "react": "^16.6.0", + "react-dom": "^16.6.0" }, "devDependencies": { - "@babel/cli": "^7.0.0-rc.1", - "cpx": "1.5.0", - "firebase-tools": "3.18.4", - "prettier": "1.12.1", - "rimraf": "2.6.2" + "@babel/cli": "^7.2.0", + "cpx": "^1.5.0", + "cross-env": "^5.2.0", + "firebase-tools": "^6.1.0", + "rimraf": "^2.6.0" } } diff --git a/examples/with-firebase-hosting/src/app/.babelrc b/examples/with-firebase-hosting/src/app/.babelrc deleted file mode 100644 index 5c43a542..00000000 --- a/examples/with-firebase-hosting/src/app/.babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "presets": [["next/babel"]] -} diff --git a/examples/with-firebase-hosting/src/functions/.babelrc b/examples/with-firebase-hosting/src/functions/.babelrc index 70705fe4..70027d4c 100644 --- a/examples/with-firebase-hosting/src/functions/.babelrc +++ b/examples/with-firebase-hosting/src/functions/.babelrc @@ -4,7 +4,7 @@ "@babel/preset-env", { "targets": { - "node": "6.11.5" + "node": "8.14" } } ]