Commit graph

3140 commits

Author SHA1 Message Date
Rishabh Poddar
4fbf3d374c
Update to with-supertokens example (#66320)
Updates to using latest supertokens' SDK versions.

Co-authored-by: Sam Ko <sam@vercel.com>
2024-05-29 18:16:03 +00:00
Sam Ko
06ede796f2
chore(examples): update reproduction template (#66301)
## Why?

We get this error when we use `npx` to download the
reproduction-template.

![CleanShot 2024-05-28 at 17 25
40@2x](https://github.com/vercel/next.js/assets/28912696/a2f3c3ce-1a2c-4629-9914-9e88bb9c9632)

Updating the template should fix this error.
2024-05-28 18:11:47 -07:00
Shubh Porwal
0c7c49588b
Update with-react-hook-form example (#66253)
Updates `with-react-hook-form` example by bumping react-hook-form and
other dependencies to their latest versions, along with a minor cleanup
of the UI.

---------

Co-authored-by: Sam Ko <sam@vercel.com>
2024-05-28 18:52:34 +00:00
Lenz Weber-Tronic
73a05e1e3c
adopt modern & supported Apollo Client patterns in the with-apollo example (#65316)
#64186 removed the pages router implementation from the `with-apollo`
example and replaced it with an app router implementation.

Unfortunately, it did so in an unsupported way.  
At this point, we can not support any streaming SSR scenario without
additional helper packages - in the case of the app router, it is vital
to use the `@apollo/experimental-nextjs-app-support` package.

This PR switches the example to our officially supported patterns.


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

-->
2024-05-26 17:08:52 -07:00
qqww08
16c4e47c14
Update Google Analytics example for App Router (#66021)
<!-- 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 #

-->
Hello 

This PR updates the `with-google-analytics` example to use:
- App Router
- TypeScript
- @next/third-parties

Co-authored-by: Sam Ko <sam@vercel.com>
2024-05-21 20:47:09 +00:00
Joseph
0cd20e0ea5
chore: Bump react-modal to 3.16.2 in with-router-as-modal example (#65841)
### What?

Example update to `with-route-as-modal`, which used `react-modal@13.1.2`

### Why?

The `react-modal` version specified, did not include react 18 as
peer-dependency.

This causes users to have problems when creating the example:
https://github.com/vercel/next.js/discussions/65835

### How?

Bump version to latest available, 13.16.1.

Co-authored-by: Sam Ko <sam@vercel.com>
2024-05-17 22:56:40 -07:00
Ian Macartney
85a0354930
update convex README.md (#65765)
Updates the readme to point to the new docs location, and bumps the
convex version
2024-05-16 23:52:41 +00:00
Cody Olsen
00e88b82dd
Update Sanity example deps and implementation (#65744)
- Uses the new `presentationTool.resolve.locations` instead of
`presentationTool.locate` API, which doesn't require wrangling `rxjs`.
- Sets up the new `presentationTool.resolve.mainDocuments` API, which
automatically opens up the post you're previewing on the left side in
the editor on the right side.
- Removes the `sanity-typegen.json` config file as `sanity typegen` now
looks for top level `app` and `sanity` folders by default.
- Enables `^` semver ranges for deps again now that our turbopack
support is stable, so that we only have to send you PRs when bumping
majors or changing the implementation itself.
- Sets up `sanity.config.ts` so it's possible to use `npx sanity dev`
for quickly iterating on schemas.
2024-05-16 16:51:49 -07:00
Tim Neutkens
e359b14881
Upgrade react@beta (#65845)
Ensures `useMemoCache` is available for the React Compiler.

Required for #65804 without having to manually enable experimental React
through e.g. taint: true.

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

-->

---------

Co-authored-by: Jiachi Liu <inbox@huozhi.im>
2024-05-16 21:59:47 +02:00
David Sa
7725047c89
update cache handler version in example (#65330)
### What?
Update the cache-handler package to the latest and changed logic for
opting out of caching during build.

### Why?
The current implementation in the cache-handler-redis example requires
an environment variable check for `REDIS_AVAILABLE` to determine if the
server has already started in order to opt out of caching during build.
This update leverages the `NEXT_PHASE` environment variable instead.

### How?
This updates the environment variable check to leverage the `NEXT_PHASE`
variable so a user doesn't have to manage a new environment variable.

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2024-05-13 14:58:55 -07:00
Nhan Doan
359fdb2e5d
Update middleware example to App Router (#65618)
### What?
Update the `middleware` example to Next.js 14 App Router.

### Why?
App Router is recommended.

### How?
Follow Next.js App Router documentation.
2024-05-13 21:03:09 +00:00
Okoye Charles
829e2ebab6
Resolve grammatical errors in examples (#65644)
## Description
I fixed grammatical errors in a few READMEs in the `example` directory.

---------

Co-authored-by: Sam Ko <sam@vercel.com>
2024-05-13 17:10:40 +00:00
Zack Tanner
82a6110e59
update reproduction templates to use correct React (#65624)
Our reproduction templates are pinned to `next@canary`. This updates to
use the correct `react` & `react-dom` dependencies since `canary` is
pointed to React 19.

Fixes #65619
2024-05-10 19:24:57 +00:00
hrmny
64b718c661
chore: update prettier to 3.2.5 (#65092) 2024-05-08 21:47:14 +02:00
Sebastian Silbermann
2c31c79ac8
Support React 19 in App and Pages router (#65058)
Closes NEXT-3218

---------

Co-authored-by: Jiachi Liu <inbox@huozhi.im>
2024-05-07 18:18:32 +02:00
Buns Enchantress
93c0e64a36
@emotion/cache version fix (#65422)
<!-- 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?
Version specified for @emotion/cache does not exist, so updated to the
latest working version.

### How?

Closes NEXT-
Fixes #

-->

Co-authored-by: Sam Ko <sam@vercel.com>
2024-05-06 19:48:31 +00:00
Rishabh Poddar
91444dfef8
Fixes with-supertokens example (#65267)
This PR fixes how a protected API is called once the user is logged in,
in the `with-supertokens` example app.

Co-authored-by: Sam Ko <sam@vercel.com>
2024-05-02 19:19:20 +00:00
Gabriel F
9870faf789
Fix export function name on docs/routing/layouts-and-templates (#65240)
### What?
Fix export function name on docs/routing/layouts-and-templates

### Why?
The way it is, it will return an error to the user following the
tutorial: `Unsupported Server Component type: undefined / next js 13`

### How?
- Change `Links()` function export to `NavLinks()`

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2024-05-01 11:20:45 -07:00
Jamie Barton
a0df9860c4
feat(examples): add with-turso (#61291) 2024-05-01 11:41:47 -05:00
Karl Horky
03c8780e77
Ensure latest canary of Next.js is installed in repros (#65197) 2024-04-30 18:01:26 +02:00
Karl Horky
9e0277be81
Ensure latest canary of Next.js is installed in repros (#64967)
### What?

Always use latest canary in reproduction templates

### Why?

Following up with #63038, it appears that it has not completely resolved
the issue with CodeSandbox caching lockfiles and using an outdated
version of Next.js

Eg. currently, the reproduction template URL uses `next@14.2.0-canary.9`
is not the latest canary


https://codesandbox.io/p/sandbox/github/vercel/next.js/tree/canary/examples/reproduction-template

<img
src=https://github.com/vercel/next.js/assets/1935696/61b5cffa-90d2-4843-aaec-32e6f1e100e8
width=560>


### How?

This PR implements the following changes to the reproduction template to
install the latest version on fork:

1. On CodeSandbox "dev" task start, always update to latest Next.js with
`pnpm update next`
2. Make the CodeSandbox "dev" task restart on fork / clone of the
sandbox (@CompuIves built this feature very recently)

Observe how the `pnpm update next` script at the start of the `dev` task
runs again when forking my branch of the reproduction example:


https://github.com/vercel/next.js/assets/1935696/a3f6e65c-02cb-4eac-b0fa-367ac1751c39

cc @samcx @styfle @CompuIves

---------

Co-authored-by: Steven <steven@ceriously.com>
2024-04-26 14:48:48 +00:00
怀瑾
9c5ac4770f
fix(examples): blog-starter <Link> href, remove redundant public folder (#65025)
<!-- 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 #

-->
### Updating Examples (blog-starter)

- Remove redundant `public` folder in `src`.
- Fix `<Link>` href.

### Why?
```tsx
<Link as={`/posts/${slug}`} href="/posts/[slug]" aria-label={title}>
```
When deploy using static exports, `href="/posts/[slug]"` will result in
a wrong request to `/posts/[slug].txt`.

Co-authored-by: Sam Ko <sam@vercel.com>
2024-04-25 18:55:37 +00:00
Delba de Oliveira
84af8009e3
Docs: Explain why Layouts (RSCs) can't access pathname (#64785)
- Add section explaining why `pathname` can't be accessed in a layout
([file](https://github.com/vercel/next.js/pull/64785/files#diff-8eb7b23d3da342a1a407cdb6cc9c2d0dc2a455091ba2c4b6dbc41ba6cf840367))
- Split pages and layouts files (to add layout-specific examples in the
future)
- Clean up the existing active links example 

I'll add layout-specific examples in a follow-up PR, after creating some
demos.
2024-04-25 08:44:12 +01:00
Mehfooz-ur-Rehman
249184f02a
deps updated for with-mongodb-mongoose example (#64928)
<!-- 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?
dependencies updated for with-mongodb-mongoose example

### Why?
i used this template and everytime its outdated and was not updated for
some time so updated the deps

### How?
installed the latest version of each outdated dependency and ran the
project

Closes NEXT-
Fixes #

-->

Co-authored-by: Sam Ko <sam@vercel.com>
2024-04-23 20:05:21 +00:00
Cody Olsen
1d592a9a08
Update Sanity example deps (#64939)
Bumping `next-sanity` fixes an issue where `@sanity/client` would
swallow the `DynamicServerError` thrown during `next build` in
[v14.2.2](https://github.com/vercel/next.js/pull/64511).
The `sanity` bump adds the new `Scheduled Publishing` feature that's
[now in the
core](https://github.com/sanity-io/sanity/releases/tag/v3.39.0).
2024-04-23 13:02:44 -07:00
zahra shahrouzi
dd9324f6c6
bug fix on a pull request #64911 (#64925)
### What?

Fixes a bug of removed dependencies by accident, which caused the
example not to install dependencies.

### How to test?

Running this script should initiate a project that works correctly:
```
 pnpm create next-app --example with-storybook with-storybook-app
```


Fixes this pull request https://github.com/vercel/next.js/pull/64911
2024-04-23 11:01:31 -07:00
zahra shahrouzi
06db6ca62d
Update with-storybook example (#64911)
### What?

Updated the example `with-storybook`, by upgrading storybook to version
8.0.9 (the latest) which required bumping the version of next.js to 14
from 13 in order to make them work together.

### Why?

The motivation for this change is that we now have better the lastest
features of storybook such as chromatic and visual testing. As of
previous updates, it is still treated as its own framework and so users
can specify the `storybook` framework as well as custom build command
`build-storybook` in order to get near zero-config support.

---------

Co-authored-by: Sam Ko <sam@vercel.com>
2024-04-23 08:13:24 -07:00
jeanmax1me
8898a80bec
Update Nav.tsx (#64818)
removed duplicate of "use client"

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

-->

Co-authored-by: Steven <steven@ceriously.com>
2024-04-21 19:41:07 -07:00
Xiao Hanyu
dccc6ece46
chore: fix a wrong link for with-service-worker example (#64666)
<!-- 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 #

-->

Just fixed a broken link for with-service-worker example READMD
2024-04-17 14:36:00 +00:00
Cody Olsen
111608171f
Update Sanity example deps and tsconfig (#64570)
v3.38.0 of `sanity` fixes a couple of bugs affecting Next.js:
- [crash in hotspot and cropping on
Next.js](https://github.com/sanity-io/sanity/pull/6380)
- [regression hiding tool buttons when embedded on
Next.js](https://github.com/sanity-io/sanity/pull/6338)

Also adjusts the `tsconfig.json` to use `module: Preserve`.
2024-04-16 18:01:44 +00:00
Cody Olsen
cb60718be9
Add TypeGen to Sanity example (#64198)
Adds support for the [newly introduced Sanity
TypeGen](https://www.sanity.io/blog/introducing-sanity-typegen)! 🥳
2024-04-12 08:28:35 -07:00
Jiwon Choi
ac7607f977
fix(examples): invalid with-apollo and with-graphql-hooks (#64186)
### Why?

The examples `with-apollo` and `with-graphql-hooks` included outdated
API endpoints and packages.
This resulted in the **failed Vercel Deployment** of the examples.

<details><summary>Screenshot of failed deployments</summary>
<p>

#### with-graphql-hooks

![Screenshot 2024-04-08 at 3 04
05 PM](https://github.com/vercel/next.js/assets/120007119/93be6aca-e408-4b93-bf6c-04d8dfc9b59c)

#### with-apollo

![Screenshot 2024-04-08 at 3 05
26 PM](https://github.com/vercel/next.js/assets/120007119/4dff9e20-714c-4a12-a27d-8fae4fc5c61d)

</p>
</details> 

### How?

- Migrated examples from `pages` to `app` router and removed invalid API
endpoints.
- Refactored the example to a minimal template as possible with
essential features.

Closes #9865 #10253 #36112

---------

Co-authored-by: Sam Ko <sam@vercel.com>
2024-04-08 07:55:39 -07:00
Tim Neutkens
4271c095fb
Fix last examples for Turbopack (#64020)
## What

AMP is not supported with Turbopack. The knex example uses `@next/env`
so it needs to be installed.

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

-->


Closes NEXT-2989
2024-04-03 16:02:52 +02:00
Adem ilter
d58e2e4a71
fix: file name in with-zustand example (#63925)
<!-- 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 #

-->

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2024-04-01 23:13:30 +00:00
Tim Neutkens
91144461ed
Revert "chore(examples): migrate mdx from pages router (JS) to app router (TS)" (#63704)
Reverts vercel/next.js#63646

The example changes are missing a bunch of stuff:
- Types are not added, you can see the changes required here:
https://github.com/vercel/next.js/pull/63703
- Dependencies are missing, i.e. `@types/react` `@types/node`,
`typescript` are all missing.

Reverting as CI is broken.
2024-03-26 10:18:42 +01:00
Arian
b749570d24
chore(examples): migrate mdx from pages router (JS) to app router (TS) (#63646)
Please if it needs further updates, Let me know!
 Happy to contribute

---------

Co-authored-by: Steven <steven@ceriously.com>
2024-03-25 22:42:26 +00:00
Eng Zer Jun
3ba3eeb2a2
Remove obsolete block-all-mixed-content CSP directive (#63595)
The `block-all-mixed-content` CSP directive has been deprecated and it
is not recommended to use it anymore.

Furthermore, the `upgrade-insecure-requests` directive is evaluated
before `block-all-mixed-content`, if the former is set, the latter does
nothing.

Reference:
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/block-all-mixed-content
Reference: https://www.w3.org/TR/mixed-content/#strict-checking

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2024-03-25 10:09:17 -07:00
kei
4284302cb3
docs: Fix duplication of without on with-docker-compose Readme (#63643) 2024-03-25 11:38:48 +01:00
FoSuCloud
77b21001cc
Fix(example) : Image missing width property in with-redux example (#63546)
- Fixes https://github.com/vercel/next.js/issues/63542

Co-authored-by: yelipei <yelipei@qianxin.com>
Co-authored-by: Steven <steven@ceriously.com>
2024-03-21 18:24:21 +00:00
Cody Olsen
f25ae9a0f9
Update Sanity example deps (#63514)
Most notably it updates `typescript` to `5.4.2` now that Sanity Studio
is updated to support the [more aggressive reduction of intersections
between type variables and primitive
types](https://devblogs.microsoft.com/typescript/announcing-typescript-5-4/#more-aggressive-reduction-of-intersections-between-type-variables-and-primitive-types)
2024-03-20 15:14:16 -04:00
Koji Onishi
430e71a38d
update Docker examples to specify HOSTNAME properly (#59756)
### What?

Update docker examples to correctly set HOSTNAME env variable for
standalone output

Related to PR:
https://github.com/vercel/next.js/pull/52804

### Why?
### TL;DR

The dockerfiile examples need to modified as that contains HOSTNAME
setting that apparently is not working as expected.

Related to Issue:
https://github.com/vercel/next.js/issues/58657

Affected examples:
https://github.com/vercel/next.js/tree/canary/examples/with-docker

https://github.com/vercel/next.js/tree/canary/examples/with-docker-multi-env

### Longer explanations

Based on [Docker
document](https://docs.docker.com/engine/reference/builder/#environment-replacement):
> You can also use environment variables with RUN, CMD, and ENTRYPOINT
instructions, but in those cases the variable substitution is handled by
the command shell, not the builder.

It means that when executing the last CMD ( `node server.js` ) in
Dockerfile samples, the HOSTNAME defined by prior `ENV` instruction is
simply ignored.

This causes problems typically when the host process sets HOSTNAME -
e.g. for instance when using AWS Fargate for deployment [we can't have
control over HOSTNAME](https://stackoverflow.com/a/52871552) set by the
host process. (also refer to the issue #58657 above)

### How?

Updated Dockerfilie samples, by setting HOSTNAME directly in CMD
instruction that launches nextjs server, not in the builder process.

Used this setting at my end (with AWS Fargate) to confirm that it fixes
the network problem.

Closes NEXT-
Fixes #58657

Co-authored-by: Sam Ko <sam@vercel.com>
2024-03-19 21:26:44 +00:00
Arian
a2e3b27dfc
Migrate the with-jotai example from page router to app router (#63390)
## Migrate the with-jotai example from page router to app router

Please if it needs further updates, Let me know!
Happy to contribute

---------

Co-authored-by: Sam Ko <sam@vercel.com>
2024-03-18 21:28:29 +00:00
Ellert Smári Kristbergsson
08d7a7e518
Update to the Stable API (#60493)
Update MongoDB according to their guidance for their new Stable API 

See:
https://www.mongodb.com/docs/drivers/node/current/fundamentals/stable-api/

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

-->

---------

Co-authored-by: Sam Ko <sam@vercel.com>
2024-03-13 18:04:59 +00:00
Cody Olsen
aeb4d724c1
Fix pnpm support in Sanity example (#63249)
As `@sanity/preview-url-secret` wasn't declared as a dependency when
doing:
```bash
pnpm install && pnpm build
```
It would fail to compile:
```bash
Linting and checking validity of types  .Failed to compile.

./app/api/draft/route.tsx:6:36
Type error: Cannot find module '@sanity/preview-url-secret' or its corresponding type declarations.

  4 |  */
  5 |
> 6 | import { validatePreviewUrl } from "@sanity/preview-url-secret";
    |                                    ^
  7 | import { draftMode } from "next/headers";
  8 | import { redirect } from "next/navigation";
  9 |
```
2024-03-13 17:52:56 +00:00
Cody Olsen
f1d72998e8
Update Sanity example for App Router (#63187)
- Updates deps with minor bugfixes.
- Fixes typos and removes debug console logs.
- Less aggressive validation rules for alt text
2024-03-12 16:50:04 -07:00
Maksym Pinchuk
1ab1c4ca34
chore(examples): remove duplicate line in .gitignore for progressive-web-app example (#63207) 2024-03-12 18:09:24 -04:00
Sam Ko
3f1ae54319
Revert "fix: permissions in with-docker example" (#63165)
Reverts vercel/next.js#63134

Closes NEXT-2783
2024-03-11 17:36:11 -07:00
Aaron Campbell
c703fae24c
Allow unsafe-eval during development (#55998)
Fixes issue where a freshly cloned example will not work in development
mode due to `unsafe-eval` being blocked by the CSP.

Currently, the example will not work in development. Running the example
with `run dev` will produce EvalError errors in console which prevent
the app from functioning. This error also prevents any `<Script>`
components with `afterInteractive` from being loaded. These issues do
not occur in production where `eval` is not used.

This PR:
- Fixes the issue by allowing `unsafe-eval` if the environment is not
`production`.
- Improves the `script-src` value by [allowing backwards compatibility
with
browsers](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/script-src#strict-dynamic)
that do not support `strict-dynamic` (`https: http: 'unsafe-inline'`
will be ignored by browsers that support `strict-dynamic`).

Some further details are available here:
https://github.com/vercel/next.js/issues/55638. This PR is not a fix for
the issue however.

- Fixes https://github.com/vercel/next.js/issues/61316

Co-authored-by: Sam Ko <sam@vercel.com>
2024-03-11 18:15:13 +00:00
Kinbaum
51665b3640
fix: permissions in with-docker example (#63134)
<!-- 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

This pr addresses an issue in Docker where the cache and the creation of
its contents throw the following error:

```
[Error: EACCES: permission denied, mkdir '/app/.next/cache'] {
errno: -13,
code: 'EACCES',
syscall: 'mkdir',
path: '/app/.next/cache'
```

Co-authored-by: Sam Ko <sam@vercel.com>
2024-03-11 16:33:03 +00:00
Casey Ocampo
44626ed4e5
fix(examples): dynamically update page title (#63110)
### What?


[blog-starter-kit](https://vercel.com/templates/next.js/blog-starter-kit)'s
page title does not update when navigating to a blog post.

### Why?

The `title` property was missing from:

```
return {
    title, // missing
    openGraph: {
      title,
      images: [post.ogImage.url],
    },
  };
```

Closes NEXT-[Page title is not dynamically updating #63083
](https://github.com/vercel/next.js/issues/63083)
Fixes #63083
2024-03-11 08:42:37 -07:00