Skip to content

Commit

Permalink
chore(issue-template): added our own reproduction template
Browse files Browse the repository at this point in the history
  • Loading branch information
DuCanhGH committed Dec 24, 2023
1 parent aaf28fe commit 5198496
Show file tree
Hide file tree
Showing 16 changed files with 345 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/0-bug-next-pwa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ body:
- type: input
attributes:
label: Link to reproduction - Issues with a link to complete (but minimal) reproduction code help us address them faster
description: A link to a GitHub repository, a [StackBlitz](https://stackblitz.com/fork/github/vercel/next.js/tree/canary/examples/reproduction-template), or a [CodeSandbox](https://codesandbox.io/s/github/vercel/next.js/tree/canary/examples/reproduction-template) minimal reproduction. Minimal reproductions should be created from Next.js's [bug report template with `npx create-next-app -e reproduction-template`](https://github.com/vercel/next.js/tree/canary/examples/reproduction-template) and should include only changes that contribute to the issue.
description: A link to a GitHub repository of a minimal reproduction. Minimal reproductions should be created from [our bug report template with `npx create-next-app -e https://github.com/DuCanhGH/next-pwa/tree/master/examples/reproduction-template`](https://github.com/DuCanhGH/next-pwa/tree/master/examples/reproduction-template) and should include only changes that contribute to the issue.
validations:
required: true
- type: textarea
Expand Down
4 changes: 4 additions & 0 deletions contributing/examples/adding-examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ yarn create next-app --example https://github.com/DuCanhGH/next-pwa/tree/master/
pnpm create next-app --example https://github.com/DuCanhGH/next-pwa/tree/master/examples/DIRECTORY_NAME DIRECTORY_NAME-app
```

```bash
bun create next-app --example https://github.com/DuCanhGH/next-pwa/tree/master/examples/DIRECTORY_NAME DIRECTORY_NAME-app
```

## Recommended `.gitignore`

```gitignore
Expand Down
2 changes: 1 addition & 1 deletion docs/content/next-pwa/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ Add the following to your `app/layout.tsx` or `pages/_app.tsx`:

```ts
// title app/layout.tsx
import type { Metadata } from "next";
import type { Metadata, Viewport } from "next";

const APP_NAME = "PWA App";
const APP_DEFAULT_TITLE = "My Awesome PWA App";
Expand Down
43 changes: 43 additions & 0 deletions examples/reproduction-template/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts

# next-pwa
**/public/workbox**
**/public/sw**
**/public/worker**
**/public/fallback**
**/public/precache**
19 changes: 19 additions & 0 deletions examples/reproduction-template/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# next-pwa - reproduction-template

This example is a reproduction template.

## Usage

Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:

```bash
npx create-next-app --example https://github.com/DuCanhGH/next-pwa/tree/master/examples/reproduction-template reproduction
```

```bash
yarn create next-app --example https://github.com/DuCanhGH/next-pwa/tree/master/examples/reproduction-template reproduction
```

```bash
pnpm create next-app --example https://github.com/DuCanhGH/next-pwa/tree/master/examples/reproduction-template reproduction
```
40 changes: 40 additions & 0 deletions examples/reproduction-template/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import type { Metadata, Viewport } from "next";
import type { ReactNode } from "react";

const APP_NAME = "next-pwa example";
const APP_DESCRIPTION = "This is an example of using next-pwa";

export const metadata: Metadata = {
applicationName: APP_NAME,
title: {
default: APP_NAME,
template: "%s - PWA App",
},
description: APP_DESCRIPTION,
manifest: "/manifest.json",
appleWebApp: {
capable: true,
statusBarStyle: "default",
title: APP_NAME,
},
formatDetection: {
telephone: false,
},
icons: {
shortcut: "/favicon.ico",
apple: [{ url: "/icons/apple-touch-icon.png", sizes: "180x180" }],
},
};

export const viewport: Viewport = {
themeColor: "#FFFFFF",
};

export default function RootLayout({ children }: { children: ReactNode }) {
return (
<html>
<head />
<body>{children}</body>
</html>
);
}
4 changes: 4 additions & 0 deletions examples/reproduction-template/app/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/** Add your relevant code here for the issue to reproduce */
export default function Page() {
return null;
}
10 changes: 10 additions & 0 deletions examples/reproduction-template/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const withPWA = require("@ducanh2912/next-pwa").default({
dest: "public",
});

/** @type {import("next").NextConfig} */
const nextConfig = {
reactStrictMode: true,
};

module.exports = withPWA(nextConfig);
23 changes: 23 additions & 0 deletions examples/reproduction-template/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "@next-pwa-example/reproduction-template",
"version": "1.0.0",
"license": "MIT",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
},
"dependencies": {
"@ducanh2912/next-pwa": "workspace:*",
"next": "canary",
"react": "18.2.0",
"react-dom": "18.2.0"
},
"devDependencies": {
"@types/node": "20.10.4",
"@types/react": "18.2.43",
"@types/react-dom": "18.2.17",
"typescript": "5.3.3"
}
}
Binary file added examples/reproduction-template/public/favicon.ico
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions examples/reproduction-template/public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "next-pwa",
"short_name": "next-pwa",
"display": "standalone",
"orientation": "portrait",
"theme_color": "#FFFFFF",
"background_color": "#FFFFFF",
"start_url": "/",
"icons": [
{
"src": "/icons/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "any maskable"
},
{
"src": "/icons/icon-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
]
}
25 changes: 25 additions & 0 deletions examples/reproduction-template/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": false,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"incremental": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"plugins": [
{
"name": "next"
}
]
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}
Loading

0 comments on commit 5198496

Please sign in to comment.