Commit graph

39 commits

Author SHA1 Message Date
Sam Ko
96a96d2ed4
chore(create-next-app): update README links (#65634)
## Why?

- Update
`https://github.com/vercel/next.js/tree/canary/packages/create-next-app`
link to `https://nextjs.org/docs/app/api-reference/create-next-app` or
`https://nextjs.org/docs/pages/api-reference/create-next-app`
2024-05-11 03:38:19 +00:00
Michael H
2c53133ac5
create-next-app - Update links for READMEs (#65548)
Updates the links to go to the respective dir version (app or pages) and
rely less on the current redirects.

Also, if app dir is default, should the folder for pages be called
"pages" instead?
2024-05-10 21:12:56 +00:00
Lee Robinson
09a385669b
fix: ignore all .env files for create-next-app by default (#61920)
We've seen too many instances of folks accidentally committing their
`.env` files that I feel it's time to make this change.

Up until now, Next.js has recommended that you use `.env.local` when
working locally to store your environment variables. Some developers do
intentionally want to commit their `.env` file without secret values to
source control. However, the ecosystem is fragmented on `.local`
support.

There are tools which require secrets values that do _not_ support
`.local` and require using `.env`. This means that it's possible to dump
your secret values into a `.env` file and commit to source control,
thinking that the defaults would have you covered.

This change updates the defaults for `create-next-app` to ignore all
`.env` files by default. If you want to commit then, you opt-in by
modifying your `.gitignore`, versus the opposite.

Related: https://x.com/complexlity/status/1755890800527892716

---------

Co-authored-by: Sam Ko <sam@vercel.com>
2024-05-09 11:21:27 -07:00
Ryota Murakami
dbf22166ca
[create-next-app] remove "text-balance" custom class (#63742)
### What?
Remove "text-balance" custom class from create-next-app tailwindCSS
templates.
### Why?
TailwindCSS has exact same class since v3.4.0.
https://tailwindcss.com/docs/text-wrap

Co-authored-by: Sam Ko <sam@vercel.com>
2024-05-01 23:01:56 +00:00
Hendrik Liebau
3438b39fcf
Improve initial setup with new App Router TypeScript project (#64826) 2024-04-26 18:19:50 +02:00
Karl Horky
51b878f5a3
Switch to postcss.config.mjs, add type (#63380)
<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation

- Run `pnpm prettier-fix` to fix formatting issues before opening the
PR.
- Read the Docs Contribution Guide to ensure your contribution follows
the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

### Adding or Updating Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md


## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

-->

### What?

Now that @phanect added support for ESM PostCSS config files in PR
#63109 (original issue #34448), PostCSS can use ESM config by default.

It needs to use an `.mjs` extension by default because `create-next-app`
scaffolds CommonJS apps by default.

This will also work with ESM projects which have added `"type":
"module"` in their `package.json`

### Why?

1. To convert one more file to ESM
2. To use the modern format
3. To follow other similar migrations that have taken place in the
Next.js codebase (eg. `next.config.mjs`)

### How?

- Change file extensions from `.cjs` to `.mjs` (change similar to PR
#58380)
- Change module format from CommonJS to ESM
- Add type for the config, for users who enable `checkJs: true` in
`tsconfig.json`

Co-authored-by: Sam Ko <sam@vercel.com>
2024-03-18 16:57:55 +00:00
Karl Horky
dd536a51ec
Switch to .cjs PostCSS config (#58380)
<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation

- Run `pnpm prettier-fix` to fix formatting issues before opening the
PR.
- Read the Docs Contribution Guide to ensure your contribution follows
the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

### Adding or Updating Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md


## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->


### What?

Prevent confusing error messages when changing to `"type": "module"` in
`package.json`

```
./node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[2].oneOf[8].use[1]!./node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[2].oneOf[8].use[2]!./src/styles/index.css
Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/my/repo/components/postcss.config.js from /path/to/my/repo/components/node_modules/next/dist/lib/find-config.js not supported.
Instead change the require of postcss.config.js in /path/to/my/repo/components/node_modules/next/dist/lib/find-config.js to a dynamic import() which is available in all CommonJS modules.
```

### Why?

Even though PostCSS itself [supports ESM and TypeScript configuration
files](https://github.com/postcss/postcss-load-config/issues/230),
Next.js itself does not (because of `next/lib/find-config`):

- https://github.com/vercel/next.js/issues/34448

### How?

By switching to `.cjs`, the config will stay recognized as CommonJS even
after switching to `"type": "module"` in `package.json`

cc @balazsorban44

---------

Co-authored-by: Sam Ko <sam@vercel.com>
2024-03-11 14:19:50 -07:00
Balázs Orbán
645be74efd
feat(cna): remove autoprefixer from default templates (#55725)
### What?

Removing `autoprefixer` from the default Tailwind CSS templates. (It can
be installed afterward)

### Why?

After some investigation by @timneutkens, `autoprefixer` seems to
introduce some compilation overhead

### How?

Removing `autoprefixer` from the auto-installed dependency list, it
would be up to the developer to install this plugin if they need it.

[Slack
thread](https://vercel.slack.com/archives/C04DUD7EB1B/p1695288906722539)
2024-02-05 14:22:47 -05:00
Danny
c34b398b14
create-next-app: update tailwind packages and new classes in page.tsx (#61065)
- Updates `tailwindcss` package
- Fixes classes order based on `eslint-plugin-tailwindcss`
- Remove/updates certain classes that now have shorthands, for example
`lg:h-auto lg:w-auto` is now `lg:size-auto`
- Removes unnecessary curly braces

Co-authored-by: Sam Ko <sam@vercel.com>
2024-01-29 02:02:58 +00:00
Steven
4466ba436b
chore(examples): use default prettier for examples/templates (#60530)
## Description
This PR ensures that the default prettier config is used for examples
and templates.

This config is compatible with `prettier@3` as well (upgrading prettier
is bigger change that can be a future PR).

## Changes
- Updated `.prettierrc.json` in root with `"trailingComma": "es5"` (will
be needed upgrading to prettier@3)
- Added `examples/.prettierrc.json` with default config (this will
change every example)
- Added `packages/create-next-app/templates/.prettierrc.json` with
default config (this will change every template)

## Related

- Fixes #54402
- Closes #54409
2024-01-11 16:01:44 -07:00
Takashi Sato
e6e6609674
Remove unused target: es5 from tsconfig.json in create-next-app (#60521)
fixes #58640

When there is no tsconfig.json, `npm run dev` generates `tsconfig.json`,
which has no `target` option.
But create-next-app generates `tsconfig.json` with `"target": "es5"`

Related to: #44567
Related to: #14390
2024-01-11 14:35:17 +00:00
JJ Kasper
b16187213e
Use next.config.mjs for CNA templates (#60494)
As `.mjs` support for `next.config` is stable now we can swap our
default to use it instead.

Closes NEXT-2052
2024-01-10 14:04:57 -08:00
Hamir Mahal
f60c609bdb
style: enforce prop immutability in new next app (#58845)
- fixes #58844

Co-authored-by: Steven <steven@ceriously.com>
2024-01-05 09:55:27 -05:00
Hichem Fantar
5fde19b6d9
fix responsiveness in starter templates (#60140)
Fixes #60139
2024-01-04 14:28:10 +00:00
John Pham
d96a7e56a6
Add text-wrap: balance to CNA template for card descriptions (#59384)
### What?
This prevents the descriptions from having orphans at different viewport
widths.

### Why?

| Default | Pretty | Balance |
|--------|-------| --- |
|
![image](https://github.com/vercel/next.js/assets/16027268/66c8eac4-b995-4c30-9bdc-fd44a4a7fdda)
|
![image](https://github.com/vercel/next.js/assets/16027268/07a2e45a-728b-438f-a4e5-98f7c1c5c33a)
|
![image](https://github.com/vercel/next.js/assets/16027268/153fe94a-2b10-4e39-bb19-b1ca702bcea8)
|
2023-12-11 17:41:01 -08:00
Nhan Doan
adc636dd54
fix: update Next.js version in create-next-app (#57532)
### What?
The default template generated from `create-next-app` still says **Next.js 13**.

<img width="1053" alt="image" src="https://github.com/vercel/next.js/assets/2561973/1413dcda-d73d-43a9-ba47-8322cf193c52">

### Why?
Next.js 14 is released.
2023-10-31 01:36:27 +00:00
leung018
66597be8a7
Add .yarn/install-state.gz to .gitignore (#56637)
### Reason for making this change
https://yarnpkg.com/getting-started/qa#:~:text=yarn%2Finstall%2Dstate.,your%20workspaces%20all%20over%20again.
In the official documentation of `yarn`, it is stated that `.yarn/install-state.gz` is an optimization file that developer shouldn't ever have to commit. However, currently, when running `create-next-app`, `.yarn/install-state.gz` is being commited.

### Remaining work
I apologize for only modifying one template initially to initiate the discussion first.

If this change is agreed upon,  it should be synchronized with other `.gitignore` templates. Would it be possible to follow a similar approach as in https://github.com/vercel/next.js/pull/47241? I would appreciate any assistance in syncing this change.
2023-10-18 16:34:48 +00:00
Hamir Mahal
9288ef4921
feat: add self-documenting .env.example file (#56469)
- fixes #56468

Co-authored-by: Steven <229881+styfle@users.noreply.github.com>
2023-10-12 21:55:14 +00:00
Hamir Mahal
187df91438
fix: .../templates/*/app/layout.* import order (#56380)
- fixes #56379
2023-10-04 20:41:47 +00:00
Jake Boone
3cd4b975c3
create-next-app templates: Change bun run dev commands to bun dev (#55603)
[As of Bun v1.0.0](https://bun.sh/blog/bun-v1.0#changelog-since-v0-8), `bun dev` runs the "dev" script from package.json. Therefore, as with Yarn and pnpm, the "run" command is not necessary.

This PR changes the `create-next-app` README templates to show `bun dev` instead of `bun run dev`.
2023-09-19 19:04:33 +00:00
YOSHIKI
7db5c64e94
docs: add bun run dev command to template readme for create-next-app (#55504)
## For Contributors

### Improving Documentation

- [x] Run `pnpm prettier-fix` to fix formatting issues before opening the PR.
- [x] Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide

### What?
add bun run dev command to template readme for create-next-app
2023-09-18 18:18:58 +00:00
stefanprobst
42227559c6
fix: don't add forceConsistentCasingInFileNames to tsconfig when ts version >= 5.0 (#51564)
Currently, Next.js enforces that `forceConsistentCasingInFileNames: true` is added to a user's `tsconfig.json`.

This PR removes that behavior for CNA templates, and when the typescript version is >= 5.0.0, because since ts 5.0 `forceConsistentCasingInFileNames` is `true` by default. See https://devblogs.microsoft.com/typescript/announcing-typescript-5-0/

related: https://github.com/vercel/next.js/issues/45617
2023-08-15 19:12:40 +00:00
Julius Marminge
079813c11c
chore(create-next-app): use tailwind.config.ts for typescript templates (#47795)
Minor change to use `tailwind.config.ts` for TypeScript projects.
2023-08-01 20:05:57 +00:00
Grace Yun
6c3560dbbd
[create-next-app] fix template css for top / bottom alignment (#53227)
Fixes a small CSS regression with the `create-next-app` template(s). Especially evident with templates using Tailwind CSS.

Before:
<img width="1047" alt="image" src="https://github.com/vercel/next.js/assets/74513600/9d3e8ef4-52b9-4590-be26-ee91f4bd65dd">

After:
![image](https://github.com/vercel/next.js/assets/74513600/952ca166-59df-40d1-bb6d-cb2fbc592c3b)
2023-07-26 20:41:08 +00:00
Facundo Giuliani
a26bac9604
Update default moduleResolution in tsconfig.json from node to bundler (#51957)
This updates our `moduleResolution` to `bundler` as this matches our heuristics much more closely so is more accurate. This shouldn't be a breaking change is it should be compatible with our previous default. 

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2023-07-18 15:11:09 +00:00
Ryo Matsukawa
cf08f60077
fix(create-next-app): click event blockage under 1024px by adjusting z-index (#52074)
### What?

Fixed a bug that the title of the topmost Docs was unclickable when less than 1024px.

### Why?

This appears to be due to the fact that these clickable elements are overlapped by the logo image wrapper in Next.js, preventing the propagation of click events for these elements.

### How?

To mitigate this problem, this PR assigns a z-index of -1 to the Next.js logo image wrapper. This change ensures the wrapper is placed beneath the clickable elements, thereby preventing it from blocking click events on smaller screens.

#### Before

https://github.com/vercel/next.js/assets/76232929/7b84737d-8a43-4c92-870e-86d08e4eaf74

#### After

https://github.com/vercel/next.js/assets/76232929/648b2e9b-33b5-4905-b10f-03904c1f7529
2023-07-10 11:21:36 +00:00
Yiğithan
ce483fd7c3
fix(create-next-app): add missing metadata type (#52299)
This pull request adds the missing `Metadata` type declaration to the
root layout of the `create-next-app` templates. The metadata object was
missing its type definition, which has been resolved by adding the
appropriate type import and annotation.

---------
2023-07-06 09:58:43 -07:00
이현재
889e2203a5
Update page.tsx tw className (#49040)
I changed the tailwindcss code, which is written differently than the
other elements in `app/page.tsx`

<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation or adding/fixing Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md



## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->

Co-authored-by: Shu Ding <g@shud.in>
2023-06-23 17:11:59 +02:00
Lee Robinson
fa1370fd9b
Update links from beta to stable docs. (#49349)
Now that the beta docs have been merged into stable with the release of
13.4, this updates all links as some paths have changed due to
redirects.

---------

Co-authored-by: Steven <steven@ceriously.com>
Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-05-11 11:52:29 -07:00
Tim Neutkens
25a9547cad
Remove experimental config from create-next-app (#49241)
## What?

Removes `experimental.appDir` this was leftover from when I flipped the
switch.

Kept the config file as in the future we might add future flags and
such. It also helps that it has the types comment included so you always
get types.

<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation or adding/fixing Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md



## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-05-05 00:22:28 -07:00
Balázs Orbán
b7d657f525
chore(cli): remove Route Handlers from App Router templates (#49076)
[Slack
thread](https://vercel.slack.com/archives/C04K237UHCP/p1682972426769409)

Closes NEXT-1077

---------

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-05-02 15:49:09 +02:00
Patrick Arminio
a40fa12c50
Remove unused font from tailwind app/page.tsx (#49035)
The font is imported and used in `app/layout.tsx` :)
2023-05-01 20:31:15 -07:00
JJ Kasper
9c5d0448ee
Update font handling in CNA templates (#48364)
We don't need to apply the font className to individual usage and can
just apply it to the the top element for easier usage.

x-ref: [slack
thread](https://vercel.slack.com/archives/C03KAR5DCKC/p1681343520829629)
2023-04-13 17:25:24 -07:00
Delba de Oliveira
ab213498d8
[create-next-app]: add mdx files to tailwind content config (#48188)
This PR updates create-next-app's tailwind config to consider .mdx files
when it generates styles.

If you're using MDX, most of a project's styles are generated by the
other file flags, which can make it tricky to debug/notice the rare
subset from .mdx only.

x-ref: https://vercel.slack.com/archives/C0290CZ3U6Q/p1680976472444189

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-04-13 16:39:36 -07:00
Karl Horky
3ad55721d1
Remove incorrect entries for pnpm debug log (#47241)
**Reasons for making this change:**

- it is contained within `node_modules/`, which is already ignored
- the previous versions, which were not in `node_modules/`, did not have
a period at the beginning of the filename

Links to documentation supporting these rule changes:

**Changelog with proof here:**


ba4b2db1f2/pnpm/CHANGELOG.md (L3330)

History:

- my PR to remove this from `github/gitignore` here:
https://github.com/github/gitignore/pull/4250
- First introduced in `github/gitignore` in
https://github.com/github/gitignore/pull/3732 by `@sakurayang` (merged
by `@martinwoodward`)

<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation or adding/fixing Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md



## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-03-26 22:26:05 -07:00
vinay
ac8741236a
fix(cli): change file name from route.ts to route.js (#47352)
<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation or adding/fixing Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md



## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->
Wrong file for api endpoint `/hello` in create-next-app template for app
directory with tailwindcss.
The file was `route.ts` in javascript version of the template, changed
it to `route.js`.
2023-03-21 16:57:26 -07:00
shivanshubisht
cf66c2dc74
Replace bg-opacity with bg-color/opacity in tailwindcss templates (#47253)
In Tailwind v3, the bg-opacity has been deprecated in favour of
bg-color/opacity.
https://tailwindcss.com/docs/background-color#changing-the-opacity

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-03-20 16:33:12 -07:00
Balázs Orbán
2a8961b36b
fix(cli): unify styles/content of templates (#47294)
### What?

- fixes some typos
  - [x] getting started by editing "filename"
  - [x] match app/pages content
  - [x] fix utm params 
- [x] Reverted different text coloring in the CLI as they were hard to
read on a dark background
- [x] removes 13 ([Slack
thread](https://vercel.slack.com/archives/C03KAR5DCKC/p1679151687968809?thread_ts=1679123593.519319&cid=C03KAR5DCKC))


### Why?

Unifying the styles across all templates

### How?

Used
https://github.com/vercel/next.js/tree/canary/packages/create-next-app/templates/default/js
as the base and made sure that all other templates match its content and
styling.

Related: #46927. This PR was extracted from #47238 to make reviewing
easier.

fix NEXT-851 ([link](https://linear.app/vercel/issue/NEXT-851))

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-03-20 15:33:44 -07:00
Balázs Orbán
8c98a207f2
feat(cli): introduce --tailwind flag (#46927)
### What?

This PR introduces a new `--tailwind` flag to the `create-next-app` CLI,
to make it easier to bootstrap a Next.js app with Tailwind CSS
pre-configured. This is going to be the **default**. To opt-out of
Tailwind CSS, you can use the `--no-tailwind` flag.

### Why?

Tailwind CSS is one of the most popular styling solutions right now, and
we would like to make it easier to get started.

Currently, the closest you can come to this is by running `pnpm create
next-app -e with-tailwindcss` which will clone the
https://github.com/vercel/next.js/tree/canary/examples/with-tailwindcss
example. But that example is not configured for the App Router. This PR
will let you add Tailwind CSS to both `app/`, `pages/`, and start out
with TypeScript or JavaScript via the CLI prompts.

(Some community feedback
https://twitter.com/dev_jonaskaas/status/1632367991827443713,
https://twitter.com/samselikoff/status/1634662473331617794)

### How?

We are adding 4 new templates to the CLI bundle.

> Note: The styling is not pixel-perfect compared to the current
templates (using CSS modules) to require fewer overrides, but I tried to
match it as close as possible. Here are a few screenshots:

<details>
<summary><b>Current, light</b></summary>
<img
src="https://user-images.githubusercontent.com/18369201/224733372-9dba86fe-9191-471d-ad9f-ab904c47f544.png"/>
</details>

<details>
<summary><b>Tailwind (new), light</b></summary>
<img
src="https://user-images.githubusercontent.com/18369201/224733610-038d9d0f-634d-4b69-b5c2-a5056b56760c.png"/>
</details>

<details>
<summary><b>Current, dark, responsive</b></summary>
<img
src="https://user-images.githubusercontent.com/18369201/224733790-9b4d730c-0336-4dbe-bc10-1cae1d7fd145.png"/>
</details>

<details>
<summary><b>Tailwind (new), dark, responsive</b></summary>
<img
src="https://user-images.githubusercontent.com/18369201/224734375-28384bbc-2c3a-4125-8f29-c102f3b7aa1d.png"/>
</details>

#### For reviewers

This introduces 4 new templates, with a very similar code base to the
original ones. To keep the PR focused, I decided to copy over duplicate
code, but we could potentially create a shared folder for files that are
the same across templates to somewhat reduce the CLI size. Not sure if
it's worth it, let me know. Probably fine for now, but something to
consider if we are adding more permutations in the future.

---

~Work remaining:~

- [x] app+ts
	- [x] layout
	- [x] dark mode
	- [x] media queries
	- [x] animations
- [x] app+js
- [x] pages+ts
- [x] pages+js
- [x] prompt/config
- [x] deprecate Tailwind CSS example in favor of CLI
- [x] update docs
- [x] add test
- [x] add [Prettier
plugin](https://github.com/tailwindlabs/prettier-plugin-tailwindcss)
 
Closes NEXT-772
Related #45814, #44286
2023-03-16 16:06:27 +01:00