Commit graph

2192 commits

Author SHA1 Message Date
Lee Robinson
dd4215b81e
Update Redux example to use Toolkit + update dependencies. (#29104)
After talking with markerikson, I've made some updates to the Redux examples:

- Updated the `with-redux` example to use the Redux Toolkit + TypeScript example
- Updated dependencies of `with-redux` to work with latest testing setup
- Removed `with-redux-toolkit` in favor of `with-redux`
- Removed `with-redux-toolkit-typescript` in favor of `with-redux`
- Removed `with-redux-code-splitting` in favor of `with-redux`
2021-09-15 15:34:31 +00:00
Houssein Djirdeh
01d3539b04
[Examples] Updates with-google-tag-manager example to use <Script> component (#29061)
Updates the `with-google-tag-manager` to use Next.js' Script component with strategy set to `afterInteractive`

CC @janicklas-ralph 

Closes: https://github.com/vercel/next.js/issues/26507
2021-09-13 17:43:35 +00:00
Oiva Eskola
c78b249c66
Fix falsy values not being returned in post fields (#29011)
I imported a bunch of old markdown posts to the blog-starter example but some of the post metadata was not returned by the API in the example code.

For example, having `published: false` in post metadata was not returned in the item fields.

The problem was in check:
```
if (data[field]) {
  items[field] = data[field]
}
```
This rejects all falsy values in addition to fields that are not set. Checking only for `undefined` should fix this issue.

I didn't find existing integration tests for the blog example nor an issue describing this problem.



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
2021-09-11 14:24:24 +00:00
Rishabh Poddar
60748e3aef
Updates supertokens-node dependency version (#28916)
We update the dependency version to v7.0.0 and make a few code changes to work with the new version
2021-09-09 13:33:50 +00:00
Ismail Ghallou
8921d9115b
chore(examples): switch to Script component on the google analytics example (#27674)
## Documentation / Examples

- [x] Make sure the linting passes

Fixes https://github.com/vercel/next.js/pull/27674
2021-09-08 21:03:23 +00:00
Apurv Chimralwar
429f63dd76
Fix Typo in "with-eslint" Example docs (#28601)
Earlier it was:

```bash
npx create-next-app --example with-eslint with-eslint
# or
yarn create next-app --example with-eslint with-eslint
```

It was confusing for me, 
as i couldn't identify which one is *example-name* and which one is *folder-name* (for *with-eslint*).

I checked other example folders and was able to digest the stuff.
But if a new programmer comes who is not familiar with next/npx,
this could have took some time to understand.

And Hence i modified the cmd it to  the below, for better understanding:

```bash
npx create-next-app --example with-eslint with-eslint-app
# or
yarn create next-app --example with-eslint with-eslint-app
```

## Documentation / Examples

- [X] Make sure the linting passes
2021-09-07 16:36:54 +00:00
Tim
f8fb6c7a57
Examples Prepr CMS update (#28871)
Update models with the latest release and simplifies the read.me.
2021-09-07 15:41:57 +00:00
matcha
6be8a04335
fixes with-typescript-graphql: unable to resolve dependency tree (#28637)
Example `with-typescript-graphql`has unmatched dependency tree in `react-test-renderer` lead to error in #28582, I changed version of `react-test-renderer` to `^17.0.1` and fix that issue.

Closes https://github.com/vercel/next.js/issues/28582
2021-09-07 15:26:32 +00:00
Anderson Leite
a54b4ed0c5
Updates @react-three/drei version and other dependencies. (#28755)
Updating @react-three/drei from 4.x to 7.x

I was having problems using this example and realized that it was caused by the "old" version of the lib.
Also updating @react-three/fiber and next to latest. 

## Documentation / Examples

- [x] Make sure the linting passes
2021-09-07 14:02:05 +00:00
Rob Easthope
e0b384929c
with-stitches example fixes #28650 (#28652)
The with-stitches example is broken presumably due to changes in the Stitches API now that it's hit `1.0.0`. I've created an issue already: #28650 

I've made three small changes:
- Replaced the createCss function in `stitcheds.config.js` with createStitches
- Replaced the getCssString function with getCssText  in `stitches.config.js` and `pages/_documents.jsx`
- Bumped `@stitches/react` to `^1.0.0` 🎉

I've left the rest of the example code alone as I'm still exploring the library after seeing yesterdays release annoucement.

@peduarte Is there anything else that needs to updated?
2021-09-07 02:14:32 +00:00
Knut Melvær
36d922fbda
Add apiVersion to config (#28610)
The client now warns against missing `apiVersion` ([docs](https://www.sanity.io/docs/api-versioning)). This PR adds the config for using the latest API version. There shouldn't be breaking changes in this app.



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes
2021-08-30 17:37:13 +00:00
Ado Kukic
220fa9cd14
Update to use the latest MongoDB best practices to limit connection pooling issues. (#28350)
* Update to use the latest MongoDB best practices.

* lint-fix

Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: jj@jjsweb.site <jj@jjsweb.site>
2021-08-25 12:52:12 -05:00
Hunter Tunnicliff
877f982924
Use recommended pattern in testing example (#28404)
* Use recommended pattern in testing example

Since the official linter for testing library, `eslint-plugin-testing-library` recommends using `screen` to write queries, this MR updates the testing library example to follow the pattern recommended by the linter.

> DOM Testing Library (and other Testing Library frameworks built on top of it) exports a screen object which has every query (and a debug method). This works better with autocomplete and makes each test a little simpler to write and maintain.

> This rule aims to force writing tests using built-in queries directly from screen object rather than destructuring them from render result. Given the screen component does not expose utility methods such as rerender() or the container property, it is correct to use the render returned value in those scenarios.

See the `prefer-screen-queries` rules docs for more info: https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/prefer-screen-queries.md

* Update devDependencies

* Install and configure test linting

* Use recommended pattern in test

* Update test names for consistency

* Update docs

* Set jest environment in each file

* Use root true in `with-jest` eslint config

* Ensure nested .eslintrcs are not loaded for repo lint

Co-authored-by: jj@jjsweb.site <jj@jjsweb.site>
2021-08-25 12:33:57 -05:00
zhafri-shafiq
74c349daab
Add prop-types in package.json (#28481)
## Bug

- Related issues #28480 

This is just minor dependency fix that I noticed while going through the examples.
2021-08-25 12:53:50 +00:00
Elliot Scribner
f78ebd0895
Fix: changing import syntax slightly to ensure success with create-next-app (#28431)
Just a small change to recently merged PR; for some reason `import couchbase from 'couchbase'` is not working correctly when I use create-next-app to bootstrap with the `with-couchbase` example, despite initially working within my local next.js directory. The wildcard import fixes that issue. Thanks!

## Documentation / Examples

- [x] Make sure the linting passes
2021-08-24 16:48:28 +00:00
Aravind Putrevu
a143bc4662
[examples] Add ElasticSearch example (#28043)
## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [x] Make sure the linting passes
2021-08-24 16:28:11 +00:00
Elliot Scribner
6072afc83a
[examples] Added with-couchbase example (#27184)
This adds a simple `with-couchbase` example app complete with a check for successful connection (in `index.js`).

**Note:** To check the connection, this application runs a simple KV GET operation with a key that does not exist and expects a response of `document not found`. Any other response indicates a failure to connect.

Thank you!
2021-08-24 01:45:25 +00:00
Loren ☺️
29441fb7c4
Add Temporal example (#28348)
## Documentation / Examples

- [x] Make sure the linting passes
2021-08-23 15:41:59 +00:00
hiro
a9c1bd797d
Fixed typos that existed on some files (#28314)
* fix: naviagtion -> navigation

* fix: compatability -> compatibility
2021-08-19 21:54:13 -05:00
JJ Kasper
5544adc481
Update to latest babel versions (#28174) 2021-08-17 09:18:08 +02:00
Aryan Beezadhur
876cbbaf01
Replace CSS tag with JS import (#28143)
Replaces `<link />` tag import with JS import to fix ESLint warning: https://nextjs.org/docs/messages/no-css-tags
2021-08-16 03:01:57 +00:00
Oscar Busk
971b17f1e9
Add ci script to check examples (#28009)
* Add ci script to check examples

* Install moreutils for `sponge` command.

It's not very pretty, but I'm not sure how to replace sponge in a good way in the shell script

* Prettier names in the workflow

* Move "check-examples" into build_test_deploy workflow

* Start breaking the jq script into multiple lines

* Add checks for cleanups in vercel/next.js#27121

* Run the `check-examples.sh` script to cleanup all remaining examples.
2021-08-14 13:34:40 -05:00
Oscar Busk
077097b7f8
Remove licence from all example/package.json that has them (#28007)
* Add licences to all example/package.json that lack them

* Revert "Add licences to all example/package.json that lack them"

This reverts commit 5d4e25012f7334772b8ef5924bc355277e827cba.

* Update check-examples to remove `license` field from examples

* Remove `license` from all examples.

This was mentioned in vercel/next.js#27121 but it looks like it didn't end up being in the merge?

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-08-14 10:48:39 -05:00
Mathis Møller
8a80b0b357
Examples: Jotai (#27940)
## Documentation / Examples

- [X] Make sure the linting passes

This adds an example using Jotai with Next.js. It uses the new hook `useHydrateAtoms` to hydrate atoms with values from the server.
2021-08-14 04:06:49 +00:00
Lee Robinson
c8be62c81d
Update Firebase hosting example to use Node.js 14. (#27988) 2021-08-12 21:46:23 -05:00
Oscar Busk
6403a992e4
Add .gitignore to examples that lack them (#28003)
* Only copy .gitignores to examples that are actual packages.

`custom-server` is just a `.md` redirecting users to the documentation.

* Add .gitignores to examples that lack them
2021-08-12 16:47:14 -05:00
Oscar Busk
25df53d19f
next-env.d.ts note in templates (#27983)
Hello! I was using `npx create-next-app --ts` to quickly bootstrap a basic next.js project with Typescript. It bothered me that I got git diff just from running `npm run build` inside the project, because the new notice in the `next-env.d.ts` file.

![image](https://user-images.githubusercontent.com/13413409/129115266-80e00bf3-78aa-40be-bd0f-a18aaa448a68.png)

So I went ahead and updated the `next-env.d.ts` file in [`packages/create-next-app/templates/typescript`](fb67ce9864/packages/create-next-app/templates/typescript/next-env.d.ts) to be exactly how the file looks after running once. (7417ecc09c)

Then I realized that I could probably do the same for all the `next-env.d.ts` that are spread out in the many examples, to make running those examples after cloning them feel a bit smoother. (fb67ce9864)

> However I skipped the [`with-typescript-graphql`](40f85f6d95/examples/with-typescript-graphql) example since that [`next-env.d.ts`](40f85f6d95/examples/with-typescript-graphql/next-env.d.ts (L4-L9)) actually has changes and I couldn't even run `yarn build` in that example, so I'm not sure what will happen with the `next-env.d.ts`. Someone who _gets_ that example will have to fix it I suppose.
2021-08-12 20:36:53 +00:00
Oscar Busk
69d6001c59
Make sure all example packages has private: true (#28008)
Update the `check-exampels.sh` script to also ensure all examples has `private: true` (763d9979f7)

Update exampels (1) that did not have `private: true` (bcdc4a3ae0)
2021-08-12 16:18:41 +00:00
Delba de Oliveira
97174ac651
Add with-cypress example (#27900)
This PR adds a with-cypress example to match the examples in upcoming docs. 

## Documentation / Examples

- [ ] Make sure the linting passes

**Note:** This PR does not pass linting because ESLint needs to have the [eslint-plugin-cypress](https://github.com/cypress-io/eslint-plugin-cypress) installed globally to ignore the Cypress methods.
2021-08-09 20:57:17 +00:00
Delba de Oliveira
6a32d854fc
Update with-jest example (#27894)
## Documentation / Examples

- [x] Make sure the linting passes

This PR updates our current with-jest example to match the examples in upcoming docs, add module alias configuration and be more consistent with Jest conventions.
2021-08-09 19:04:27 +00:00
Abdullah
c6a08f51b1
fix wrong link in readme (#27802)
## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes
2021-08-05 21:49:33 +00:00
Artyom Kurnikov
8724352b25
Update Fauna example to create Fauna resources properly (#27757)
- fix `with-fauna` example to populate client secret properly when auto-deploy on changes happens
- improve security by avoiding usage of the `FAUNA_ADMIN_KEY` in the application, now it's used in the setup script only
2021-08-04 20:37:12 +00:00
Lee Robinson
28c13bd547
Rename environment variable in Fauna example. (#27712)
To make it more clear you're using the admin key on the server.
2021-08-03 02:40:02 +00:00
Tom Chen
aa929c4bee
Fix create-strapi-app instruction in strapi example (#27707)
Need `--template` in the `yarn` command, otherwise it's not working
2021-08-03 02:08:15 +00:00
Sergio
bace9b4949
Add with-joi example (#25759)
* Add joi and next-joi example

* Add more README information

* Update examples/with-joi/package.json

Co-authored-by: Lee Robinson <me@leerob.io>

* Update all dependencies to latest

Co-authored-by: Lee Robinson <me@leerob.io>
2021-08-02 19:43:07 -05:00
Lee Robinson
3c984dc5cf
Patch with-fauna example. (#27701)
A few things I noticed when deploying the example.
2021-08-02 18:01:26 +00:00
Artyom Kurnikov
fe3f520d8d
Update Fauna example with new guestbook (#27295)
Based on https://github.com/vercel/next.js/pull/26708

- Renames FaunaDB -> Fauna
- Moves to Tailwind instead of bespoke styling
- Use SWR instead of hand-rolled fetch wrapper
- List/Create API for Guestbook
- Preps for setting correct environment variables from Vercel integration
2021-08-02 17:09:04 +00:00
James Howard
2cf58be228
Add missing await for API request (#27676)
`getAllPostsWithSlug` was missing an `await` on `fetchAPI`, resulting
in `data?.allPosts` always returning `undefined`. This meant SSG wasn't
aware of the paths it needed to generate.
2021-08-02 12:59:53 +00:00
Tim van de Vathorst
282ee8c9d0
Added missing 'create user' functionality (#27516)
I was trying to run the demo locally and found out that the create user function was missing, so I added it!

## Documentation / Examples

- [ ✔ ] Make sure the linting passes
2021-07-29 22:16:55 +00:00
JJ Kasper
b0f516db87
Revert "Drop react-is dependency in styled-components example (#27527)" (#27543)
This reverts commit 317c1c4922.
2021-07-27 14:35:56 -05:00
Enzo Ferey
317c1c4922
Drop react-is dependency in styled-components example (#27527)
`react-is` dependency was [dropped](8165cbe994) as part of `styled-components@v5`.

(I don't know which checkbox to check)

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes
2021-07-27 14:26:02 +00:00
shibe23
735fac7ed7
[typo] posts.map( posts => {} ) in examples/blog-starter-typescript (#27523)
In `examples/blog-starter-typescript/pages/posts/[slug].tsx`

before:
 `posts.map(posts => {})`

after:
`posts.map(post => {})`

## Documentation / Examples

- [x] Make sure the linting passes
2021-07-27 04:56:19 +00:00
Mahmoud Abdelwahab
f657e09b53
Fix CORS issue in GraphQL example that prevented Apollo Studio from working (#27486)
Update example so Apollo Studio works properly
2021-07-25 21:47:04 +00:00
Taylor McGann
270559f7be
Auth0 Example: Fix issuer base URL (#27074)
## Documentation / Examples

- [ ] Make sure the linting passes
2021-07-25 05:12:15 +00:00
Mohamed ElSaadany
9cbc4aacd5
Add locale switcher to i18n-routing example (#27444)
* add locale switcher to dynamic GSP page in i18n-routing example

* Apply suggestions from code review

Co-authored-by: JJ Kasper <jj@jjsweb.site>

* Add switcher to other pages as well

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-07-23 14:33:10 -05:00
Aryan Beezadhur
047347a0b4
Rename utils to lib in with-mongodb-mongoose example (#27407)
Rename the `utils` folder to `lib`, and update file imports since other examples favour `lib` over `utils`.
2021-07-22 16:55:47 +00:00
Aryan Beezadhur
f8947b0133
Rename util to lib in with-mongodb example (#27404)
* Rename examples/with-mongodb/util/mongodb.js to examples/with-mongodb/lib/mongodb.js

* Change file import from `util` to `lib`
2021-07-22 11:32:56 -05:00
Mandar Patil
c218347faa
Fixed typo and error when using Auth0 service; (#27383)
* Fixed typo and error when using Auth0 service;

`Allowed Web Origin` on Auth0 is now required to be set to `http://localhost:3000`

* lint-fix


Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-07-21 22:21:36 -05:00
Aryan Beezadhur
1b67dc163d
Examples: Delete as prop from <Link> components (#27359)
`as` prop is no longer required on `next/link` components for dynamic routes
2021-07-20 22:05:20 +00:00
Mahmoud Abdelwahab
c3884e6837
Update graphql example (#27334)
## Documentation / Examples

This is an update to the [GraphQL example](https://github.com/vercel/next.js/tree/canary/examples/api-routes-graphql) to use [apollo server 3](https://www.apollographql.com/docs/apollo-server). This example works with Apollo Studio
2021-07-20 15:19:22 +00:00