Skip to content

Commit

Permalink
#8 set up amp (#12)
Browse files Browse the repository at this point in the history
* #8 set install script

* #8 Set up amp

* #8 Fix deploy script

* #8 Updated packages
  • Loading branch information
bhowmikp committed Jun 28, 2020
1 parent 460d820 commit 2dee7d8
Show file tree
Hide file tree
Showing 10 changed files with 4,355 additions and 10,801 deletions.
5 changes: 3 additions & 2 deletions package.json
Expand Up @@ -10,8 +10,9 @@
"serve": "firebase serve",
"predeploy": "npm run build-all",
"deploy": "firebase deploy",
"build-all": "npm run build-next && npm run build-firebase && cp -R src/functions/next .",
"build-all": "npm run clean && npm run build-next && npm run build-firebase && mkdir src/functions/app && cp -R src/app/next src/functions/app",
"build-next": "cd \"src/app\" && npm install && npm run build",
"build-firebase": "cd \"src/functions\" && npm install"
"build-firebase": "cd \"src/functions\" && npm install",
"clean": "rm -rf src/functions/app"
}
}
2 changes: 1 addition & 1 deletion src/app/next.config.js
@@ -1,3 +1,3 @@
module.exports = {
distDir: "../functions/next"
distDir: "./next"
};
4,637 changes: 2,146 additions & 2,491 deletions src/app/package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/app/package.json
Expand Up @@ -2,9 +2,9 @@
"name": "app",
"version": "1.0.0",
"dependencies": {
"next": "9.3.1",
"react": "^16.13.0",
"react-dom": "^16.13.0"
"next": "^9.4.4",
"react": "^16.13.1",
"react-dom": "^16.13.1"
},
"scripts": {
"dev": "next",
Expand Down
18 changes: 13 additions & 5 deletions src/app/pages/index.tsx
@@ -1,7 +1,15 @@
import App from "../components/App";
import { useAmp } from "next/amp";

export default () => (
<App>
<p>Index Page</p>
</App>
);
export const config = { amp: "hybrid" };

export default () => {
const isAmp = useAmp();

return (
<App>
<p>Index Page</p>
{isAmp ? <p>Amp site</p> : <p>Regular site</p>}
</App>
);
};
5,960 changes: 0 additions & 5,960 deletions src/app/yarn.lock

This file was deleted.

3 changes: 2 additions & 1 deletion src/functions/.gitignore
@@ -1 +1,2 @@
next
next
app
3 changes: 2 additions & 1 deletion src/functions/index.js
Expand Up @@ -3,7 +3,8 @@
const functions = require("firebase-functions");
const next = require("next");

const app = next({ dev: false, conf: { distDir: "next" } });
const dir = __dirname + "/app";
const app = next({ dev: false, dir, conf: { distDir: "next" } });
const handle = app.getRequestHandler();

exports.next = functions.https.onRequest(async (req, res) => {
Expand Down
4,516 changes: 2,182 additions & 2,334 deletions src/functions/package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/functions/package.json
Expand Up @@ -3,9 +3,9 @@
"description": "Cloud Functions for Firebase",
"version": "1.0.0",
"dependencies": {
"next": "9.3.1",
"react": "^16.13.0",
"react-dom": "^16.13.0",
"next": "^9.4.4",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"firebase-admin": "~8.9.2",
"firebase-functions": "^3.3.0"
},
Expand Down

0 comments on commit 2dee7d8

Please sign in to comment.