This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var shell = require("shelljs"); | |
var nextjsConfig = require("../next.config"); | |
var distDir = nextjsConfig.distDir || ".next"; | |
var BUILD_ID = shell.cat(`${distDir}/BUILD_ID`); | |
function hoistPages(fileExt, outputPath) { | |
console.log( | |
`${distDir}/server/static/${BUILD_ID}/pages/**/*${fileExt} -> ${outputPath}/` | |
); | |
shell.mkdir("-p", outputPath); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
┌ nextjs/ <-- Next.js distribution directory | |
| └ ... | |
├ next.config.js <-- Next.js configuration | |
├ package-lock.json | |
├ package.json | |
└ server.js <-- HTTPS Cloud Function for our Next.js Server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
... | |
"main": "server.js", | |
... | |
"dependencies": { | |
... | |
}, | |
"engines": { | |
"node": "10" | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
... | |
"functions": { | |
"source": ".", | |
"ignore": [ | |
"firebase.json", | |
"firbease-debug.log", | |
"**/.*", | |
"**/node_modules/**", | |
"components/**", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
... | |
"hosting": [{ | |
"site": "TODO_YOUR_WEB_APP_DEPLOY_TARGET_HERE", | |
"public": "out", | |
"cleanUrls": true, | |
"rewrites": [{ | |
"source": "**", | |
"function": "nextjs-server" | |
}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
┌ components/ <-- React Components | |
| └ ... | |
├ helpers/ | |
| └ utils.js <-- Firestore data to JSON helper | |
├ nextjs/ <-- Next.js distribution directory | |
| └ ... configured in next.config.js | |
├ out/ <-- public/ + hoisted nextjs/ static content | |
| └ ... | |
├ pages/ <-- Next.js Pages | |
| └ ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
┌ ○ / <-- static | |
├ ○ /404 <-- static | |
├ ● /about <-- SSG page | |
├ λ /blog <-- SSR page | |
├ ● /blog/[pid] <-- SSG dynamic route with fallback:true | |
└ ○ /blog/not-a-post <-- static | |
+ First Load JS shared by all | |
├ static/pages/_app.js | |
├ chunks/commons.some_uid.js | |
├ chunks/framework.some_uid.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const admin = require("firebase-admin"); | |
const functions = require("firebase-functions"); | |
const next = require("next"); | |
const config = require("./next.config"); | |
admin.initializeApp(); | |
const dev = process.env.NODE_ENV !== "production"; | |
const app = next({ | |
dev, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.helloWorld = (req, res) => { | |
res.send('Hello, World'); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {https} from 'firebase-functions'; | |
import gqlServer from './graphql/server'; | |
const server = gqlServer(); | |
// Graphql api | |
// https://us-central1-<project-name>.cloudfunctions.net/api/ | |
const api = https.onRequest(server); | |
export {api}; |
NewerOlder