diff --git a/docs/02-app/02-api-reference/06-create-next-app.mdx b/docs/02-app/02-api-reference/06-create-next-app.mdx index 069b2e2d858f8..7590067d62c2d 100644 --- a/docs/02-app/02-api-reference/06-create-next-app.mdx +++ b/docs/02-app/02-api-reference/06-create-next-app.mdx @@ -84,6 +84,10 @@ Options: Specify import alias to use (default "@/*"). + --empty + + Initialize an empty project. + --use-npm Explicitly tell the CLI to bootstrap the app using npm diff --git a/packages/create-next-app/create-app.ts b/packages/create-next-app/create-app.ts index a6270e4d6bdaf..cbd7d2110b25d 100644 --- a/packages/create-next-app/create-app.ts +++ b/packages/create-next-app/create-app.ts @@ -35,6 +35,7 @@ export async function createApp({ srcDir, importAlias, skipInstall, + empty, }: { appPath: string packageManager: PackageManager @@ -47,16 +48,11 @@ export async function createApp({ srcDir: boolean importAlias: string skipInstall: boolean + empty: boolean }): Promise { let repoInfo: RepoInfo | undefined const mode: TemplateMode = typescript ? 'ts' : 'js' - const template: TemplateType = appRouter - ? tailwind - ? 'app-tw' - : 'app' - : tailwind - ? 'default-tw' - : 'default' + const template: TemplateType = `${appRouter ? 'app' : 'default'}${tailwind ? '-tw' : ''}${empty ? '-empty' : ''}` if (example) { let repoUrl: URL | undefined diff --git a/packages/create-next-app/index.ts b/packages/create-next-app/index.ts index 7d6ab04a4d5de..972d8237986d2 100644 --- a/packages/create-next-app/index.ts +++ b/packages/create-next-app/index.ts @@ -90,6 +90,13 @@ const program = new Commander.Command(packageJson.name) ` Specify import alias to use (default "@/*"). +` + ) + .option( + '--empty', + ` + + Initialize an empty project. ` ) .option( @@ -264,6 +271,7 @@ async function run(): Promise { srcDir: false, importAlias: '@/*', customizeImportAlias: false, + empty: false, } const getPrefOrDefault = (field: string) => preferences[field] ?? defaults[field] @@ -446,6 +454,7 @@ async function run(): Promise { srcDir: program.srcDir, importAlias: program.importAlias, skipInstall: program.skipInstall, + empty: program.empty, }) } catch (reason) { if (!(reason instanceof DownloadError)) { @@ -475,6 +484,7 @@ async function run(): Promise { srcDir: program.srcDir, importAlias: program.importAlias, skipInstall: program.skipInstall, + empty: program.empty, }) } conf.set('preferences', preferences) diff --git a/packages/create-next-app/templates/app-empty/js/.env.example b/packages/create-next-app/templates/app-empty/js/.env.example new file mode 100644 index 0000000000000..ce586fad292cd --- /dev/null +++ b/packages/create-next-app/templates/app-empty/js/.env.example @@ -0,0 +1,3 @@ +# Rename this file to `.env.local` to use environment variables locally with `next dev` +# https://nextjs.org/docs/app/building-your-application/configuring/environment-variables +MY_HOST="example.com" diff --git a/packages/create-next-app/templates/app-empty/js/README-template.md b/packages/create-next-app/templates/app-empty/js/README-template.md new file mode 100644 index 0000000000000..519e2e66a41f2 --- /dev/null +++ b/packages/create-next-app/templates/app-empty/js/README-template.md @@ -0,0 +1,34 @@ +This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). + +## Getting Started + +First, run the development server: + +```bash +npm run dev +# or +yarn dev +# or +pnpm dev +# or +bun dev +``` + +Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. + +You can start editing the page by modifying `app/page.js`. The page auto-updates as you edit the file. + +## Learn More + +To learn more about Next.js, take a look at the following resources: + +- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. +- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. + +You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! + +## Deploy on Vercel + +The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. + +Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. diff --git a/packages/create-next-app/templates/app-empty/js/app/favicon.ico b/packages/create-next-app/templates/app-empty/js/app/favicon.ico new file mode 100644 index 0000000000000..718d6fea4835e Binary files /dev/null and b/packages/create-next-app/templates/app-empty/js/app/favicon.ico differ diff --git a/packages/create-next-app/templates/app-empty/js/app/layout.js b/packages/create-next-app/templates/app-empty/js/app/layout.js new file mode 100644 index 0000000000000..a45d7e1b56adc --- /dev/null +++ b/packages/create-next-app/templates/app-empty/js/app/layout.js @@ -0,0 +1,12 @@ +export const metadata = { + title: "Create Next App", + description: "Generated by create next app", +}; + +export default function RootLayout({ children }) { + return ( + + {children} + + ); +} diff --git a/packages/create-next-app/templates/app-empty/js/app/page.js b/packages/create-next-app/templates/app-empty/js/app/page.js new file mode 100644 index 0000000000000..2342325c680cd --- /dev/null +++ b/packages/create-next-app/templates/app-empty/js/app/page.js @@ -0,0 +1,7 @@ +export default function Home() { + return ( +
+
Hello World!
+
+ ); +} diff --git a/packages/create-next-app/templates/app-empty/js/eslintrc.json b/packages/create-next-app/templates/app-empty/js/eslintrc.json new file mode 100644 index 0000000000000..bffb357a71225 --- /dev/null +++ b/packages/create-next-app/templates/app-empty/js/eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "next/core-web-vitals" +} diff --git a/packages/create-next-app/templates/app-empty/js/gitignore b/packages/create-next-app/templates/app-empty/js/gitignore new file mode 100644 index 0000000000000..fd3dbb571a12a --- /dev/null +++ b/packages/create-next-app/templates/app-empty/js/gitignore @@ -0,0 +1,36 @@ +# 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 diff --git a/packages/create-next-app/templates/app-empty/js/jsconfig.json b/packages/create-next-app/templates/app-empty/js/jsconfig.json new file mode 100644 index 0000000000000..2a2e4b3bf8ba1 --- /dev/null +++ b/packages/create-next-app/templates/app-empty/js/jsconfig.json @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "paths": { + "@/*": ["./*"] + } + } +} diff --git a/packages/create-next-app/templates/app-empty/js/next.config.mjs b/packages/create-next-app/templates/app-empty/js/next.config.mjs new file mode 100644 index 0000000000000..4678774e6d606 --- /dev/null +++ b/packages/create-next-app/templates/app-empty/js/next.config.mjs @@ -0,0 +1,4 @@ +/** @type {import('next').NextConfig} */ +const nextConfig = {}; + +export default nextConfig; diff --git a/packages/create-next-app/templates/app-empty/ts/.env.example b/packages/create-next-app/templates/app-empty/ts/.env.example new file mode 100644 index 0000000000000..ce586fad292cd --- /dev/null +++ b/packages/create-next-app/templates/app-empty/ts/.env.example @@ -0,0 +1,3 @@ +# Rename this file to `.env.local` to use environment variables locally with `next dev` +# https://nextjs.org/docs/app/building-your-application/configuring/environment-variables +MY_HOST="example.com" diff --git a/packages/create-next-app/templates/app-empty/ts/README-template.md b/packages/create-next-app/templates/app-empty/ts/README-template.md new file mode 100644 index 0000000000000..08f571f49a3f0 --- /dev/null +++ b/packages/create-next-app/templates/app-empty/ts/README-template.md @@ -0,0 +1,34 @@ +This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). + +## Getting Started + +First, run the development server: + +```bash +npm run dev +# or +yarn dev +# or +pnpm dev +# or +bun dev +``` + +Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. + +You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. + +## Learn More + +To learn more about Next.js, take a look at the following resources: + +- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. +- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. + +You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! + +## Deploy on Vercel + +The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. + +Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. diff --git a/packages/create-next-app/templates/app-empty/ts/app/layout.tsx b/packages/create-next-app/templates/app-empty/ts/app/layout.tsx new file mode 100644 index 0000000000000..112756e6bfcdc --- /dev/null +++ b/packages/create-next-app/templates/app-empty/ts/app/layout.tsx @@ -0,0 +1,18 @@ +import type { Metadata } from "next"; + +export const metadata: Metadata = { + title: "Create Next App", + description: "Generated by create next app", +}; + +export default function RootLayout({ + children, +}: Readonly<{ + children: React.ReactNode; +}>) { + return ( + + {children} + + ); +} diff --git a/packages/create-next-app/templates/app-empty/ts/app/page.tsx b/packages/create-next-app/templates/app-empty/ts/app/page.tsx new file mode 100644 index 0000000000000..b95c3ed488adc --- /dev/null +++ b/packages/create-next-app/templates/app-empty/ts/app/page.tsx @@ -0,0 +1,7 @@ +export default function Home() { + return ( +
+
Hello world!
+
+ ); +} diff --git a/packages/create-next-app/templates/app-empty/ts/eslintrc.json b/packages/create-next-app/templates/app-empty/ts/eslintrc.json new file mode 100644 index 0000000000000..bffb357a71225 --- /dev/null +++ b/packages/create-next-app/templates/app-empty/ts/eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "next/core-web-vitals" +} diff --git a/packages/create-next-app/templates/app-empty/ts/gitignore b/packages/create-next-app/templates/app-empty/ts/gitignore new file mode 100644 index 0000000000000..fd3dbb571a12a --- /dev/null +++ b/packages/create-next-app/templates/app-empty/ts/gitignore @@ -0,0 +1,36 @@ +# 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 diff --git a/packages/create-next-app/templates/app-empty/ts/next-env.d.ts b/packages/create-next-app/templates/app-empty/ts/next-env.d.ts new file mode 100644 index 0000000000000..4f11a03dc6cc3 --- /dev/null +++ b/packages/create-next-app/templates/app-empty/ts/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/packages/create-next-app/templates/app-empty/ts/next.config.mjs b/packages/create-next-app/templates/app-empty/ts/next.config.mjs new file mode 100644 index 0000000000000..4678774e6d606 --- /dev/null +++ b/packages/create-next-app/templates/app-empty/ts/next.config.mjs @@ -0,0 +1,4 @@ +/** @type {import('next').NextConfig} */ +const nextConfig = {}; + +export default nextConfig; diff --git a/packages/create-next-app/templates/app-empty/ts/tsconfig.json b/packages/create-next-app/templates/app-empty/ts/tsconfig.json new file mode 100644 index 0000000000000..d8b93235f205e --- /dev/null +++ b/packages/create-next-app/templates/app-empty/ts/tsconfig.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "target": "ES2017", + "lib": ["dom", "dom.iterable", "esnext"], + "allowJs": true, + "skipLibCheck": true, + "strict": true, + "noEmit": true, + "esModuleInterop": true, + "module": "esnext", + "moduleResolution": "bundler", + "resolveJsonModule": true, + "isolatedModules": true, + "jsx": "preserve", + "incremental": true, + "plugins": [ + { + "name": "next" + } + ], + "paths": { + "@/*": ["./*"] + } + }, + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], + "exclude": ["node_modules"] +} diff --git a/packages/create-next-app/templates/app-tw-empty/js/.env.example b/packages/create-next-app/templates/app-tw-empty/js/.env.example new file mode 100644 index 0000000000000..ce586fad292cd --- /dev/null +++ b/packages/create-next-app/templates/app-tw-empty/js/.env.example @@ -0,0 +1,3 @@ +# Rename this file to `.env.local` to use environment variables locally with `next dev` +# https://nextjs.org/docs/app/building-your-application/configuring/environment-variables +MY_HOST="example.com" diff --git a/packages/create-next-app/templates/app-tw-empty/js/README-template.md b/packages/create-next-app/templates/app-tw-empty/js/README-template.md new file mode 100644 index 0000000000000..519e2e66a41f2 --- /dev/null +++ b/packages/create-next-app/templates/app-tw-empty/js/README-template.md @@ -0,0 +1,34 @@ +This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). + +## Getting Started + +First, run the development server: + +```bash +npm run dev +# or +yarn dev +# or +pnpm dev +# or +bun dev +``` + +Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. + +You can start editing the page by modifying `app/page.js`. The page auto-updates as you edit the file. + +## Learn More + +To learn more about Next.js, take a look at the following resources: + +- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. +- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. + +You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! + +## Deploy on Vercel + +The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. + +Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. diff --git a/packages/create-next-app/templates/app-tw-empty/js/app/favicon.ico b/packages/create-next-app/templates/app-tw-empty/js/app/favicon.ico new file mode 100644 index 0000000000000..718d6fea4835e Binary files /dev/null and b/packages/create-next-app/templates/app-tw-empty/js/app/favicon.ico differ diff --git a/packages/create-next-app/templates/app-tw-empty/js/app/globals.css b/packages/create-next-app/templates/app-tw-empty/js/app/globals.css new file mode 100644 index 0000000000000..b5c61c956711f --- /dev/null +++ b/packages/create-next-app/templates/app-tw-empty/js/app/globals.css @@ -0,0 +1,3 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; diff --git a/packages/create-next-app/templates/app-tw-empty/js/app/layout.js b/packages/create-next-app/templates/app-tw-empty/js/app/layout.js new file mode 100644 index 0000000000000..a55b51b6d7022 --- /dev/null +++ b/packages/create-next-app/templates/app-tw-empty/js/app/layout.js @@ -0,0 +1,14 @@ +import "./globals.css"; + +export const metadata = { + title: "Create Next App", + description: "Generated by create next app", +}; + +export default function RootLayout({ children }) { + return ( + + {children} + + ); +} diff --git a/packages/create-next-app/templates/app-tw-empty/js/app/page.js b/packages/create-next-app/templates/app-tw-empty/js/app/page.js new file mode 100644 index 0000000000000..b95c3ed488adc --- /dev/null +++ b/packages/create-next-app/templates/app-tw-empty/js/app/page.js @@ -0,0 +1,7 @@ +export default function Home() { + return ( +
+
Hello world!
+
+ ); +} diff --git a/packages/create-next-app/templates/app-tw-empty/js/eslintrc.json b/packages/create-next-app/templates/app-tw-empty/js/eslintrc.json new file mode 100644 index 0000000000000..bffb357a71225 --- /dev/null +++ b/packages/create-next-app/templates/app-tw-empty/js/eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "next/core-web-vitals" +} diff --git a/packages/create-next-app/templates/app-tw-empty/js/gitignore b/packages/create-next-app/templates/app-tw-empty/js/gitignore new file mode 100644 index 0000000000000..fd3dbb571a12a --- /dev/null +++ b/packages/create-next-app/templates/app-tw-empty/js/gitignore @@ -0,0 +1,36 @@ +# 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 diff --git a/packages/create-next-app/templates/app-tw-empty/js/jsconfig.json b/packages/create-next-app/templates/app-tw-empty/js/jsconfig.json new file mode 100644 index 0000000000000..2a2e4b3bf8ba1 --- /dev/null +++ b/packages/create-next-app/templates/app-tw-empty/js/jsconfig.json @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "paths": { + "@/*": ["./*"] + } + } +} diff --git a/packages/create-next-app/templates/app-tw-empty/js/next.config.mjs b/packages/create-next-app/templates/app-tw-empty/js/next.config.mjs new file mode 100644 index 0000000000000..4678774e6d606 --- /dev/null +++ b/packages/create-next-app/templates/app-tw-empty/js/next.config.mjs @@ -0,0 +1,4 @@ +/** @type {import('next').NextConfig} */ +const nextConfig = {}; + +export default nextConfig; diff --git a/packages/create-next-app/templates/app-tw-empty/js/postcss.config.mjs b/packages/create-next-app/templates/app-tw-empty/js/postcss.config.mjs new file mode 100644 index 0000000000000..1a69fd2a450af --- /dev/null +++ b/packages/create-next-app/templates/app-tw-empty/js/postcss.config.mjs @@ -0,0 +1,8 @@ +/** @type {import('postcss-load-config').Config} */ +const config = { + plugins: { + tailwindcss: {}, + }, +}; + +export default config; diff --git a/packages/create-next-app/templates/app-tw-empty/js/tailwind.config.js b/packages/create-next-app/templates/app-tw-empty/js/tailwind.config.js new file mode 100644 index 0000000000000..3ee1798645a97 --- /dev/null +++ b/packages/create-next-app/templates/app-tw-empty/js/tailwind.config.js @@ -0,0 +1,6 @@ +/** @type {import('tailwindcss').Config} */ +module.exports = { + content: ["./app/**/*.{js,jsx,mdx}"], + theme: {}, + plugins: [], +}; diff --git a/packages/create-next-app/templates/app-tw-empty/ts/.env.example b/packages/create-next-app/templates/app-tw-empty/ts/.env.example new file mode 100644 index 0000000000000..ce586fad292cd --- /dev/null +++ b/packages/create-next-app/templates/app-tw-empty/ts/.env.example @@ -0,0 +1,3 @@ +# Rename this file to `.env.local` to use environment variables locally with `next dev` +# https://nextjs.org/docs/app/building-your-application/configuring/environment-variables +MY_HOST="example.com" diff --git a/packages/create-next-app/templates/app-tw-empty/ts/README-template.md b/packages/create-next-app/templates/app-tw-empty/ts/README-template.md new file mode 100644 index 0000000000000..08f571f49a3f0 --- /dev/null +++ b/packages/create-next-app/templates/app-tw-empty/ts/README-template.md @@ -0,0 +1,34 @@ +This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). + +## Getting Started + +First, run the development server: + +```bash +npm run dev +# or +yarn dev +# or +pnpm dev +# or +bun dev +``` + +Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. + +You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. + +## Learn More + +To learn more about Next.js, take a look at the following resources: + +- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. +- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. + +You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! + +## Deploy on Vercel + +The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. + +Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. diff --git a/packages/create-next-app/templates/app-tw-empty/ts/app/favicon.ico b/packages/create-next-app/templates/app-tw-empty/ts/app/favicon.ico new file mode 100644 index 0000000000000..718d6fea4835e Binary files /dev/null and b/packages/create-next-app/templates/app-tw-empty/ts/app/favicon.ico differ diff --git a/packages/create-next-app/templates/app-tw-empty/ts/app/globals.css b/packages/create-next-app/templates/app-tw-empty/ts/app/globals.css new file mode 100644 index 0000000000000..b5c61c956711f --- /dev/null +++ b/packages/create-next-app/templates/app-tw-empty/ts/app/globals.css @@ -0,0 +1,3 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; diff --git a/packages/create-next-app/templates/app-tw-empty/ts/app/layout.tsx b/packages/create-next-app/templates/app-tw-empty/ts/app/layout.tsx new file mode 100644 index 0000000000000..756fcce4af9b0 --- /dev/null +++ b/packages/create-next-app/templates/app-tw-empty/ts/app/layout.tsx @@ -0,0 +1,19 @@ +import type { Metadata } from "next"; +import "./globals.css"; + +export const metadata: Metadata = { + title: "Create Next App", + description: "Generated by create next app", +}; + +export default function RootLayout({ + children, +}: Readonly<{ + children: React.ReactNode; +}>) { + return ( + + {children} + + ); +} diff --git a/packages/create-next-app/templates/app-tw-empty/ts/app/page.tsx b/packages/create-next-app/templates/app-tw-empty/ts/app/page.tsx new file mode 100644 index 0000000000000..b95c3ed488adc --- /dev/null +++ b/packages/create-next-app/templates/app-tw-empty/ts/app/page.tsx @@ -0,0 +1,7 @@ +export default function Home() { + return ( +
+
Hello world!
+
+ ); +} diff --git a/packages/create-next-app/templates/app-tw-empty/ts/eslintrc.json b/packages/create-next-app/templates/app-tw-empty/ts/eslintrc.json new file mode 100644 index 0000000000000..bffb357a71225 --- /dev/null +++ b/packages/create-next-app/templates/app-tw-empty/ts/eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "next/core-web-vitals" +} diff --git a/packages/create-next-app/templates/app-tw-empty/ts/gitignore b/packages/create-next-app/templates/app-tw-empty/ts/gitignore new file mode 100644 index 0000000000000..fd3dbb571a12a --- /dev/null +++ b/packages/create-next-app/templates/app-tw-empty/ts/gitignore @@ -0,0 +1,36 @@ +# 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 diff --git a/packages/create-next-app/templates/app-tw-empty/ts/next-env.d.ts b/packages/create-next-app/templates/app-tw-empty/ts/next-env.d.ts new file mode 100644 index 0000000000000..4f11a03dc6cc3 --- /dev/null +++ b/packages/create-next-app/templates/app-tw-empty/ts/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/packages/create-next-app/templates/app-tw-empty/ts/next.config.mjs b/packages/create-next-app/templates/app-tw-empty/ts/next.config.mjs new file mode 100644 index 0000000000000..4678774e6d606 --- /dev/null +++ b/packages/create-next-app/templates/app-tw-empty/ts/next.config.mjs @@ -0,0 +1,4 @@ +/** @type {import('next').NextConfig} */ +const nextConfig = {}; + +export default nextConfig; diff --git a/packages/create-next-app/templates/app-tw-empty/ts/postcss.config.mjs b/packages/create-next-app/templates/app-tw-empty/ts/postcss.config.mjs new file mode 100644 index 0000000000000..1a69fd2a450af --- /dev/null +++ b/packages/create-next-app/templates/app-tw-empty/ts/postcss.config.mjs @@ -0,0 +1,8 @@ +/** @type {import('postcss-load-config').Config} */ +const config = { + plugins: { + tailwindcss: {}, + }, +}; + +export default config; diff --git a/packages/create-next-app/templates/app-tw-empty/ts/tailwind.config.ts b/packages/create-next-app/templates/app-tw-empty/ts/tailwind.config.ts new file mode 100644 index 0000000000000..135d40c4dd2c1 --- /dev/null +++ b/packages/create-next-app/templates/app-tw-empty/ts/tailwind.config.ts @@ -0,0 +1,8 @@ +import type { Config } from "tailwindcss"; + +const config: Config = { + content: ["./app/**/*.{ts,tsx,mdx}"], + theme: {}, + plugins: [], +}; +export default config; diff --git a/packages/create-next-app/templates/app-tw-empty/ts/tsconfig.json b/packages/create-next-app/templates/app-tw-empty/ts/tsconfig.json new file mode 100644 index 0000000000000..d8b93235f205e --- /dev/null +++ b/packages/create-next-app/templates/app-tw-empty/ts/tsconfig.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "target": "ES2017", + "lib": ["dom", "dom.iterable", "esnext"], + "allowJs": true, + "skipLibCheck": true, + "strict": true, + "noEmit": true, + "esModuleInterop": true, + "module": "esnext", + "moduleResolution": "bundler", + "resolveJsonModule": true, + "isolatedModules": true, + "jsx": "preserve", + "incremental": true, + "plugins": [ + { + "name": "next" + } + ], + "paths": { + "@/*": ["./*"] + } + }, + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], + "exclude": ["node_modules"] +} diff --git a/packages/create-next-app/templates/default-empty/js/.env.example b/packages/create-next-app/templates/default-empty/js/.env.example new file mode 100644 index 0000000000000..7ac0a01551a65 --- /dev/null +++ b/packages/create-next-app/templates/default-empty/js/.env.example @@ -0,0 +1,3 @@ +# Rename this file to `.env.local` to use environment variables locally with `next dev` +# https://nextjs.org/docs/pages/building-your-application/configuring/environment-variables +MY_HOST="example.com" diff --git a/packages/create-next-app/templates/default-empty/js/README-template.md b/packages/create-next-app/templates/default-empty/js/README-template.md new file mode 100644 index 0000000000000..ab9a133f886f3 --- /dev/null +++ b/packages/create-next-app/templates/default-empty/js/README-template.md @@ -0,0 +1,34 @@ +This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). + +## Getting Started + +First, run the development server: + +```bash +npm run dev +# or +yarn dev +# or +pnpm dev +# or +bun dev +``` + +Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. + +You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file. + +## Learn More + +To learn more about Next.js, take a look at the following resources: + +- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. +- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. + +You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! + +## Deploy on Vercel + +The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. + +Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. diff --git a/packages/create-next-app/templates/default-empty/js/eslintrc.json b/packages/create-next-app/templates/default-empty/js/eslintrc.json new file mode 100644 index 0000000000000..bffb357a71225 --- /dev/null +++ b/packages/create-next-app/templates/default-empty/js/eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "next/core-web-vitals" +} diff --git a/packages/create-next-app/templates/default-empty/js/gitignore b/packages/create-next-app/templates/default-empty/js/gitignore new file mode 100644 index 0000000000000..fd3dbb571a12a --- /dev/null +++ b/packages/create-next-app/templates/default-empty/js/gitignore @@ -0,0 +1,36 @@ +# 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 diff --git a/packages/create-next-app/templates/default-empty/js/jsconfig.json b/packages/create-next-app/templates/default-empty/js/jsconfig.json new file mode 100644 index 0000000000000..2a2e4b3bf8ba1 --- /dev/null +++ b/packages/create-next-app/templates/default-empty/js/jsconfig.json @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "paths": { + "@/*": ["./*"] + } + } +} diff --git a/packages/create-next-app/templates/default-empty/js/next.config.mjs b/packages/create-next-app/templates/default-empty/js/next.config.mjs new file mode 100644 index 0000000000000..d5456a15d4ad2 --- /dev/null +++ b/packages/create-next-app/templates/default-empty/js/next.config.mjs @@ -0,0 +1,6 @@ +/** @type {import('next').NextConfig} */ +const nextConfig = { + reactStrictMode: true, +}; + +export default nextConfig; diff --git a/packages/create-next-app/templates/default-empty/js/pages/_app.js b/packages/create-next-app/templates/default-empty/js/pages/_app.js new file mode 100644 index 0000000000000..39b86cd6bc00b --- /dev/null +++ b/packages/create-next-app/templates/default-empty/js/pages/_app.js @@ -0,0 +1,3 @@ +export default function App({ Component, pageProps }) { + return ; +} diff --git a/packages/create-next-app/templates/default-empty/js/pages/_document.js b/packages/create-next-app/templates/default-empty/js/pages/_document.js new file mode 100644 index 0000000000000..b2fff8b4262dd --- /dev/null +++ b/packages/create-next-app/templates/default-empty/js/pages/_document.js @@ -0,0 +1,13 @@ +import { Html, Head, Main, NextScript } from "next/document"; + +export default function Document() { + return ( + + + +
+ + + + ); +} diff --git a/packages/create-next-app/templates/default-empty/js/pages/index.js b/packages/create-next-app/templates/default-empty/js/pages/index.js new file mode 100644 index 0000000000000..aec88264f0e89 --- /dev/null +++ b/packages/create-next-app/templates/default-empty/js/pages/index.js @@ -0,0 +1,17 @@ +import Head from "next/head"; + +export default function Home() { + return ( + <> + + Create Next App + + + + +
+
Hello World!
+
+ + ); +} diff --git a/packages/create-next-app/templates/default-empty/js/public/favicon.ico b/packages/create-next-app/templates/default-empty/js/public/favicon.ico new file mode 100644 index 0000000000000..718d6fea4835e Binary files /dev/null and b/packages/create-next-app/templates/default-empty/js/public/favicon.ico differ diff --git a/packages/create-next-app/templates/default-empty/ts/.env.example b/packages/create-next-app/templates/default-empty/ts/.env.example new file mode 100644 index 0000000000000..7ac0a01551a65 --- /dev/null +++ b/packages/create-next-app/templates/default-empty/ts/.env.example @@ -0,0 +1,3 @@ +# Rename this file to `.env.local` to use environment variables locally with `next dev` +# https://nextjs.org/docs/pages/building-your-application/configuring/environment-variables +MY_HOST="example.com" diff --git a/packages/create-next-app/templates/default-empty/ts/README-template.md b/packages/create-next-app/templates/default-empty/ts/README-template.md new file mode 100644 index 0000000000000..c9e96a4215aca --- /dev/null +++ b/packages/create-next-app/templates/default-empty/ts/README-template.md @@ -0,0 +1,34 @@ +This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). + +## Getting Started + +First, run the development server: + +```bash +npm run dev +# or +yarn dev +# or +pnpm dev +# or +bun dev +``` + +Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. + +You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file. + +## Learn More + +To learn more about Next.js, take a look at the following resources: + +- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. +- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. + +You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! + +## Deploy on Vercel + +The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. + +Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. diff --git a/packages/create-next-app/templates/default-empty/ts/eslintrc.json b/packages/create-next-app/templates/default-empty/ts/eslintrc.json new file mode 100644 index 0000000000000..bffb357a71225 --- /dev/null +++ b/packages/create-next-app/templates/default-empty/ts/eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "next/core-web-vitals" +} diff --git a/packages/create-next-app/templates/default-empty/ts/gitignore b/packages/create-next-app/templates/default-empty/ts/gitignore new file mode 100644 index 0000000000000..fd3dbb571a12a --- /dev/null +++ b/packages/create-next-app/templates/default-empty/ts/gitignore @@ -0,0 +1,36 @@ +# 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 diff --git a/packages/create-next-app/templates/default-empty/ts/next-env.d.ts b/packages/create-next-app/templates/default-empty/ts/next-env.d.ts new file mode 100644 index 0000000000000..4f11a03dc6cc3 --- /dev/null +++ b/packages/create-next-app/templates/default-empty/ts/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/packages/create-next-app/templates/default-empty/ts/next.config.mjs b/packages/create-next-app/templates/default-empty/ts/next.config.mjs new file mode 100644 index 0000000000000..d5456a15d4ad2 --- /dev/null +++ b/packages/create-next-app/templates/default-empty/ts/next.config.mjs @@ -0,0 +1,6 @@ +/** @type {import('next').NextConfig} */ +const nextConfig = { + reactStrictMode: true, +}; + +export default nextConfig; diff --git a/packages/create-next-app/templates/default-empty/ts/pages/_app.tsx b/packages/create-next-app/templates/default-empty/ts/pages/_app.tsx new file mode 100644 index 0000000000000..956fa84e0cd70 --- /dev/null +++ b/packages/create-next-app/templates/default-empty/ts/pages/_app.tsx @@ -0,0 +1,5 @@ +import type { AppProps } from "next/app"; + +export default function App({ Component, pageProps }: AppProps) { + return ; +} diff --git a/packages/create-next-app/templates/default-empty/ts/pages/_document.tsx b/packages/create-next-app/templates/default-empty/ts/pages/_document.tsx new file mode 100644 index 0000000000000..b2fff8b4262dd --- /dev/null +++ b/packages/create-next-app/templates/default-empty/ts/pages/_document.tsx @@ -0,0 +1,13 @@ +import { Html, Head, Main, NextScript } from "next/document"; + +export default function Document() { + return ( + + + +
+ + + + ); +} diff --git a/packages/create-next-app/templates/default-empty/ts/pages/index.tsx b/packages/create-next-app/templates/default-empty/ts/pages/index.tsx new file mode 100644 index 0000000000000..cca2c436bf5b3 --- /dev/null +++ b/packages/create-next-app/templates/default-empty/ts/pages/index.tsx @@ -0,0 +1,17 @@ +import Head from "next/head"; + +export default function Home() { + return ( + <> + + Create Next App + + + + +
+
Hello world!
+
+ + ); +} diff --git a/packages/create-next-app/templates/default-empty/ts/public/favicon.ico b/packages/create-next-app/templates/default-empty/ts/public/favicon.ico new file mode 100644 index 0000000000000..718d6fea4835e Binary files /dev/null and b/packages/create-next-app/templates/default-empty/ts/public/favicon.ico differ diff --git a/packages/create-next-app/templates/default-empty/ts/tsconfig.json b/packages/create-next-app/templates/default-empty/ts/tsconfig.json new file mode 100644 index 0000000000000..957e71fe5b523 --- /dev/null +++ b/packages/create-next-app/templates/default-empty/ts/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "target": "ES2017", + "lib": ["dom", "dom.iterable", "esnext"], + "allowJs": true, + "skipLibCheck": true, + "strict": true, + "noEmit": true, + "esModuleInterop": true, + "module": "esnext", + "moduleResolution": "bundler", + "resolveJsonModule": true, + "isolatedModules": true, + "jsx": "preserve", + "incremental": true, + "paths": { + "@/*": ["./*"] + } + }, + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], + "exclude": ["node_modules"] +} diff --git a/packages/create-next-app/templates/default-tw-empty/js/.env.example b/packages/create-next-app/templates/default-tw-empty/js/.env.example new file mode 100644 index 0000000000000..7ac0a01551a65 --- /dev/null +++ b/packages/create-next-app/templates/default-tw-empty/js/.env.example @@ -0,0 +1,3 @@ +# Rename this file to `.env.local` to use environment variables locally with `next dev` +# https://nextjs.org/docs/pages/building-your-application/configuring/environment-variables +MY_HOST="example.com" diff --git a/packages/create-next-app/templates/default-tw-empty/js/README-template.md b/packages/create-next-app/templates/default-tw-empty/js/README-template.md new file mode 100644 index 0000000000000..ab9a133f886f3 --- /dev/null +++ b/packages/create-next-app/templates/default-tw-empty/js/README-template.md @@ -0,0 +1,34 @@ +This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). + +## Getting Started + +First, run the development server: + +```bash +npm run dev +# or +yarn dev +# or +pnpm dev +# or +bun dev +``` + +Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. + +You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file. + +## Learn More + +To learn more about Next.js, take a look at the following resources: + +- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. +- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. + +You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! + +## Deploy on Vercel + +The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. + +Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. diff --git a/packages/create-next-app/templates/default-tw-empty/js/eslintrc.json b/packages/create-next-app/templates/default-tw-empty/js/eslintrc.json new file mode 100644 index 0000000000000..bffb357a71225 --- /dev/null +++ b/packages/create-next-app/templates/default-tw-empty/js/eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "next/core-web-vitals" +} diff --git a/packages/create-next-app/templates/default-tw-empty/js/gitignore b/packages/create-next-app/templates/default-tw-empty/js/gitignore new file mode 100644 index 0000000000000..fd3dbb571a12a --- /dev/null +++ b/packages/create-next-app/templates/default-tw-empty/js/gitignore @@ -0,0 +1,36 @@ +# 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 diff --git a/packages/create-next-app/templates/default-tw-empty/js/jsconfig.json b/packages/create-next-app/templates/default-tw-empty/js/jsconfig.json new file mode 100644 index 0000000000000..2a2e4b3bf8ba1 --- /dev/null +++ b/packages/create-next-app/templates/default-tw-empty/js/jsconfig.json @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "paths": { + "@/*": ["./*"] + } + } +} diff --git a/packages/create-next-app/templates/default-tw-empty/js/next.config.mjs b/packages/create-next-app/templates/default-tw-empty/js/next.config.mjs new file mode 100644 index 0000000000000..d5456a15d4ad2 --- /dev/null +++ b/packages/create-next-app/templates/default-tw-empty/js/next.config.mjs @@ -0,0 +1,6 @@ +/** @type {import('next').NextConfig} */ +const nextConfig = { + reactStrictMode: true, +}; + +export default nextConfig; diff --git a/packages/create-next-app/templates/default-tw-empty/js/pages/_app.js b/packages/create-next-app/templates/default-tw-empty/js/pages/_app.js new file mode 100644 index 0000000000000..b97e52fc9afab --- /dev/null +++ b/packages/create-next-app/templates/default-tw-empty/js/pages/_app.js @@ -0,0 +1,5 @@ +import "@/styles/globals.css"; + +export default function App({ Component, pageProps }) { + return ; +} diff --git a/packages/create-next-app/templates/default-tw-empty/js/pages/_document.js b/packages/create-next-app/templates/default-tw-empty/js/pages/_document.js new file mode 100644 index 0000000000000..b2fff8b4262dd --- /dev/null +++ b/packages/create-next-app/templates/default-tw-empty/js/pages/_document.js @@ -0,0 +1,13 @@ +import { Html, Head, Main, NextScript } from "next/document"; + +export default function Document() { + return ( + + + +
+ + + + ); +} diff --git a/packages/create-next-app/templates/default-tw-empty/js/pages/index.js b/packages/create-next-app/templates/default-tw-empty/js/pages/index.js new file mode 100644 index 0000000000000..b95c3ed488adc --- /dev/null +++ b/packages/create-next-app/templates/default-tw-empty/js/pages/index.js @@ -0,0 +1,7 @@ +export default function Home() { + return ( +
+
Hello world!
+
+ ); +} diff --git a/packages/create-next-app/templates/default-tw-empty/js/postcss.config.mjs b/packages/create-next-app/templates/default-tw-empty/js/postcss.config.mjs new file mode 100644 index 0000000000000..1a69fd2a450af --- /dev/null +++ b/packages/create-next-app/templates/default-tw-empty/js/postcss.config.mjs @@ -0,0 +1,8 @@ +/** @type {import('postcss-load-config').Config} */ +const config = { + plugins: { + tailwindcss: {}, + }, +}; + +export default config; diff --git a/packages/create-next-app/templates/default-tw-empty/js/public/favicon.ico b/packages/create-next-app/templates/default-tw-empty/js/public/favicon.ico new file mode 100644 index 0000000000000..718d6fea4835e Binary files /dev/null and b/packages/create-next-app/templates/default-tw-empty/js/public/favicon.ico differ diff --git a/packages/create-next-app/templates/default-tw-empty/js/styles/globals.css b/packages/create-next-app/templates/default-tw-empty/js/styles/globals.css new file mode 100644 index 0000000000000..b5c61c956711f --- /dev/null +++ b/packages/create-next-app/templates/default-tw-empty/js/styles/globals.css @@ -0,0 +1,3 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; diff --git a/packages/create-next-app/templates/default-tw-empty/js/tailwind.config.js b/packages/create-next-app/templates/default-tw-empty/js/tailwind.config.js new file mode 100644 index 0000000000000..a6ffbf389a530 --- /dev/null +++ b/packages/create-next-app/templates/default-tw-empty/js/tailwind.config.js @@ -0,0 +1,6 @@ +/** @type {import('tailwindcss').Config} */ +module.exports = { + content: ["./pages/**/*.{js,jsx,mdx}"], + theme: {}, + plugins: [], +}; diff --git a/packages/create-next-app/templates/default-tw-empty/ts/.env.example b/packages/create-next-app/templates/default-tw-empty/ts/.env.example new file mode 100644 index 0000000000000..7ac0a01551a65 --- /dev/null +++ b/packages/create-next-app/templates/default-tw-empty/ts/.env.example @@ -0,0 +1,3 @@ +# Rename this file to `.env.local` to use environment variables locally with `next dev` +# https://nextjs.org/docs/pages/building-your-application/configuring/environment-variables +MY_HOST="example.com" diff --git a/packages/create-next-app/templates/default-tw-empty/ts/README-template.md b/packages/create-next-app/templates/default-tw-empty/ts/README-template.md new file mode 100644 index 0000000000000..c9e96a4215aca --- /dev/null +++ b/packages/create-next-app/templates/default-tw-empty/ts/README-template.md @@ -0,0 +1,34 @@ +This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). + +## Getting Started + +First, run the development server: + +```bash +npm run dev +# or +yarn dev +# or +pnpm dev +# or +bun dev +``` + +Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. + +You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file. + +## Learn More + +To learn more about Next.js, take a look at the following resources: + +- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. +- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. + +You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! + +## Deploy on Vercel + +The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. + +Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. diff --git a/packages/create-next-app/templates/default-tw-empty/ts/eslintrc.json b/packages/create-next-app/templates/default-tw-empty/ts/eslintrc.json new file mode 100644 index 0000000000000..bffb357a71225 --- /dev/null +++ b/packages/create-next-app/templates/default-tw-empty/ts/eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "next/core-web-vitals" +} diff --git a/packages/create-next-app/templates/default-tw-empty/ts/gitignore b/packages/create-next-app/templates/default-tw-empty/ts/gitignore new file mode 100644 index 0000000000000..fd3dbb571a12a --- /dev/null +++ b/packages/create-next-app/templates/default-tw-empty/ts/gitignore @@ -0,0 +1,36 @@ +# 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 diff --git a/packages/create-next-app/templates/default-tw-empty/ts/next-env.d.ts b/packages/create-next-app/templates/default-tw-empty/ts/next-env.d.ts new file mode 100644 index 0000000000000..4f11a03dc6cc3 --- /dev/null +++ b/packages/create-next-app/templates/default-tw-empty/ts/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/packages/create-next-app/templates/default-tw-empty/ts/next.config.mjs b/packages/create-next-app/templates/default-tw-empty/ts/next.config.mjs new file mode 100644 index 0000000000000..d5456a15d4ad2 --- /dev/null +++ b/packages/create-next-app/templates/default-tw-empty/ts/next.config.mjs @@ -0,0 +1,6 @@ +/** @type {import('next').NextConfig} */ +const nextConfig = { + reactStrictMode: true, +}; + +export default nextConfig; diff --git a/packages/create-next-app/templates/default-tw-empty/ts/pages/_app.tsx b/packages/create-next-app/templates/default-tw-empty/ts/pages/_app.tsx new file mode 100644 index 0000000000000..160eac17fa487 --- /dev/null +++ b/packages/create-next-app/templates/default-tw-empty/ts/pages/_app.tsx @@ -0,0 +1,6 @@ +import type { AppProps } from "next/app"; +import "@/styles/globals.css"; + +export default function App({ Component, pageProps }: AppProps) { + return ; +} diff --git a/packages/create-next-app/templates/default-tw-empty/ts/pages/_document.tsx b/packages/create-next-app/templates/default-tw-empty/ts/pages/_document.tsx new file mode 100644 index 0000000000000..b2fff8b4262dd --- /dev/null +++ b/packages/create-next-app/templates/default-tw-empty/ts/pages/_document.tsx @@ -0,0 +1,13 @@ +import { Html, Head, Main, NextScript } from "next/document"; + +export default function Document() { + return ( + + + +
+ + + + ); +} diff --git a/packages/create-next-app/templates/default-tw-empty/ts/pages/index.tsx b/packages/create-next-app/templates/default-tw-empty/ts/pages/index.tsx new file mode 100644 index 0000000000000..b95c3ed488adc --- /dev/null +++ b/packages/create-next-app/templates/default-tw-empty/ts/pages/index.tsx @@ -0,0 +1,7 @@ +export default function Home() { + return ( +
+
Hello world!
+
+ ); +} diff --git a/packages/create-next-app/templates/default-tw-empty/ts/postcss.config.mjs b/packages/create-next-app/templates/default-tw-empty/ts/postcss.config.mjs new file mode 100644 index 0000000000000..1a69fd2a450af --- /dev/null +++ b/packages/create-next-app/templates/default-tw-empty/ts/postcss.config.mjs @@ -0,0 +1,8 @@ +/** @type {import('postcss-load-config').Config} */ +const config = { + plugins: { + tailwindcss: {}, + }, +}; + +export default config; diff --git a/packages/create-next-app/templates/default-tw-empty/ts/public/favicon.ico b/packages/create-next-app/templates/default-tw-empty/ts/public/favicon.ico new file mode 100644 index 0000000000000..718d6fea4835e Binary files /dev/null and b/packages/create-next-app/templates/default-tw-empty/ts/public/favicon.ico differ diff --git a/packages/create-next-app/templates/default-tw-empty/ts/styles/globals.css b/packages/create-next-app/templates/default-tw-empty/ts/styles/globals.css new file mode 100644 index 0000000000000..b5c61c956711f --- /dev/null +++ b/packages/create-next-app/templates/default-tw-empty/ts/styles/globals.css @@ -0,0 +1,3 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; diff --git a/packages/create-next-app/templates/default-tw-empty/ts/tailwind.config.ts b/packages/create-next-app/templates/default-tw-empty/ts/tailwind.config.ts new file mode 100644 index 0000000000000..e2043f774c55c --- /dev/null +++ b/packages/create-next-app/templates/default-tw-empty/ts/tailwind.config.ts @@ -0,0 +1,8 @@ +import type { Config } from "tailwindcss"; + +const config: Config = { + content: ["./pages/**/*.{ts,tsx,mdx}"], + theme: {}, + plugins: [], +}; +export default config; diff --git a/packages/create-next-app/templates/default-tw-empty/ts/tsconfig.json b/packages/create-next-app/templates/default-tw-empty/ts/tsconfig.json new file mode 100644 index 0000000000000..957e71fe5b523 --- /dev/null +++ b/packages/create-next-app/templates/default-tw-empty/ts/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "target": "ES2017", + "lib": ["dom", "dom.iterable", "esnext"], + "allowJs": true, + "skipLibCheck": true, + "strict": true, + "noEmit": true, + "esModuleInterop": true, + "module": "esnext", + "moduleResolution": "bundler", + "resolveJsonModule": true, + "isolatedModules": true, + "jsx": "preserve", + "incremental": true, + "paths": { + "@/*": ["./*"] + } + }, + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], + "exclude": ["node_modules"] +} diff --git a/packages/create-next-app/templates/types.ts b/packages/create-next-app/templates/types.ts index 7626fe40912e5..7d215900da89d 100644 --- a/packages/create-next-app/templates/types.ts +++ b/packages/create-next-app/templates/types.ts @@ -1,6 +1,14 @@ import { PackageManager } from "../helpers/get-pkg-manager"; -export type TemplateType = "default" | "app" | "default-tw" | "app-tw"; +export type TemplateType = + | "app" + | "app-empty" + | "app-tw" + | "app-tw-empty" + | "default" + | "default-empty" + | "default-tw" + | "default-tw-empty"; export type TemplateMode = "js" | "ts"; export interface GetTemplateFileArgs { @@ -14,7 +22,6 @@ export interface InstallTemplateArgs { root: string; packageManager: PackageManager; isOnline: boolean; - template: TemplateType; mode: TemplateMode; eslint: boolean; diff --git a/test/integration/create-next-app/lib/specification.ts b/test/integration/create-next-app/lib/specification.ts index ddccdcc8e3460..8e4cfd87cbbff 100644 --- a/test/integration/create-next-app/lib/specification.ts +++ b/test/integration/create-next-app/lib/specification.ts @@ -61,6 +61,28 @@ export const projectSpecification: ProjectSpecification = { ], }, }, + 'default-empty': { + js: { + files: ['pages/index.js', 'pages/_app.js', 'jsconfig.json'], + deps: [], + devDeps: [], + }, + ts: { + files: [ + 'pages/index.tsx', + 'pages/_app.tsx', + 'tsconfig.json', + 'next-env.d.ts', + ], + deps: [], + devDeps: [ + '@types/node', + '@types/react', + '@types/react-dom', + 'typescript', + ], + }, + }, 'default-tw': { js: { files: [ @@ -95,6 +117,38 @@ export const projectSpecification: ProjectSpecification = { ], }, }, + 'default-tw-empty': { + js: { + files: [ + 'jsconfig.json', + 'pages/_app.js', + 'pages/index.js', + 'postcss.config.mjs', + 'tailwind.config.js', + ], + deps: [], + devDeps: ['postcss', 'tailwindcss'], + }, + ts: { + files: [ + 'next-env.d.ts', + 'pages/_app.tsx', + 'pages/index.tsx', + 'postcss.config.mjs', + 'tailwind.config.ts', + 'tsconfig.json', + ], + deps: [], + devDeps: [ + '@types/node', + '@types/react-dom', + '@types/react', + 'postcss', + 'tailwindcss', + 'typescript', + ], + }, + }, app: { js: { deps: [], @@ -117,6 +171,28 @@ export const projectSpecification: ProjectSpecification = { ], }, }, + 'app-empty': { + js: { + deps: [], + devDeps: [], + files: ['app/page.js', 'app/layout.js', 'jsconfig.json'], + }, + ts: { + deps: [], + devDeps: [ + '@types/node', + '@types/react', + '@types/react-dom', + 'typescript', + ], + files: [ + 'app/page.tsx', + 'app/layout.tsx', + 'tsconfig.json', + 'next-env.d.ts', + ], + }, + }, 'app-tw': { js: { deps: [], @@ -149,6 +225,38 @@ export const projectSpecification: ProjectSpecification = { ], }, }, + 'app-tw-empty': { + js: { + deps: [], + devDeps: ['postcss', 'tailwindcss'], + files: [ + 'app/layout.js', + 'app/page.js', + 'jsconfig.json', + 'postcss.config.mjs', + 'tailwind.config.js', + ], + }, + ts: { + deps: [], + devDeps: [ + '@types/node', + '@types/react-dom', + '@types/react', + 'postcss', + 'tailwindcss', + 'typescript', + ], + files: [ + 'app/layout.tsx', + 'app/page.tsx', + 'next-env.d.ts', + 'postcss.config.mjs', + 'tailwind.config.ts', + 'tsconfig.json', + ], + }, + }, } export type GetProjectSettingsArgs = { diff --git a/test/integration/create-next-app/lib/utils.ts b/test/integration/create-next-app/lib/utils.ts index 1a7e0243a1f69..949be2ce08e90 100644 --- a/test/integration/create-next-app/lib/utils.ts +++ b/test/integration/create-next-app/lib/utils.ts @@ -157,7 +157,11 @@ export const shouldBeTemplateProject = ({ }) // Tailwind templates share the same files (tailwind.config.js, postcss.config.mjs) - if (template !== 'app-tw' && template !== 'default-tw') { + if ( + !['app-tw', 'app-tw-empty', 'default-tw', 'default-tw-empty'].includes( + template + ) + ) { projectFilesShouldNotExist({ cwd, projectName, diff --git a/test/integration/create-next-app/templates/app.test.ts b/test/integration/create-next-app/templates/app.test.ts index 6721bb9f74a03..8ec89fac6d0a0 100644 --- a/test/integration/create-next-app/templates/app.test.ts +++ b/test/integration/create-next-app/templates/app.test.ts @@ -72,7 +72,7 @@ describe('create-next-app --app (App Router)', () => { expect(exitCode).toBe(0) shouldBeTemplateProject({ cwd, projectName, template: 'app', mode: 'ts' }) await tryNextDev({ cwd, projectName }) - await projectShouldHaveNoGitChanges({ cwd, projectName }) + projectShouldHaveNoGitChanges({ cwd, projectName }) }) }) @@ -146,4 +146,80 @@ describe('create-next-app --app (App Router)', () => { }) }) }) + + it('should create an empty project with --empty flag', async () => { + await useTempDir(async (cwd) => { + const projectName = 'app-empty' + const childProcess = createNextApp( + [ + projectName, + '--ts', + '--app', + '--eslint', + '--src-dir', + '--empty', + '--no-tailwind', + '--no-import-alias', + ], + { + cwd, + }, + testVersion + ) + + const exitCode = await spawnExitPromise(childProcess) + const isEmpty = true + expect(exitCode).toBe(0) + shouldBeTemplateProject({ + cwd, + projectName, + template: 'app-empty', + mode: 'ts', + srcDir: true, + }) + await tryNextDev({ + cwd, + projectName, + isEmpty, + }) + }) + }) + + it('should create an empty TailwindCSS project with --empty flag', async () => { + await useTempDir(async (cwd) => { + const projectName = 'app-tw-empty' + const childProcess = createNextApp( + [ + projectName, + '--ts', + '--app', + '--eslint', + '--src-dir', + '--tailwind', + '--empty', + '--no-import-alias', + ], + { + cwd, + }, + testVersion + ) + + const exitCode = await spawnExitPromise(childProcess) + const isEmpty = true + expect(exitCode).toBe(0) + shouldBeTemplateProject({ + cwd, + projectName, + template: 'app-tw-empty', + mode: 'ts', + srcDir: true, + }) + await tryNextDev({ + cwd, + projectName, + isEmpty, + }) + }) + }) }) diff --git a/test/integration/create-next-app/templates/pages.test.ts b/test/integration/create-next-app/templates/pages.test.ts index 77e630220c812..71cd71f7caef6 100644 --- a/test/integration/create-next-app/templates/pages.test.ts +++ b/test/integration/create-next-app/templates/pages.test.ts @@ -154,4 +154,82 @@ describe('create-next-app --no-app (Pages Router)', () => { }) }) }) + + it('should create an empty project with --empty flag', async () => { + await useTempDir(async (cwd) => { + const projectName = 'pages-empty' + const childProcess = createNextApp( + [ + projectName, + '--ts', + '--no-app', + '--eslint', + '--src-dir', + '--no-tailwind', + '--empty', + '--no-import-alias', + ], + { + cwd, + }, + testVersion + ) + + const exitCode = await spawnExitPromise(childProcess) + const isEmpty = true + expect(exitCode).toBe(0) + shouldBeTemplateProject({ + cwd, + projectName, + template: 'default-empty', + mode: 'ts', + srcDir: true, + }) + await tryNextDev({ + cwd, + projectName, + isApp: false, + isEmpty, + }) + }) + }) + + it('should create an empty TailwindCSS project with --empty flag', async () => { + await useTempDir(async (cwd) => { + const projectName = 'pages-tw-empty' + const childProcess = createNextApp( + [ + projectName, + '--ts', + '--no-app', + '--eslint', + '--src-dir', + '--tailwind', + '--empty', + '--no-import-alias', + ], + { + cwd, + }, + testVersion + ) + + const exitCode = await spawnExitPromise(childProcess) + const isEmpty = true + expect(exitCode).toBe(0) + shouldBeTemplateProject({ + cwd, + projectName, + template: 'default-tw-empty', + mode: 'ts', + srcDir: true, + }) + await tryNextDev({ + cwd, + projectName, + isApp: false, + isEmpty, + }) + }) + }) }) diff --git a/test/integration/create-next-app/utils.ts b/test/integration/create-next-app/utils.ts index 2389cc8bf060e..648ab7dc1b747 100644 --- a/test/integration/create-next-app/utils.ts +++ b/test/integration/create-next-app/utils.ts @@ -44,10 +44,12 @@ export async function tryNextDev({ cwd, projectName, isApp = true, + isEmpty = false, }: { cwd: string projectName: string isApp?: boolean + isEmpty?: boolean }) { const dir = join(cwd, projectName) const port = await findPort() @@ -57,10 +59,14 @@ export async function tryNextDev({ try { const res = await fetchViaHTTP(port, '/') - expect(await res.text()).toContain('Get started by editing') + if (isEmpty) { + expect(await res.text()).toContain('Hello world!') + } else { + expect(await res.text()).toContain('Get started by editing') + } expect(res.status).toBe(200) - if (!isApp) { + if (!isApp && !isEmpty) { const apiRes = await fetchViaHTTP(port, '/api/hello') expect(await apiRes.json()).toEqual({ name: 'John Doe' }) expect(apiRes.status).toBe(200)