Commit graph

3140 commits

Author SHA1 Message Date
Rishabh Poddar
7d4888d961
Updates with-supertokens example app (#60901)
Refactors with-supertokens example app to move some of the helper
functions into the SDK.
2024-01-20 00:35:28 +00:00
Taishi
f000352723
upgrade @types/react-dom to v18.2.18 to import useFormState for server actions in with-supabase example (#60822)
### Adding or Updating Examples

I can't import `useFormState` from `react-dom` with
`@types/react-dom@18.2.5`, so I upgrade it to the latest version of it.

---------

Co-authored-by: Sam Ko <sam@vercel.com>
2024-01-19 04:19:11 +00:00
Augustin Mauroy
c0282712ae
chore(example): update storybook (#60737)
### What?

- update storybook version
- use `SWC` for perf
- pinging dep for security of the example
- update readme to have correct link

Co-authored-by: Sam Ko <sam@vercel.com>
2024-01-16 18:02:13 -08:00
Elyees T
5e29dfc881
Update README.md (#60595)
### Improving Documentation

necessary update for agilitycms readme file to enhance clarity

<!-- 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-01-17 00:23:05 +00:00
Lee Robinson
b177ff6488
examples: Update redis example with useOptimistic (#60596) 2024-01-15 21:19:59 -06: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
hugo-syn
601eaf0e87
chore: Fix multiple typos (#60531)
## For Contributors

Fix multiple typos
2024-01-11 10:44:55 -08:00
hugo-syn
b21a2b9445
chore: Fix typo s/desireable/desirable/ (#60518)
Fix typo s/desireable/desirable/ in 2 README.md files

Co-authored-by: Steven <steven@ceriously.com>
2024-01-11 14:43:13 +00:00
Lee Robinson
bf63ddb4d9
examples: Update hello world (#60502) 2024-01-10 22:15:21 -06:00
Arseny
8694ed6a40
Update cache-handler-redis example dependencies (#59458)
This pull request updates the dependencies in the cache-handler-redis
example. It updates the versions of the `@neshca/cache-handler`, which
introduces new features.

---------

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2024-01-10 18:43:03 +00:00
oxxd
6740f2f891
chore(examples): fix image-component example viewsource paths, shimmer page filename (#60451)
This PR fix `image-component` example viewsource paths and shimmer page
filename. Which would result a Github 404 page in the current live
example.

A flow up fix on this PR #60289
2024-01-10 10:13:42 -05:00
rmathew8-gh
af24c45398
fixed import path in with-jest template. (#60332)
<!-- 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: Roy Mathew <rmathew8@gmail.com>
Co-authored-by: Sam Ko <sam@vercel.com>
2024-01-06 23:26:59 +00:00
Luke Schlangen
0ea127c642
examples: add allow-unauthenticated option to cloud run deploy (#58792)
Co-authored-by: Lee Robinson <me@leerob.io>
2024-01-06 11:08:27 -06:00
Niklas Ziermann
781fa7745d
examples: improve zustand example (#58696)
Co-authored-by: Lee Robinson <me@leerob.io>
2024-01-06 11:07:54 -06:00
Steven
bb7af2a0d4
chore(examples): migrate image-component example to App Router (#60289)
This PR migrates the `image-component` example from Pages Router to App
Router.

It also upgrades a couple dependencies and regenerates tsconfig.json
2024-01-06 11:03:01 -06:00
Nicolas Froidure
2d52962dfd
examples: improve typings for i18n app dir (#60160) 2024-01-03 08:42:12 -06:00
Tibor Szász
2eda0140e3
examples: fix contentful install instructions (#60050) 2023-12-31 17:22:46 -06:00
Lee Robinson
9986e82263
examples: Update next-forms example (#60052)
- Remove `experimental_` import for `useFormStatus`
- Update all dependencies
- Move to `postgres` so it works with any Postgres provider
- Fix a TypeScript issue
- Use `next dev --turbo`
2023-12-30 11:17:14 -06:00
Ian Macartney
7343af9deb
examples: Update Convex Example (#59789)
Co-authored-by: Lee Robinson <me@leerob.io>
2023-12-28 00:25:14 -06:00
Ankit Kashyap
4b68d55b39
examples: Supabase rename .env.local.example to .env.example (#59984) 2023-12-27 22:47:45 -06:00
Dhaya
2c811af22e
examples: Upgrade with-algolia-react-instantsearch example to latest major version and use app router (#59961)
Co-authored-by: Lee Robinson <me@leerob.io>
2023-12-27 10:44:32 -06:00
Mohammed Gadi
bc41a7f829
examples: Update .env.local.example of with-firebase (#59954) 2023-12-27 10:43:52 -06:00
Lee Robinson
7c7d981b2d
examples: progressive enhancement for Redis example (#59937)
The example had `useOptimistic` and wasn't structured so that the
browser could fall back to `action` if JS was still loading or disabled.
2023-12-25 20:07:13 -06:00
Luke Schlangen
a0b661de8d
examples: remove broken deploy button (#58794) 2023-12-25 09:03:27 -06:00
Lee Robinson
0fc1d9e982
examples: update Redis to App Router (#59311) 2023-12-24 10:09:23 -06:00
Lee Robinson
3d9a1b481e
examples: add required env vars to auth example. (#59901) 2023-12-23 10:27:33 -06:00
Lee Robinson
4225da8cba
examples: Add new NextAuth.js example (#56914) 2023-12-23 10:21:26 -06:00
Jon Meyers
4462354da1
Fix: Add matcher for middleware (#59651)
### What?
- exclude assets from middleware

### Why?
- avoid refreshing session logic running unnecessarily

### How?
- export matcher config from middleware

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-12-18 09:40:44 -08:00
Joseph
7eac1c8ee9
fix: Invalid next version tag name in with-cypress example (#59647)
<!-- 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 #

-->

Hi,

Fix for the accidental change, introduced in this PR
https://github.com/vercel/next.js/pull/59572, which set the `next`
version tag for the with-cypress example, to `^latest`, which causes the
`create-next-app` step to fail:

```shell
npx create-next-app --example with-cypress with-cypress-app
Creating a new Next.js app in /Users/<user>/<Project-Path>/with-cypress-app.

Downloading files for example with-cypress. This might take a moment.

Installing packages. This might take a couple of minutes.

npm ERR! code EINVALIDTAGNAME
npm ERR! Invalid tag name "^latest" of package "next@^latest": Tags may not have any characters that encodeURIComponent encodes.
```

Yarn instead, shows a list of next.js packages to select from instead.

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-12-18 09:37:33 -08:00
Delba de Oliveira
f518fd81b3
Docs: Fix formatting in testing docs and update examples dependencies (#59572)
Follow-up from: https://github.com/vercel/next.js/pull/59268
2023-12-13 07:02:53 -08:00
Delba de Oliveira
0ddc7e8fad
Docs: Add App Router Testing Guides and update /examples (#59268)
This PR updates the testing guides to use App Router and TypeScript,
also updates `/examples` to show `app` and `pages` examples.

## Overview

- [x] Create a new "Testing" section that is shared between `app` and
`pages`.
- [x] Explain the differences between E2E, unit testing, component
testing, etc.
- [x] Recommend E2E for `async` components as currently none of the
tools support it.
- [x] Update setup guides for **Cypress**, **Playwright**, and **Jest**
with latest config options, and examples for `app` and `pages`.
- [x] Add new guide for **Vitest**
- [x] Clean up `/examples`: use TS, show `app` and `pages` examples,
match docs config

## Cypress

- [x] E2E Tests
- [x] Component Testing
  - [x] Client Components
  - [x] Server Components
  - [ ] `async` components

**Blockers:** 
- TS: `Option 'bundler' can only be used when 'module' is set to
'es2015' or later`. In **tsconfig.json** compilerOptions, Next.js uses
"moduleResolution": "bundler", changing it to "node" fixes the issue but
it can have repercussions.
  - https://github.com/cypress-io/cypress/issues/27731 
- Version 14 is currently not supported for component testing
  - https://github.com/cypress-io/cypress/issues/28185

## Playwright

- [x] E2E Tests

## Jest

- [x] Unit Testing
   - [x] Client Components
   - [x] Server Components
- [ ] `async` components:
https://github.com/testing-library/react-testing-library/issues/1209
   - [x]  'server-only': https://github.com/vercel/next.js/pull/54891
- [x] Snapshot Testing

**Blockers:**
- TS: https://github.com/testing-library/jest-dom/issues/546
- None of the solutions in the issue work with Next.js v14.0.4 and TS v5

## Vitest 

- [x] Unit Testing
  - [x] Client Components
  - [x] Server Components
  - [ ] `async` components
  - [x] 'server-only'
 - [x] Update vitest example
- [x] Handles CSS, and CSS modules imports
- [x] Handles next/image

## Other

- https://github.com/vercel/next.js/issues/47448
- https://github.com/vercel/next.js/issues/47299
2023-12-12 22:30:23 -06: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
Sebastian Silbermann
79a8d01ae6
Use new JSX transform (#56294)
Co-authored-by: Jimmy Lai <laijimmy0@gmail.com>
Co-authored-by: Jiachi Liu <inbox@huozhi.im>
2023-12-09 00:17:50 +01:00
Oleh Dutchenko
f7b9843b92
examples: Updates the with-vitest example for server-only usage (#58902) 2023-12-08 00:18:29 -06:00
Rishabh Poddar
484efaec85
examples: Updates with-supertokens example app (#58525)
Co-authored-by: Lee Robinson <me@leerob.io>
2023-12-04 16:17:46 -06:00
Karl Horky
b02a10e331
Enable typechecking on config (#57892)
Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: Balázs Orbán <info@balazsorban.com>
2023-12-01 09:57:57 +01:00
Dylan700
d509c2d528
examples: Update Electron Typescript Example with Best Practices (#58947)
Co-authored-by: Lee Robinson <me@leerob.io>
2023-11-29 20:37:03 -06:00
Luke Schlangen
92f7d0c5e9
examples: add direct link to Dockerfile (#58793) 2023-11-29 18:54:44 -06:00
Zack Tanner
42e17d070b
fix lint in examples (#58630)
#58053 was merged without lint passing.
2023-11-18 18:09:25 +00:00
Evan Charalampidis
90cd224111
examples: migrate with-cypress example to App Router (#58053)
Co-authored-by: Evan <evan.charalampidis@gmail.com>
Co-authored-by: Lee Robinson <me@leerob.io>
2023-11-18 10:31:39 -06:00
su
2e85806282
feat(examples): add upload file example with Server Actions (#58467)
Add upload file example with Server Actions
2023-11-17 22:15:59 +00:00
Lee Robinson
41d890aaec
examples: Remove outdated example (#58568)
Closes https://github.com/vercel/next.js/issues/54309.
2023-11-16 22:08:23 -06:00
Lee Robinson
d115ccad14
examples: fix import statement for lru-cache (#58567) 2023-11-16 21:55:24 -06:00
Milan K
0e55bb1a4a
examples: with-zustand update to App Router (#58042)
Co-authored-by: Lee Robinson <me@leerob.io>
2023-11-16 21:52:34 -06:00
Sam Ennis
e224c2251a
examples: update lru-cache version (#58060) 2023-11-16 21:45:45 -06:00
Arseny
10c794a371
examples: Update cache-handler-redis (#58562) 2023-11-16 21:36:55 -06:00
Tom Ballinger
2b0288912b
examples: Upgrade Convex example to convex@1.2.1 (#54910)
Co-authored-by: Lee Robinson <me@leerob.io>
2023-11-15 23:14:32 -06:00
rodrigo
6d9ce62f13
examples: update styled-components (#56457)
Co-authored-by: Lee Robinson <me@leerob.io>
2023-11-15 23:14:00 -06:00
Joshua Santos
f163dd097f
examples: fix unhandled runtime error for forms (#56600)
Co-authored-by: Lee Robinson <me@leerob.io>
2023-11-15 23:13:23 -06:00
ihommani
70389d0cfd
examples: update Dockerfile comment (#56646)
Co-authored-by: Lee Robinson <me@leerob.io>
2023-11-15 23:11:21 -06:00
Heloi Neto
c6d30da394
examples: fix typo for component (#58330) 2023-11-15 23:00:27 -06:00
Prince Agrawal
6d29fc1bfd
examples: Fix hydration error in headers example (#58383) 2023-11-15 22:59:07 -06:00
Sean Gray
f5f0767ee5
examples: update Geist font path (#58349) 2023-11-15 22:58:44 -06:00
Karl Horky
ff257800fc
Remove copying of request headers to response (#58304)
<!-- 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?

Avoid copying request headers to response

### Why?

Copying request headers to response allows for reflection attacks
https://github.com/vercel/next.js/issues/57410

### How?

Remove the `headers:` property assignment

cc @leerob 

Followup to https://github.com/vercel/next.js/pull/58300

Fixes #57410
2023-11-10 16:14:54 +01:00
Lee Robinson
e50782829b
examples: Update Middleware for CSP (#58300) 2023-11-10 13:55:16 +00:00
Arseny
e2f3059b48
Add a self-hosted shared cache example (#58000)
### What?

This pull request integrates the exemplary setup for a self-hosted Next.js application utilizing Redis as a shared cache storage. The solution supports caching at both the App and Pages routers in default and standalone modes, as well as partial pre-rendering, facilitated by the [`@neshca/cache-handler`](https://github.com/caching-tools/next-shared-cache/tree/canary/packages/cache-handler) package. The package enables customizing cache handlers and replacing the default cache provided by Next.js seamlessly.

### Why?

The motivation behind this pull request is to provide an example demonstrating how Redis can be used as a shared cache in a self-hosted environment, thereby improving the scalability of hosting multiple instances of a Next.js application.
2023-11-09 14:29:11 +00:00
Lee Robinson
d3756fac5d
chore: cleanup more old examples. (#58066) 2023-11-07 13:53:53 -06:00
Jon Meyers
c3bf735263
Chore: refactor to use server actions in with-supabase example (#57858)
### What?
[1] Use Server Actions for auth
[2] Use Geist font
[3] Address warning about `metadataBase` in console

### Why?
[1] The co-location of Login page and authentication logic is simpler for beginners
[2] Looks nice
[3] Avoid confusing people with the starter template printing warnings

### How?
[1] Refactor Route Handlers to Server Actions
[2] Install font and set to `html`
[3] Explicitly declare the default value for `metadataBaseUrl`
2023-11-01 14:58:33 +00:00
Lee Robinson
ac54377e67
examples: cleanup (#57845)
Remove examples that were linking to just READMEs, or outdated / discontinued ones.
2023-11-01 00:08:55 +00:00
Jon Meyers
75958bbc46
Chore: simplify with-supabase example (#57562)
### What?

[1] Simplify example
[2] Refactor `delete` method to use `cookies.set`

### Why?

[1] Make it easier to follow
[2] Fix build errors

### How?

[1] Adding comments and abstracting code into helper functions
[2] Setting cookie to empty value when removed

---------

Co-authored-by: Lee Robinson <me@leerob.io>
2023-10-31 18:33:55 -05:00
vinay
2f5dbd94c8
Update Explore the Next.js 13 playground. to Explore starter templates for Next.js (#57799)
Update `Explore the Next.js 13 playground.` --> `Explore starter templates for Next.js`
2023-10-31 20:17:51 +00:00
vinay
240730f3ed
Remove `experimental: { serverActions: true } from examples as it is stable in next 14. (#57598)
Co-authored-by: Jiachi Liu <inbox@huozhi.im>
2023-10-31 13:01:26 +01:00
Joel Hooks
13d61529dc
examples: fix inngest example for 3.x sdk (#57712)
Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-10-29 11:38:21 -05:00
Joel Hooks
6a8010dbb6
examples: Add inngest next.js example (#56049)
Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-10-28 11:57:27 -05:00
xixinRunBoy
058f6f1cb0
active-class-name example style js has not taken effect (#56136)
example/active-class-name: the Nav.tsx's style has not taken effect
change <style jsx> to <style jsx global>

Co-authored-by: chenxixin <chenxixin>
2023-10-26 20:19:14 -05:00
vinay
5998e6a884
examples: Update example with-Clerk (#57050)
Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-10-26 20:14:37 -05:00
Kunall Banerjee
c380d91562
docs: fix broken link to demo (#57229)
<!-- 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 #

-->

Nothing too crazy, just pointing the demo to the right URL. The previous
URL is dead/unreachable.

💖
2023-10-26 20:14:08 -05:00
ChanHui
8d45aa9bfb
update @types/react version in examples (#57259)
### What?
When I ran `npx create-next-app --example with-turbopack` and installed
dependencies using `yarn`, I found an typescript error(`'SomeComponent'
cannot be used as a JSX component.`).

<img
src="https://github.com/vercel/next.js/assets/51700274/f6c7e478-c0b1-4ea2-996f-4c0c78e3bb4b"
width=400 />

and I realized that the bug is due to the version of
@types/react(18.0.x).
you can check this issue on
[here](https://github.com/vercel/next.js/issues/42292#issuecomment-1594351684)
too.

### Why?
It seems that there is an error occurring in the @types/react version
18.0.x.

### How?
It would be good to change the @types/react version to 18.2.8 in the
next.js examples.

I think this change will resolve [this
issue](https://github.com/vercel/next.js/issues/55080#issue-1884846177)
[NestJS
documentation](https://nextjs.org/docs/app/building-your-application/configuring/typescript#async-server-component-typescript-error)
also states to upgrade the version.

Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-10-26 19:52:08 -05:00
Houssein Djirdeh
307bdcd04c
(Examples) Add with-google-maps-embed example (#57365)
Adds `with-google-maps-embed` example in `examples/` directory to show
how to use the `<GoogleMapsEmbed />` component from
_@next/third-parties_.

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

-->
2023-10-26 19:13:12 -05:00
Houssein Djirdeh
aaf668a535
(Examples) Add with-youtube-embed example (#57367)
Adds `with-youtube-embed` example in `examples/` directory to show how
to use the `<YouTubeEmbed />` component from _@next/third-parties_.

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

-->
2023-10-26 19:12:23 -05:00
Jon Meyers
b9dd6c4ff6
Fix: Call cookies function from route to flag as dynamic (#57494)
### What?

Move calling the `cookies` function up to the route

### Why?

This flags the route as `dynamic`, meaning we don't need to explicitly declare `export const dynamic = 'force-dynamic'`

### How?

Passing the returned `cookieStore` into Supabase helper functions, rather than the `cookies` function itself
2023-10-26 16:18:17 +00:00
Houssein Djirdeh
7bee486f7c
Docs: Add documentation for next/third-parties (#57345)
Co-authored-by: Jiachi Liu <inbox@huozhi.im>
2023-10-25 23:07:18 -07:00
Jon Meyers
4bc549bf95
Fix: catch expected error in with-supabase example (#57378)
### What?

[1] Use camelCase for SVG properties
[2] Catch expected error in cookie functions

### Why?

[1] Prints error to the console
[2] If the cookies `set` or `delete` methods are called in a Server Component, an error is thrown

### How?

[1] Change property names from kebab-case to camelCase
[2] Catch error
2023-10-26 04:37:32 +00:00
Jon Meyers
d0e92b19af
chore: Refactor with-supabase example to use ssr package (#57100)
### What?

[1] Refactors `with-supabase` example to use new `@supabase/ssr` package
[2] Makes landing page dynamic steps to connect Next.js to Supabase
[3] Fixes a range of small bugs

### Why?

[1] Simplifies creating a Supabase client
[2] People were not understanding how to connect this template to Supabase
[3] People don't like bugs

### How?

[1] Declares a separate `createClient` function for client and server. Client version is used in Client Components, server version is used every where else - Server Components, Route Handlers, Server Actions, Middleware
[2] Makes landing page a dynamic list of next steps to guide the user to success
[3] Writing code to squash the bugs!
2023-10-23 23:34:10 +00:00
Steven
a3aa6590ff
chore(next/image)!: mark domains as deprecated in favor remotePatterns (#57062)
We already had `domains` as "not recommended" but this PR marks it as "deprecated" and prints a warning if its detected.

I also updated all examples to switch from `domains` to `remotePatterns`.
2023-10-19 20:24:48 +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
xiaolou86
b95474a9d2
fix typos (#56870) 2023-10-18 00:46:47 +00:00
Steven
3a459ca986
chore(next/image)!: mark onLoadingComplete as deprecated in favor of onLoad (#56944)
## History

We used to pass `onLoad` through directly to the underlying img so `onLoadingComplete` was introduced in order to handle the case when `placeholder="blur"` was used and `onLoad` would trigger before the placeholder was removed.

We have since changed the behavior of `onLoad` so that it acts the same as `onLoadingComplete` and therefore `onLoadingComplete` is no longer needed.

## What is this PR doing?

This PR marks `onLoadingComplete` as deprecated in favor of `onLoad`. In the future, we may remove `onLoadingComplete`.
2023-10-17 21:12:22 +00:00
Mateusz Burzyński
db214214d6
Update Babel dependencies (#51962)
### What?

Update Babel packages across the board

### Why?

Since you ship vendored presets and plugins it's impossible for people to update this stuff at their own pace - independently from Next. So users of `next/babel` are currently stuck with old versions and, for example, they might not be able to use the TS `satisfies` operator.

### How?

I just updated ranges (to pinned ones) where I could find them, run `corepack pnpm i` and re-run build scripts in the `packages/next`.

Fixes #43799
2023-10-17 02:25:57 +00:00
Josh Story
0a80017d03
Update React from d900fadbf to 09fbee89d. Removes server context and experimental prefix for server action APIs (#56809)
The latest React canary builds have a few changes that need to be
adopted for compatability.

1. the `useFormState` and `useFormStatus` hooks in `react-dom` and the
`formData` opiont in `react-dom/server` are no longer prefixed with
`experimental_`
2. server content (an undocumented React feature) has been removed. Next
only had trivial intenral use of this API and did not expose a coherent
feature to Next users (no ability to seed context on refetches). It is
still possible that some users used the React server context APIs which
is why this should go into Next 14.

### React upstream changes

- https://github.com/facebook/react/pull/27513
- https://github.com/facebook/react/pull/27514
- https://github.com/facebook/react/pull/27511
- https://github.com/facebook/react/pull/27508
- https://github.com/facebook/react/pull/27502
- https://github.com/facebook/react/pull/27474
- https://github.com/facebook/react/pull/26789
- https://github.com/facebook/react/pull/27500
- https://github.com/facebook/react/pull/27488
- https://github.com/facebook/react/pull/27458
- https://github.com/facebook/react/pull/27471
- https://github.com/facebook/react/pull/27470
- https://github.com/facebook/react/pull/27464
- https://github.com/facebook/react/pull/27456
- https://github.com/facebook/react/pull/27462
- https://github.com/facebook/react/pull/27461
- https://github.com/facebook/react/pull/27460
- https://github.com/facebook/react/pull/27459
- https://github.com/facebook/react/pull/27454
- https://github.com/facebook/react/pull/27457
- https://github.com/facebook/react/pull/27453
- https://github.com/facebook/react/pull/27401
- https://github.com/facebook/react/pull/27443
- https://github.com/facebook/react/pull/27445
- https://github.com/facebook/react/pull/27364
- https://github.com/facebook/react/pull/27440
- https://github.com/facebook/react/pull/27436

---------

Co-authored-by: Zack Tanner <zacktanner@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: Jiachi Liu <inbox@huozhi.im>
2023-10-16 15:46:10 -07:00
Surav Shrestha
869d93c777
docs: fix several typos (#56788)
`Enviroment -> Environment`

---------

Co-authored-by: Steven <steven@ceriously.com>
2023-10-13 15:40:14 -04:00
Alex Yang
ac8a6035df
fix: http2 example issue (#56768)
### What?

If the custom server uses `app.render(xxx)` will render the normal js files as server components in dev mode and cause 404 error when loading every non-HTML file.

### How?

Fixes https://github.com/nodejs/help/issues/4253, fixes https://github.com/vercel/next.js/issues/50270
2023-10-13 16:55:48 +00:00
Mayank
0b5251c2f0
chore(example): bump @radix-ui/react-icons (#56452)
Co-authored-by: Snyk bot <19733683+snyk-bot@users.noreply.github.com>
2023-10-12 20:38:09 +00:00
Zack Tanner
daa865fff6
fix lint error from fauna example (#56719)
https://github.com/vercel/next.js/pull/56185 wasn't passing lint checks

[x-ref](https://github.com/vercel/next.js/actions/runs/6487087673/job/17616654281?pr=56718#step:28:196)
2023-10-11 19:45:22 +00:00
Shadid12
216d968c9f
examples: Update Fauna example (#56185) 2023-10-11 12:39:25 -05:00
Mustafa Dağkıranlar
9b2f29ebaf
Update actions.ts (#56579)
fixed depricated nonempty()
2023-10-09 02:32:42 +00:00
Ryan LaBarre
b436589ff8
Maintenance: minor example dep bumps to fix moderate vulns (#56375)
### What?
Merged a bunch of dependabot alerts in my own canary branch, mainly
postcss patch updates, and one graphql minor update, to fix moderate
security vulnerabilities in examples. Spot checked most and look good
still. EDIT: also one in scripts/send-trace-to-jaeger

### Why?
Because safety

### How?
Dependabot

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Steven <steven@ceriously.com>
2023-10-04 11:18:54 -04:00
Hamir Mahal
be952fbb31
fix: typo in with-stripe-typescript example (#56274)
fixes #56273.
2023-10-02 16:47:23 +00:00
vinay
638cc931be
(Examples) update Grafbase example (#54705)
Co-authored-by: Balázs Orbán <18369201+balazsorban44@users.noreply.github.com>
2023-09-30 15:08:26 +00:00
Balázs Orbán
55a638ba42
chore(examples): fix with-jest types (#56193)
### What?

Closes https://github.com/vercel/next.js/issues/55167
Also does the same as #56151 for `with-jest-babel`

Fixes https://github.com/vercel/next.js/issues/55167
2023-09-29 13:53:20 +00:00
Lokesh Singh
a623685f44
chore(examples): remove deprecated dependency from with-jest (#56152)
Fixes #56151
Tests added: none
Errors: https://ibb.co/MnTDChy

@testing-library/jest-dom provides its own type definitions

@types/testing-library__jest-dom has been deprecated 
ref: https://www.npmjs.com/package/@types/testing-library__jest-dom
2023-09-29 01:56:09 +00:00
Jonathan Summers-Muir
06705a4815
Chore/update with supabase demo deploy button (#52483)
### What?

- added correct deploy button urls
  - uses new supabase integration
- updated readme for local development, more clearer instructions
- added opengraph image

### Why?

- old supabase integration is buggy
- readme is more clear for local development

---------

Co-authored-by: Steven Tey <stevensteel97@gmail.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-09-27 17:36:17 -07:00
Mayank
764f6c8ec7
Update dependencies in examples (#55993)
Co-authored-by: Snyk bot <19733683+snyk-bot@users.noreply.github.com>
2023-09-26 22:34:44 +00:00
Ahmed Abdelbaset
379f2d82c2
chore: Remove 'beta.' Subdomain from beta.nextjs.org Links (#55924)
**low-priority chore change**

## What?
This PR removes the 'beta.' prefix from links beginning with it. These links are no longer in beta and are now automatically redirected to their non-beta versions. The change serves as a minor enhancement.
2023-09-26 20:09:21 +00:00
Rishabh Poddar
5cd8e87812
Update to with-supertokens example app (#56035)
Adds cache control headers in the auth middleware to prevent issues with cached tokens being passed in GET API requests.

Co-authored-by: Mihály Lengyel <1129990+porcellus@users.noreply.github.com>
Co-authored-by: Nemi Shah <18233774+nkshah2@users.noreply.github.com>
Co-authored-by: Lee Robinson <9113740+leerob@users.noreply.github.com>
2023-09-26 19:24:27 +00:00
Frederik von Sperling
7102e297d1
example: panda css (#55004)
# Panda CSS example
This example contains a simple implementation of [Panda CSS](https://panda-css.com/). It contains styling for a link made in four different approaches supported by Panda CSS. Refer to the [documentation](https://panda-css.com/docs) for when to use - and how to combine - the different approaches to suit your needs.

## Link examples
-  [Atomic Recipe (CVA)](https://panda-css.com/docs/concepts/recipes#atomic-recipe-or-cva) Create multi-variant atomic styles with a type-safe runtime API.
- [Atomic Style](https://panda-css.com/docs/concepts/writing-styles#atomic-styles) Type-safe reusable atoms with small CSS footprint.
- [Config Recipe](https://panda-css.com/docs/concepts/recipes#config-recipe) Resuable recipes extracted and generated just-in-time.
- [Text Styles](https://panda-css.com/docs/theming/text-styles#defining-text-styles) Global text styles for consistent and legible typography.

## Preview
Preview the example live on [https://example-panda-css.vercel.app/](https://example-panda-css.vercel.app/)

## Motivation
Panda CSS is a CSS-in-JS framework, that support the new era of server components and the rise of the app-directory in Next.js. It is a performant, type-safe, developer friendly framework, which uses modern CSS features. It is heavily inspired by existing frameworks, such as Chakra UI, Vanilla Extract, Stitches and Tailwind.

More on [why you should choose Panda CSS](https://panda-css.com/docs/overview/why-panda)
2023-09-26 17:17:49 +00:00
Martyanov Andrey
9e9e366865
docs: pass base headers while setting nonce (#55708)
Example for setting "nonce", when created, clears the passed headers
2023-09-26 15:12:13 +00:00
vinay
c56f9f4ff9
(Example) Update with-opentelemetry example. (#54775)
Updated with new `Metadata` API.


Here in this example there is `legacy.tsx` in `/pages`  folder should i remove it or retain it??
Also in `/pages/legacy.tsx` we have defined `/preact-stars` route but we don't have the corresponding file. 
I have remove `/preact-stars` from `/app/page.tsx` as there is no `/app/preact-stars/page.tsx` in this example.
And `/shared/fetch-github-stars.ts` is fetching only `next.js` stars.

Co-authored-by: Lee Robinson <9113740+leerob@users.noreply.github.com>
2023-09-26 02:56:23 +00:00
Yahya Muhammad
e94868215d
Fix metadata typo in examples/with-jest page (#55994)
Fix typo in `app/rsc/page.tsx`: `const metdata` should be `const metadata`
2023-09-26 02:46:20 +00:00
Lee Robinson
c7ff12b753
docs: update next-forms example (#55927)
A few bits of follow up from my previous PR updating the forms example.
2023-09-25 21:41:14 -05:00
Mayank
82eb6e6f49
chore(examples): bump dependency versions (#55899)
Co-authored-by: Snyk bot <19733683+snyk-bot@users.noreply.github.com>
Co-authored-by: Steven <229881+styfle@users.noreply.github.com>
2023-09-25 16:31:49 +00:00
Balázs Orbán
37b5cea794
chore: NextJS -> Next.js (#55961) 2023-09-25 14:53:11 +00:00
Lee Robinson
5f4238d9fa
docs: useFormState (#55564)
This PR shows how to use a new React hook `useFormState` in the context
of the [Forms and
Mutations](https://nextjs.org/docs/app/building-your-application/data-fetching/forms-and-mutations)
docs. It also updates the forms example (`next-forms`) to show the
recommended patterns for loading / error states.

Related: https://github.com/vercel/next.js/pull/55399
---
Co-authored-by: John Pham <johnphammail@gmail.com>
2023-09-22 16:10:25 -05:00
Mayank
a17c235dc9
Fix/upgrade examples data fetch (#55695)
Co-authored-by: Snyk bot <19733683+snyk-bot@users.noreply.github.com>
2023-09-21 16:15:41 +00:00
Mayank
563019f79c
Fix/upgrade examples with clerk (#55676)
Co-authored-by: Snyk bot <19733683+snyk-bot@users.noreply.github.com>
2023-09-20 20:28:35 +00:00
Mayank
5591abe7ad
chore(examples): upgrade next-translate dependencies (#55637)
Snyk has created this PR to upgrade next from 13.4.7 to 13.4.19.

See this package in npm:
https://www.npmjs.com/package/next

See this project in Snyk:

https://app.snyk.io/org/mayank1513/project/e72076fc-8d2c-4d92-ac05-133865d727f0?utm_source=github&utm_medium=referral&page=upgrade-pr

<!-- 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: snyk-bot <snyk-bot@snyk.io>
Co-authored-by: Balázs Orbán <info@balazsorban.com>
2023-09-20 10:22:40 +02:00
Mayank
1afc38933f
fix: examples/with-grafbase/package.json to reduce vulnerabilities (#55593)
The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-JS-GRAPHQL-5905181


Co-authored-by: snyk-bot <snyk-bot@snyk.io>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-09-19 14:46:12 -04:00
Mayank
2815c6fc2b
fix: examples/with-fauna/package.json to reduce vulnerabilities (#55594)
The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-JS-GRAPHQL-5905181




Co-authored-by: Snyk bot <19733683+snyk-bot@users.noreply.github.com>
2023-09-19 18:32:46 +00:00
Matt Hooper
b5beb3a968
Correct spelling in playwright docs (#55557) 2023-09-18 22:59:01 +00:00
Alejandro Roigé
4c6d4b35b4
Type Error on Event Type payment_intent webhook (#55493)
changed` failed `for `payment_failed` on line 45

### What?
Error in line 45 on type of payment_intent

### Why?
Example provided does not work 

### How?
Added 'payment_'
2023-09-18 20:15:42 +00:00
Kevin
d420233ec2
Hotfix for missing application/json header in Prepr example (#55517)
I added the application/json header to the API lib of the Prepr example.
Because without it when statically generating an error is produced by
GraphQL.

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-09-18 09:33:26 -04:00
Mayank
9adddc27aa
fix: examples/cms-keystonejs-embedded/package.json to reduce vulnerabilities (#55354)
The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-JS-PROMPTS-1729737
- https://snyk.io/vuln/SNYK-JS-SHELLQUOTE-1766506
- https://snyk.io/vuln/SNYK-JS-TAR-1579152
- https://snyk.io/vuln/SNYK-JS-TAR-1579155




Co-authored-by: Snyk bot <19733683+snyk-bot@users.noreply.github.com>
2023-09-14 19:31:03 +00:00
lijianan
cb5e75d97b
example: fix example error (#54599)
example: fix example error
2023-09-14 15:09:05 -04:00
Mayank
84b1e7e6b4
fix: upgrade @emotion/css from 11.10.0 to 11.11.2 (#55352)
upgrade @emotion/css from 11.10.0 to 11.11.2.



Co-authored-by: Snyk bot <19733683+snyk-bot@users.noreply.github.com>
2023-09-14 13:34:47 +00:00
Will Binns-Smith
17ba84b7a7
WEB-1135: Update examples and schema for Turbopack loaders config change (#54584)
This addresses inconsistencies with existing examples and config schema
from changes in #49535.


Closes WEB-1451
2023-09-14 14:50:02 +02:00
Michael Novotny
fe797c1074
Updates Mozilla links to not include language preference (#55326)
Internal suggestion to remove `en-US` from Mozilla urls since MDN is
available in multiple languages nowadays it will automatically redirect
to the viewer’s language preference.

Closes
[DX-2076](https://linear.app/vercel/issue/DX-2076/make-external-mozilla-links-language-agnostic-in-nextjs-docs)
2023-09-13 11:06:29 -05:00
Mayank
546bd28c00
fix: upgrade react-native-web from 0.11.7 to 0.19.7 (#55221)
upgrade react-native-web from 0.11.7 to 0.19.7.




Co-authored-by: Snyk bot <19733683+snyk-bot@users.noreply.github.com>
2023-09-12 19:36:33 +00:00
Mayank
9f852403f0
fix: upgrade sharp from 0.29.3 to 0.32.5 (#55254)
upgrade sharp from 0.29.3 to 0.32.5.

Fix Remote Code Execution (RCE)
[SNYK-JS-SHARP-2848109](https://snyk.io/vuln/SNYK-JS-SHARP-2848109)




Co-authored-by: Snyk bot <19733683+snyk-bot@users.noreply.github.com>
2023-09-12 15:38:10 +00:00
Mayank
c91e6609bf
fix: upgrade date-fns from 2.28.0 to 2.30.0 (#55274)
to upgrade date-fns from 2.28.0 to 2.30.0.



Co-authored-by: Snyk bot <19733683+snyk-bot@users.noreply.github.com>
2023-09-12 15:26:49 +00:00
Mayank
80654c1e30
chore(examples): upgrade @keystone-next/keystone (#55210)
…ilities

The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-JS-PROMPTS-1729737
- https://snyk.io/vuln/SNYK-JS-SHELLQUOTE-1766506
- https://snyk.io/vuln/SNYK-JS-TAR-1579147
- https://snyk.io/vuln/SNYK-JS-TAR-1579152
- https://snyk.io/vuln/SNYK-JS-TAR-1579155




Co-authored-by: Snyk bot <19733683+snyk-bot@users.noreply.github.com>
2023-09-11 14:02:20 +00:00
Mayank
31f28287bf
fix: upgrade recoil from 0.7.6 to 0.7.7 (#55222)
upgrade recoil from 0.7.6 to 0.7.7

Co-authored-by: snyk-bot <snyk-bot@snyk.io>
Co-authored-by: Steven <steven@ceriously.com>
2023-09-11 09:56:43 -04:00
Mayank
1097ab279a
examples: update KeystoneJS version (#55201)
…ilities

The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-JS-APOLLOSERVERCORE-2928764
- https://snyk.io/vuln/SNYK-JS-LOADERUTILS-3042992
- https://snyk.io/vuln/SNYK-JS-LOADERUTILS-3043105
- https://snyk.io/vuln/SNYK-JS-LOADERUTILS-3105943
- https://snyk.io/vuln/SNYK-JS-NEXT-1540422
- https://snyk.io/vuln/SNYK-JS-NEXT-1577139
- https://snyk.io/vuln/SNYK-JS-NEXT-2405694
- https://snyk.io/vuln/SNYK-JS-NODEFETCH-2342118
- https://snyk.io/vuln/SNYK-JS-SHELLQUOTE-1766506




Co-authored-by: Snyk bot <19733683+snyk-bot@users.noreply.github.com>
2023-09-10 19:41:51 +00:00
Mayank
606c73a548
examples: upgrade @makeswift/runtime from 0.2.2 to 0.10.13 (#55203)
Snyk has created this PR to upgrade @makeswift/runtime from 0.2.2 to 0.10.13.




Co-authored-by: Snyk bot <19733683+snyk-bot@users.noreply.github.com>
2023-09-10 19:39:18 +00:00
Mayank
0f212096f6
Fix/security (#55189)
Update to fix vulnerability in @builder.io/react@1.1.52 

Co-authored-by: Snyk bot <19733683+snyk-bot@users.noreply.github.com>
2023-09-10 13:01:27 +00:00
Lee Robinson
12252c2711
examples: Update strict-csp example with better nonce (#55131)
Follow up to https://github.com/vercel/next.js/pull/55039.
2023-09-08 05:12:22 +00:00
Lee Robinson
7a256e657b
Update Jest and Vitest example for App Router. (#54989)
Building off https://github.com/vercel/next.js/pull/54891, updates the `with-jest` and `with-vitest` examples with updated packages and App Router tests.
2023-09-05 13:31:47 +00:00
Sander
be3a7e471b
chore: upgrade playwright example (#53584)
Co-authored-by: Balázs Orbán <18369201+balazsorban44@users.noreply.github.com>
2023-09-04 00:26:08 +00:00
Tito
95e33c4dd2
Fix: slug type issue (#54616)
Failure at build time because - Type error: Argument of type 'string | null' is not assignable to parameter of type 'string'.
2023-09-04 00:23:38 +00:00
Okoye Charles
53d6da6cc6
fix: Fix grammar issues on README.md (#54921)
In this PR resolved the grammatical error on the [README.md](https://github.com/vercel/next.js/blob/canary/examples/with-passport-and-next-connect/README.md)

Fixes #54919
2023-09-02 15:10:37 +00:00
Lee Robinson
5eea161d8b
docs: Add docs on CSP and nonce generation (#54601)
There's been some confusion on the correct way to add a `nonce`, so took the opportunity here to:

- Add a new docs page for Content Security Policy
- Explained how to generate a `nonce` with Middleware
- Showed how to consume the `nonce` in a route with `headers`
- Updated the `with-strict-csp` example
- Update the `nonce` error message page
- Backlinked to the new page in a few places in the docs
2023-09-01 22:13:49 +00:00
Mert Can Altın
469c799c00
fix: fixed grammar error in the code comment (#54902)
hello I tried to solve issue #54857
2023-09-01 19:42:54 +00:00
Rui Ying
49a891deb5
Fix the prerender cache update error with the example Dockerfile (#54870)
It seems the app router attempts to write its cache to both `.next/cache` and `.next/server` in docker.

This fix should fix standalone output server's error `Failed to update prerender cache... [Error: EACCES: permission denied...` when deployed in a docker container with the example Dockerfile.

Related discussion: https://github.com/vercel/next.js/discussions/51164
2023-09-01 17:19:13 +00:00
Elijah Ohiwerei
7e76c353b3
feat(examples): Migrate 'with-mongoose' example to TypeScript with total type safety (#53603)
### What?
I kindly request the maintainers to review this Pull Request, which aims to migrate the `with-mongoose` example to TypeScript with total type safety.

### Why?
By doing so, we enhance the overall quality and maintainability of the example, aligning it with modern best practices for type-safe codebases.

### How?
I have thoroughly tested the changes to ensure they do not introduce regressions and maintain compatibility with the existing codebase.



Co-authored-by: Balázs Orbán <18369201+balazsorban44@users.noreply.github.com>
2023-09-01 14:34:13 +00:00
Jonathan Steele
acbbf14a49
example: Add elements.update() to ensure latest payment amount is reflected (#54848)
### What?
In the Payment Element demo, call
[`elements.update()`](https://stripe.com/docs/js/elements_object/update)
when the payment amount value is updated via slider. This ensures
wallets (Apple Pay, Google Pay) display the correct payment amount.

---------

Co-authored-by: Michael Novotny <manovotny@gmail.com>
2023-08-31 15:53:41 -05:00
Mayank
7b54e954c2
update dependencies (#53334)
### 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

### What?
Updated dependencies to latest for Sentry example.

### Why?
Remove tech debt
2023-08-31 15:47:14 +00:00
Luke Bussey
1aab5ee915
(Example) Update with-segment-analytics to use segmentio/analytics-next and app layout (#52327)
The
[with-segment-analytics](https://github.com/vercel/next.js/blob/canary/examples/with-segment-analytics)
example is out of date so this PR updates it to use
[segmentio/analytics-next](https://github.com/segmentio/analytics-next)
with TypeScript and the app layout.

---------

Co-authored-by: Lee Robinson <me@leerob.io>
2023-08-30 13:04:38 -05:00
Steven Tey
989233eba3
updated sitecore deploy button (#54678) 2023-08-28 17:59:53 +00:00
Alex Hawley
c1b753c795
(Example) Add CMS Sitecore XM Cloud Example (#54535)
### What?

This PR adds the `cms-sitecore-xmcloud` example.

Sitecore XM Cloud is a headless CMS platform that empowers content editors to manage content, layout, and structural aspects of web pages. The Sitecore JSS framework connects frontend JavaScript applications to the XM Cloud API, allowing retrieval of content and presentation layout information.

Sitecore JSS for Next.js integrates Next.js with Sitecore JSS, offering a structured approach to connect a Next.js application to XM Cloud. The `cms-sitecore-xmcloud` example, derived from the Sitecore JSS initializer, showcases the frontend application exclusively, omitting backend implementation details.

### Why?

While Sitecore offers detailed documentation for creating XM Cloud projects and JSS applications, existing starter templates often combine frontend and backend configurations. The `cms-sitecore-xmcloud` example focuses solely on the frontend application and includes environment variable examples to establish a connection with XM Cloud, eliminating the need for a .NET-compatible machine.

### How?

For comprehensive guidance on setting up an XM Cloud site and JSS application, refer to Sitecore and Vercel documentation. The `cms-sitecore-xmcloud` example is created using the Sitecore JSS initializer, integrating Next.js and SXA (Sitecore Experience Accelerator) add-ons. Further documentation can be found at:

- [Deploying to Vercel](https://doc.sitecore.com/xmc/en/developers/xm-cloud/walkthrough--deploying-your-front-end-application-to-vercel.html)
- [Documentation (Experience Platform)](https://doc.sitecore.com/xp/en/developers/hd/210/sitecore-headless-development/sitecore-javascript-rendering-sdk--jss--for-next-js.html)
- [Documentation (XM Cloud)](https://doc.sitecore.com/xmc/en/developers/xm-cloud/sitecore-javascript-rendering-sdk--jss--for-next-js.html)
- [Documentation (Create an XM Cloud project from a starter template)](https://doc.sitecore.com/xmc/en/developers/xm-cloud/create-an-xm-cloud-project-from-a-starter-template-in-the-xm-cloud-deploy-app.html)


Co-authored-by: Steven Tey <28986134+steven-tey@users.noreply.github.com>
Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2023-08-27 01:27:38 +00:00
Lee Robinson
b048d7eee2
docs: Forms and mutations (#54314)
This PR is a larger change to documentation to make the following
updates:

- Deconstructs [Server
Actions](https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions)
into "Forms and Mutations" and an API reference
- Removes content in place of future React API documentation pages
- Removes outdated [Building
Forms](https://nextjs.org/docs/pages/building-your-application/data-fetching/building-forms)
docs from the Pages Router and adds conditional content for both routes
in "Forms and Mutations"
- Adds TypeScript code blocks to API Routes page, recommends Route
Handlers for isomorphic signatures.
- Updates `revalidatePath` and `revalidateTag` docs to have a Server
Actions example.

---------

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2023-08-25 14:31:11 -05:00
Mohamed A. Salah
b7eb6d43b9
set hostname to 0.0.0.0 (#54342)
When I try to deploy to Google Cloud Run it fails after some
investigation I saw this line in

.next/standalone/server.js
```javascript
const hostname = process.env.HOSTNAME || 'localhost'
``` 
This some how make this log when i run docker 
```shell
- ready started server on 172.17.0.2:3000, url: http://172.17.0.2:3000
``` 
I don't know why it's logging this address even if the server running on
localhost.

So this my fix
Set hostname to 0.0.0.0 to avoid deployment failing on Google cloud run.
2023-08-21 19:05:57 +02:00
Lee Robinson
0718aec93b
Update Contentful example for App Router. (#54205)
This PR updates the `cms-contentful` example to use:

- App Router
- TypeScript
- Draft Mode (previously Preview Mode)
- ISR / Data Cache (revalidations through `revalidateTag`)

Further, it combines many separate files into more manageable single files, and tries to better bucket provider-specific logic into the `lib/` folder. I'm hoping this can be the foundation for re-writing the rest of the `cms-*` examples to use App Router.

Overall, the code is much easier to reason about IMO. Pretty happy with the change. I sprinkled some `any`'s throughout here, but if someone wants to make it better, go for it! 

https://app-router-contentful.vercel.app/
2023-08-21 13:21:37 +00:00
Tim Neutkens
d60690e2bd
Update Docker example to remove HOSTNAME (#54102)
With the latest changes in stable Next.js setting HOSTNAME is not longer required for the image to function correctly 👍 

Fixes #54093
2023-08-16 10:08:38 +00:00
Tim Neutkens
c9fef184fd
Revert "Move USER and remove redundant --chown from Dockerfile (#53441)" (#54046)
This reverts commit 39c06ae95e.

Based on
https://github.com/vercel/next.js/pull/53441#pullrequestreview-1578047015

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

-->
2023-08-15 10:37:17 +02:00
Jiachi Liu
3f83743a6e
Make next a devDependency of @next/third-parties package (#53996)
ensure `next` is the dependency of third-parties package so turbo will
build next first then `@next/third-parties` to avoid type failing

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-08-14 08:55:57 -07:00
Rishabh Poddar
dd00229e03
examples: Update with-supertokens example app (#53434)
Co-authored-by: Lee Robinson <me@leerob.io>
2023-08-14 10:09:36 -05:00
Tim
fa88095f44
examples: Update Example Prepr CMS (#49224)
Co-authored-by: Kevintjuhz <kevin@kqcreations.com>
Co-authored-by: Kevintjuhz <k.quaedvlieg@outlook.com>
Co-authored-by: Lee Robinson <me@leerob.io>
2023-08-14 07:13:50 -05:00
Artur Bień
e0ca2ba544
feat(image): DataURL placeholder support for <Image /> (#53442)
Adds support for base64-encoded `placeholder`. Enables using placeholders without the "blur" effect.

Fixes #47639
- [x] Add support for DataURL placeholder
- [x] Add tests
- [x] Update docs

Co-authored-by: Steven <229881+styfle@users.noreply.github.com>
2023-08-11 23:45:20 +00:00
Steven
87301834b3
chore: add light/dark mode theme detection to image component example (#53760)
This PR adds documentation for light/dark mode detection with `next/image`.

In the future, we could also document the picture solution once https://github.com/vercel/next.js/pull/51205 goes stable (although some of the preloading would not be possible).

* x-ref: https://twitter.com/victorbayas/status/1688596439704780822
2023-08-09 14:55:42 +00:00
Dingan(Will) Wang
5cfb936edd
Fix example/with-material-ui broken links (#53707)
Fixed the example/with-material-ui broken links.

It seems the external websites got updated.
2023-08-08 22:37:41 +00:00
vinay
c669c383a0
(example) update github-pages example (#52168)
Removed `appDir: true` from experimental flag and code refactor.

Co-authored-by: Steven <229881+styfle@users.noreply.github.com>
2023-08-07 22:35:06 +00:00