Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add pwa to projectshut #2044

Merged
merged 14 commits into from
Aug 10, 2023
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,11 @@ package-lock.json

yarn.lock

# ignore service workers
# Auto Generated PWA files
**/public/sw.js
**/public/workbox-*.js
**/public/worker-*.js
**/public/sw.js.map
**/public/workbox-*.js.map
**/public/worker-*.js.map
Copy link
Owner

@priyankarpal priyankarpal Aug 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot to mention to add these files & also, delete these files these are important

sw.js
sw.js.map
workbox-3576cac3.js
workbox-3576cac3.js.map
Suggested change
**/public/sw.js
**/public/workbox-*.js
**/public/worker-*.js
**/public/sw.js.map
**/public/workbox-*.js.map
**/public/worker-*.js.map
sw.js
sw.js.map
workbox-3576cac3.js
workbox-3576cac3.js.map

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SubhamB2003 please check this

53 changes: 35 additions & 18 deletions app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,43 @@
import "./globals.css";
import { Inter } from "next/font/google";
import { Footer, Navbar, ScrollToTop } from "@/components";
import { MobileNavBar } from "@/components/MobileNavbar";
import { Navbar, Footer, ScrollToTop } from "@/components";
import "@/public/manifest.json";
import { Metadata } from "next";

import { Inter } from "next/font/google";
import "./globals.css";

const inter = Inter({ subsets: ["latin"] });

export const metadata: Metadata = {
metadataBase: new URL("https://projectshut.vercel.app/"),
manifest: "/manifest.json",
title: {
default: "ProjectsHut - Learn. Build. Share.",
template: '%s - ProjectsHut',
template: "%s - ProjectsHut",
},
description: "A platform where you can share your open source projects with the world.",
keywords: ["ProjectHut", "projects", "educational resources","wide range of products", "high-quality projects", "React", "Nodejs", "JavaScript", "open source", "contribution", "learners"],
authors: {name: "Priyankar Pal"},
description:
"A platform where you can share your open source projects with the world.",
keywords: [
"ProjectHut",
"projects",
"educational resources",
"wide range of products",
"high-quality projects",
"React",
"Nodejs",
"JavaScript",
"open source",
"contribution",
"learners",
],
authors: { name: "Priyankar Pal" },
openGraph: {
title: 'ProjectsHut - Learn. Build. Share.',
description: 'A platform where you can share your open source projects with the world.',
url: 'https://projectshut.vercel.app',
siteName: 'ProjectHut',
locale: 'en-US',
type: 'website',
title: "ProjectsHut - Learn. Build. Share.",
description:
"A platform where you can share your open source projects with the world.",
url: "https://projectshut.vercel.app",
siteName: "ProjectHut",
locale: "en-US",
type: "website",
},
robots: {
index: true,
Expand All @@ -36,10 +51,12 @@ export const metadata: Metadata = {
},
},
twitter: {
title: 'ProjectsHut - Learn. Build. Share.',
card: 'summary_large_image',
description: "A platform where you can share your open source projects with the world.",
images: "https://user-images.githubusercontent.com/88102392/251507361-e71396f9-92c6-4664-b7e4-4275cb902e65.png"
title: "ProjectsHut - Learn. Build. Share.",
card: "summary_large_image",
description:
"A platform where you can share your open source projects with the world.",
images:
"https://user-images.githubusercontent.com/88102392/251507361-e71396f9-92c6-4664-b7e4-4275cb902e65.png",
},
};

Expand Down
9 changes: 7 additions & 2 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
/** @type {import('next').NextConfig} */
const withPWA = require("next-pwa")({
dest: "public",
register: true,
skipWaiting: true,
});

const nextConfig = {
images: {
Expand All @@ -9,7 +14,7 @@ const nextConfig = {
"github.com",
],
},
trailingSlash: true,
trailingSlash: true
};

module.exports = nextConfig;
module.exports = withPWA(nextConfig);
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
"eslint-config-next": "13.4.13",
"framer-motion": "^10.15.1",
"next": "^13.4.13",
"next-pwa": "^5.6.0",
"pnpm": "^8.6.12",
"postcss": "8.4.27",
"react": "18.2.0",
"react-dom": "18.2.0",
Expand All @@ -34,9 +36,9 @@
"typescript": "5.1.6"
},
"devDependencies": {
"@commitlint/config-conventional": "^17.7.0",
"@commitlint/cli": "^17.7.0",
"@commitlint/config-conventional": "^17.7.0",
"@types/react-syntax-highlighter": "^15.5.7",
"husky": "^8.0.3"
}
}
}
Loading