From d893e263b56e21a3c057cfe2eed40a4f03f7e0ef Mon Sep 17 00:00:00 2001 From: Vishnu Sankar <4602725+iamvishnusankar@users.noreply.github.com> Date: Tue, 15 Nov 2022 16:20:45 +0530 Subject: [PATCH 1/4] Added app dir example --- .eslintrc | 5 ++- examples/base-app-dir/.vscode/settings.json | 4 +++ examples/base-app-dir/app/layout.tsx | 14 ++++++++ examples/base-app-dir/app/page.tsx | 11 ++++++ examples/base-app-dir/next-env.d.ts | 5 +++ examples/base-app-dir/next-sitemap.config.js | 16 +++++++++ examples/base-app-dir/next.config.js | 8 +++++ examples/base-app-dir/package.json | 23 +++++++++++++ examples/base-app-dir/tsconfig.json | 36 ++++++++++++++++++++ 9 files changed, 121 insertions(+), 1 deletion(-) create mode 100644 examples/base-app-dir/.vscode/settings.json create mode 100644 examples/base-app-dir/app/layout.tsx create mode 100644 examples/base-app-dir/app/page.tsx create mode 100644 examples/base-app-dir/next-env.d.ts create mode 100644 examples/base-app-dir/next-sitemap.config.js create mode 100644 examples/base-app-dir/next.config.js create mode 100644 examples/base-app-dir/package.json create mode 100644 examples/base-app-dir/tsconfig.json diff --git a/.eslintrc b/.eslintrc index 10c5c1f9..72e43bee 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,3 +1,6 @@ { - "extends": "@corex" + "extends": "@corex", + "rules": { + "react/react-in-jsx-scope": "off" + } } diff --git a/examples/base-app-dir/.vscode/settings.json b/examples/base-app-dir/.vscode/settings.json new file mode 100644 index 00000000..c3d9d94c --- /dev/null +++ b/examples/base-app-dir/.vscode/settings.json @@ -0,0 +1,4 @@ +{ + "typescript.tsdk": "./node_modules/typescript/lib", + "typescript.enablePromptUseWorkspaceTsdk": true +} \ No newline at end of file diff --git a/examples/base-app-dir/app/layout.tsx b/examples/base-app-dir/app/layout.tsx new file mode 100644 index 00000000..46f4ea6d --- /dev/null +++ b/examples/base-app-dir/app/layout.tsx @@ -0,0 +1,14 @@ +import React from 'react' + +export default function RootLayout({ + children, +}: { + children: React.ReactNode +}) { + return ( + + + {children} + + ) +} diff --git a/examples/base-app-dir/app/page.tsx b/examples/base-app-dir/app/page.tsx new file mode 100644 index 00000000..9908ef9e --- /dev/null +++ b/examples/base-app-dir/app/page.tsx @@ -0,0 +1,11 @@ +import React from 'react' + +const HomePage: React.FC = () => { + return ( +
+

HomePage Component

+
+ ) +} + +export default HomePage diff --git a/examples/base-app-dir/next-env.d.ts b/examples/base-app-dir/next-env.d.ts new file mode 100644 index 00000000..4f11a03d --- /dev/null +++ b/examples/base-app-dir/next-env.d.ts @@ -0,0 +1,5 @@ +/// +/// + +// NOTE: This file should not be edited +// see https://nextjs.org/docs/basic-features/typescript for more information. diff --git a/examples/base-app-dir/next-sitemap.config.js b/examples/base-app-dir/next-sitemap.config.js new file mode 100644 index 00000000..c4dffed4 --- /dev/null +++ b/examples/base-app-dir/next-sitemap.config.js @@ -0,0 +1,16 @@ +/** @type {import('next-sitemap').IConfig} */ +const config = { + siteUrl: process.env.SITE_URL || 'https://example.com', + generateRobotsTxt: true, + sitemapSize: 1000, + // optional + robotsTxtOptions: { + additionalSitemaps: [ + 'https://example.com/my-custom-sitemap-1.xml', + 'https://example.com/my-custom-sitemap-2.xml', + 'https://example.com/my-custom-sitemap-3.xml', + ], + }, +} + +export default config diff --git a/examples/base-app-dir/next.config.js b/examples/base-app-dir/next.config.js new file mode 100644 index 00000000..1b30ee54 --- /dev/null +++ b/examples/base-app-dir/next.config.js @@ -0,0 +1,8 @@ +/**@type {import('next').NextConfig} */ +const config = { + experimental: { + appDir: true, + }, +} + +export default config diff --git a/examples/base-app-dir/package.json b/examples/base-app-dir/package.json new file mode 100644 index 00000000..5a7e2734 --- /dev/null +++ b/examples/base-app-dir/package.json @@ -0,0 +1,23 @@ +{ + "name": "with-next-app-dir", + "version": "1.0.0", + "main": "index.js", + "license": "MIT", + "private": true, + "type": "module", + "scripts": { + "dev": "next", + "build": "next build", + "postbuild": "next-sitemap" + }, + "dependencies": { + "@types/react-dom": "^18.0.6", + "next": "^13.0.2", + "react": "^18.2.0", + "react-dom": "^18.2.0" + }, + "devDependencies": { + "@types/react": "^18.0.17", + "next-sitemap": "*" + } +} diff --git a/examples/base-app-dir/tsconfig.json b/examples/base-app-dir/tsconfig.json new file mode 100644 index 00000000..161d999d --- /dev/null +++ b/examples/base-app-dir/tsconfig.json @@ -0,0 +1,36 @@ +{ + "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", + ".next/types/**/*.ts", + "**/*.ts", + "**/*.tsx" + ], + "exclude": [ + "node_modules" + ] +} From 3945524d0d7d5d6f24d69ff2b4e177a78b763b75 Mon Sep 17 00:00:00 2001 From: Vishnu Sankar <4602725+iamvishnusankar@users.noreply.github.com> Date: Tue, 15 Nov 2022 16:24:57 +0530 Subject: [PATCH 2/4] Rename example page --- .../.vscode/settings.json | 0 examples/app-dir/app/[dynamic]/page.tsx | 20 +++++++++++++++++++ .../{base-app-dir => app-dir}/app/layout.tsx | 0 .../{base-app-dir => app-dir}/app/page.tsx | 0 .../{base-app-dir => app-dir}/next-env.d.ts | 0 .../next-sitemap.config.js | 0 .../{base-app-dir => app-dir}/next.config.js | 0 .../{base-app-dir => app-dir}/package.json | 0 .../{base-app-dir => app-dir}/tsconfig.json | 0 9 files changed, 20 insertions(+) rename examples/{base-app-dir => app-dir}/.vscode/settings.json (100%) create mode 100644 examples/app-dir/app/[dynamic]/page.tsx rename examples/{base-app-dir => app-dir}/app/layout.tsx (100%) rename examples/{base-app-dir => app-dir}/app/page.tsx (100%) rename examples/{base-app-dir => app-dir}/next-env.d.ts (100%) rename examples/{base-app-dir => app-dir}/next-sitemap.config.js (100%) rename examples/{base-app-dir => app-dir}/next.config.js (100%) rename examples/{base-app-dir => app-dir}/package.json (100%) rename examples/{base-app-dir => app-dir}/tsconfig.json (100%) diff --git a/examples/base-app-dir/.vscode/settings.json b/examples/app-dir/.vscode/settings.json similarity index 100% rename from examples/base-app-dir/.vscode/settings.json rename to examples/app-dir/.vscode/settings.json diff --git a/examples/app-dir/app/[dynamic]/page.tsx b/examples/app-dir/app/[dynamic]/page.tsx new file mode 100644 index 00000000..6d48cd5f --- /dev/null +++ b/examples/app-dir/app/[dynamic]/page.tsx @@ -0,0 +1,20 @@ +const DynamicPage: React.FC = ({ params }) => { + return ( +
+

DynamicPage Component

+
{JSON.stringify(params, null, 2)}
+
+ ) +} + +export default DynamicPage + +/** + * @see https://beta.nextjs.org/docs/api-reference/generate-static-params + * @returns + */ +export async function generateStaticParams() { + return [...Array(10000)].map((_, index) => ({ + dynamic: `page-${index}`, + })) +} diff --git a/examples/base-app-dir/app/layout.tsx b/examples/app-dir/app/layout.tsx similarity index 100% rename from examples/base-app-dir/app/layout.tsx rename to examples/app-dir/app/layout.tsx diff --git a/examples/base-app-dir/app/page.tsx b/examples/app-dir/app/page.tsx similarity index 100% rename from examples/base-app-dir/app/page.tsx rename to examples/app-dir/app/page.tsx diff --git a/examples/base-app-dir/next-env.d.ts b/examples/app-dir/next-env.d.ts similarity index 100% rename from examples/base-app-dir/next-env.d.ts rename to examples/app-dir/next-env.d.ts diff --git a/examples/base-app-dir/next-sitemap.config.js b/examples/app-dir/next-sitemap.config.js similarity index 100% rename from examples/base-app-dir/next-sitemap.config.js rename to examples/app-dir/next-sitemap.config.js diff --git a/examples/base-app-dir/next.config.js b/examples/app-dir/next.config.js similarity index 100% rename from examples/base-app-dir/next.config.js rename to examples/app-dir/next.config.js diff --git a/examples/base-app-dir/package.json b/examples/app-dir/package.json similarity index 100% rename from examples/base-app-dir/package.json rename to examples/app-dir/package.json diff --git a/examples/base-app-dir/tsconfig.json b/examples/app-dir/tsconfig.json similarity index 100% rename from examples/base-app-dir/tsconfig.json rename to examples/app-dir/tsconfig.json From f2f68a7d49f65709c6cf0b6699d63a4595cff79e Mon Sep 17 00:00:00 2001 From: Vishnu Sankar <4602725+iamvishnusankar@users.noreply.github.com> Date: Tue, 15 Nov 2022 16:30:37 +0530 Subject: [PATCH 3/4] Fix formatting errors --- examples/app-dir/.vscode/settings.json | 2 +- examples/app-dir/tsconfig.json | 17 +++-------------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/examples/app-dir/.vscode/settings.json b/examples/app-dir/.vscode/settings.json index c3d9d94c..ce508cdd 100644 --- a/examples/app-dir/.vscode/settings.json +++ b/examples/app-dir/.vscode/settings.json @@ -1,4 +1,4 @@ { "typescript.tsdk": "./node_modules/typescript/lib", "typescript.enablePromptUseWorkspaceTsdk": true -} \ No newline at end of file +} diff --git a/examples/app-dir/tsconfig.json b/examples/app-dir/tsconfig.json index 161d999d..67524906 100644 --- a/examples/app-dir/tsconfig.json +++ b/examples/app-dir/tsconfig.json @@ -1,11 +1,7 @@ { "compilerOptions": { "target": "es5", - "lib": [ - "dom", - "dom.iterable", - "esnext" - ], + "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "skipLibCheck": true, "strict": false, @@ -24,13 +20,6 @@ } ] }, - "include": [ - "next-env.d.ts", - ".next/types/**/*.ts", - "**/*.ts", - "**/*.tsx" - ], - "exclude": [ - "node_modules" - ] + "include": ["next-env.d.ts", ".next/types/**/*.ts", "**/*.ts", "**/*.tsx"], + "exclude": ["node_modules"] } From ab88f18f16d356d2a0068da8009fae1cbd933d97 Mon Sep 17 00:00:00 2001 From: Vishnu Sankar <4602725+iamvishnusankar@users.noreply.github.com> Date: Wed, 16 Nov 2022 08:20:01 +0530 Subject: [PATCH 4/4] Drop node14 support --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 591f8645..b95ed60e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,7 +14,7 @@ jobs: strategy: matrix: platform: [ubuntu-latest, macos-latest, windows-latest] - node: ['17', '16', '14.18'] + node: ['16', '17', '18', '19'] runs-on: ${{ matrix.platform }} steps: - name: Github Checkout