9 Commits

Author SHA1 Message Date
Jiwon Choi a432e06ded [Breaking] Remove deprecated built-in AMP (#84312)
This PR removes the deprecated built-in AMP support. Will follow up with
cleaning up the examples, docs, and codemods.
2025-09-30 18:54:26 +02:00
Sam Ko 49ba0acc18 chore(examples): remove examples that can be v0'd (#77349)
## Why?

Taking small steps towards reducing the large burden we are taking on with [examples](https://github.com/vercel/next.js/tree/canary/examples).
2025-04-02 14:27:08 -07:00
Jam Balaya 832c77d01f examples: remove app-dir and with prefix in the mdx directory name (#73458)
## What?

1. Rename the following examples.

| Before | After |
|--------|--------|
|
[app-dir-mdx](https://github.com/vercel/next.js/tree/canary/examples/app-dir-mdx)
| mdx |
|
[with-mdx](https://github.com/vercel/next.js/tree/canary/examples/with-mdx)
| mdx-pages |
|
[with-mdx-remote](https://github.com/vercel/next.js/tree/canary/examples/with-mdx-remote)
| mdx-remote |

2. Change the example names at README.md in the repositories.
3. Update the mdx pathname in the test files.

## Why?

### Why remove `app-dir-` in the directory name?

The default has already been App Router anyways and a lot of examples
have migrated over.
x-ref:
https://github.com/vercel/next.js/pull/72642#issuecomment-2474415343

### Why remove `with-` in the directory name?

According to [examples
guidelines](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md),

> Example directories should not be prefixed with `with-`

## How did you verify your code works?

I have tested the new
[with-mdx.test.ts](https://github.com/vercel/next.js/blob/canary/test/e2e/yarn-pnp/test/with-mdx.test.ts)
and
[example.test.ts](https://github.com/vercel/next.js/blob/canary/test/examples/examples.test.ts).

### Adding or Updating Examples

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

CC: @samcx

Co-authored-by: Sam Ko <sam@vercel.com>
2025-01-07 18:53:42 -08:00
Jam Balaya 4ed2815429 examples: remove app-dir in i18n-routing directory name (#73453)
### What?

1. Rename
[`app-dir-i18n-routing`](https://github.com/vercel/next.js/tree/canary/examples/app-dir-i18n-routing)
example `i18n-routing`.
2. Rename
[`i18n-routing`](https://github.com/vercel/next.js/tree/canary/examples/i18n-routing)
example `i18n-routing-pages`.
3. Update the docs mentions i18n-routing examples.
4. Update the test includes i18n-routing examples.

### Why?

The default has already been App Router anyways and a lot of examples
have migrated over.
x-ref:
https://github.com/vercel/next.js/pull/72642#issuecomment-2474415343

### How?

Change them as in
[reproduction-template](https://github.com/vercel/next.js/tree/canary/examples/reproduction-template)
and
[reproduction-template-pages](https://github.com/vercel/next.js/tree/canary/examples/reproduction-template-pages)
examples.

### 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

### Adding or Updating Examples

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

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2024-12-03 16:56:14 +00:00
Jam Balaya ccb8848bae test: remove deleted examples (#72374)
# Summary
Update
[`example.test.ts`](https://github.com/vercel/next.js/blob/canary/test/examples/examples.test.ts)
and
[`turbopack-dev-examples-manifest.json`](https://github.com/vercel/next.js/blob/canary/test/turbopack-dev-examples-manifest.json)
by removing deleted examples.

## Descriptions
[examples: cleanup #57845](https://github.com/vercel/next.js/pull/57845)
deleted ...

- amp-first
- amp-story
- data-fetch
- fast-refresh-demo
- hello-world-esm
- progressive-render
- using-router
- with-app-layout
- with-env-from-next-config-js
- with-loading

[updated the example of modularize-imports to utilize the App Router
#69771](https://github.com/vercel/next.js/pull/69771) deleted ...

- modularize-imports

[docs: Add docs on CSP and nonce generation
#54601](https://github.com/vercel/next.js/pull/54601/files) deleted ...

- styled-jsx-with-csp

[Updated the example of with-draft-js to utilize the App Router.
#70045](https://github.com/vercel/next.js/pull/70045) deleted ...

- with-draft-js

[Remove deprecated library example
#62813](https://github.com/vercel/next.js/pull/62813) deleted ...

- with-react-with-styles

[Remove with-reasonml-todo example
#62812](https://github.com/vercel/next.js/pull/62812/files) deleted ...

- with-reasonml-todo

[Remove with-semantic-ui example
#62811](https://github.com/vercel/next.js/pull/62811/files) deleted ...

- with-semantic-ui

[Updated the example of with-vercel-fetch to utilize the App Router.
#70069](https://github.com/vercel/next.js/pull/70069) deleted ...

- with-vercel-fetch

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2024-11-07 22:21:12 +00:00
Jam Balaya 1c22d142e0 chore: delete api-routes example completely (#72437)
## Description
At #68771,
[`api-routes`](https://github.com/vercel/next.js/tree/canary/examples/api-routes)
example was renamed
[`route-handlers`](https://github.com/vercel/next.js/tree/canary/examples/route-handlers).
However,
[`.gitignore`](https://github.com/vercel/next.js/blob/canary/examples/api-routes/.gitignore)
wasn't deleted and a new
[`.gitignore`](https://github.com/vercel/next.js/blob/canary/examples/route-handlers/.gitignore)
file isn't updated.

In addition, some `api-routes` names exist in the other place.
That's why I update those.

### 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

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2024-11-07 20:00:45 +00:00
Wyatt Johnson c6320ed87a Replace createNextDescribe with nextTestSetup (#64817)
<!-- 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 #

-->

I took some time and [wrote a
codemod](https://gist.github.com/wyattjoh/0d4464427506cb02062a4729ca906b62)
that replaces the old usage of the `createNextDescribe` with the new
`nextTestSetup`. You'll likely have to turn on hiding of whitespace in
order to review, but this should primarily introduce no changes to the
test structure other than using the new mechanism now.

Closes NEXT-3178
2024-04-25 12:06:12 -06: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
Jan Kaifer f3ef4e99b0 Cover 1st-party examples with tests (#45270)Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
We want to make sure that our examples are not breaking.
We don't want to be slowed down by broken 3rd party packages, but we
need to ensure that examples covering next.js features are always green.

Added as a standalone workflow that doesn't parallelize. It will just
run on a cron schedule, so we can check for current status. We can add
Slack ping later if we need to.

The workflow tests just that our examples can build, so mostly TS
issues. We could definitely follow up with actual tests, but that is not
as low-hanging.

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2023-02-27 11:54:24 +01:00