(firebase): init

master
chwan1 4 years ago
commit 359b89b627
  1. 5
      Firebase-21006-Backend/.firebaserc
  2. 35
      Firebase-21006-Backend/.gitignore
  3. 192
      Firebase-21006-Backend/firebase-debug.log
  4. 24
      Firebase-21006-Backend/firebase.json
  5. 17
      Firebase-21006-Backend/firebaseFunctions.js
  6. 24
      Firebase-21006-Backend/package.json
  7. 0
      Firebase-21006-Backend/public/.gitignore
  8. 11
      Firebase-21006-Backend/src/components/App.jsx
  9. 15
      Firebase-21006-Backend/src/components/Header.jsx
  10. 3
      Firebase-21006-Backend/src/next.config.js
  11. 9
      Firebase-21006-Backend/src/pages/about.jsx
  12. 9
      Firebase-21006-Backend/src/pages/index.jsx
  13. 5219
      Firebase-21006-Backend/yarn.lock

@ -0,0 +1,5 @@
{
"projects": {
"default": "uc-21006-backend"
}
}

@ -0,0 +1,35 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# next.js
/.next/
/out/
# production
/build
# misc
.DS_Store
*.pem
.firebase/
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# local env files
.env.local
.env.development.local
.env.test.local
.env.production.local
# vercel
.vercel

File diff suppressed because one or more lines are too long

@ -0,0 +1,24 @@
{
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"function": "nextjsFunc"
}
]
},
"functions": {
"source": ".",
"predeploy": [
"yarn",
"yarn build"
],
"runtime": "nodejs14"
}
}

@ -0,0 +1,17 @@
const { join } = require('path')
const { https } = require('firebase-functions')
const { default: next } = require('next')
const nextjsDistDir = join('src', require('./src/next.config.js').distDir)
const nextjsServer = next({
dev: false,
conf: {
distDir: nextjsDistDir,
},
})
const nextjsHandle = nextjsServer.getRequestHandler()
exports.nextjsFunc = https.onRequest((req, res) => {
return nextjsServer.prepare().then(() => nextjsHandle(req, res))
})

@ -0,0 +1,24 @@
{
"private": true,
"main": "firebaseFunctions.js",
"scripts": {
"dev": "next src/",
"build": "next build src/",
"start": "next start src/",
"serve": "npm run build && firebase emulators:start --only functions,hosting",
"shell": "npm run build && firebase functions:shell",
"deploy": "firebase deploy --only functions,hosting",
"logs": "firebase functions:log"
},
"dependencies": {
"firebase-admin": "^9.4.2",
"firebase-functions": "^3.13.1",
"next": "latest",
"react": "^17.0.2",
"react-dom": "^17.0.2"
},
"devDependencies": {
"firebase-functions-test": "^0.2.3",
"firebase-tools": "^9.3.0"
}
}

@ -0,0 +1,11 @@
import React from 'react'
import Header from './Header'
const App = ({ children }) => (
<main>
<Header />
{children}
</main>
)
export default App

@ -0,0 +1,15 @@
import * as React from 'react'
import Link from 'next/link'
const Header = ({ pathname }) => (
<header>
<Link href="/">
<a className={pathname === '/' ? 'is-active' : ''}>Home</a>
</Link>{' '}
<Link href="/about">
<a className={pathname === '/about' ? 'is-active' : ''}>About</a>
</Link>
</header>
)
export default Header

@ -0,0 +1,3 @@
module.exports = {
distDir: '../.next',
}

@ -0,0 +1,9 @@
import App from '../components/App'
export default function About() {
return (
<App>
<p>About Page</p>
</App>
)
}

@ -0,0 +1,9 @@
import App from '../components/App'
export default function Home() {
return (
<App>
<p>Index Page</p>
</App>
)
}

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save