Commit graph

24 commits

Author SHA1 Message Date
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
Luc Leray
f52955ec94
Clean up examples package.json (#27121)
Clean up package.json files in the `examples` directory:
- Add `private: true`
- Remove `version` (because they are irrelevant for packages that are not meant to be published)
- Remove `name` (because they are optional for packages that are not meant to be published, and when someone clones an example, they often rename it and the property becomes stale)
- Remove `author`
- Remove `description`
- Remove `license`

Also remove `with-dynamic-app-layout` example completely, since it does the same as `layout-component` (https://github.com/vercel/next.js/pull/27121#discussion_r668178408).

## Documentation / Examples

- [x] Make sure the linting passes
2021-07-12 19:58:03 +00:00
Nick Babcock
5629223407
Update examples to use React 17 (#26133)
[With next 11 requiring react 17](https://nextjs.org/blog/next-11#upgrade-guide), most of the examples
need to be updated, so the following snippet updated all the examples to
a compatible react version.

```bash
cd examples/
fd -g 'package.json' | xargs sed -r -i 's/"react": ".*"/"react": "^17.0.2"/
fd -g 'package.json' | xargs sed -r -i 's/"react-dom": ".*"/"react-dom": "^17.0.2"/'

# exclude experimental react version
git checkout with-reason-relay/package.json
```
2021-06-16 16:43:26 +00:00
toyamarinyon
fac02d8544
Follow the breaking change of jest-config (#26082)
## Documentation / Examples

When I create a new application using Next.js and use `jest` or `react-testing-library`, I get the following error.
```
The error below may be caused by using the wrong test environment, see https://jestjs.io/docs/configuration#testenvironment-string.
    Consider using the "jsdom" test environment.
    
    ReferenceError: document is not defined
```
This is because `jest-config` changed the default testing environment to node in 27.0.
> `jest-config@27.0.0` default to Node testing environment instead of browser (JSDOM) (#9874)


Raised the jest version of `with-typescript-eslint-jest` to 27.0 to make it pass the test.

- [x] Make sure the linting passes
2021-06-16 15:51:58 +00:00
Dominic Elm
d2caaeab64
docs: add 'Open in StackBlitz' buttons to various examples (#25853)
This PR adds a `Preview` section and a `Open in StackBlitz` button to various examples. I have tested all examples and omitted the ones that require third party API keys, or didn't work. Some examples don't work locally either.

Here's an example:
![image](https://user-images.githubusercontent.com/12571019/121027783-88971280-c7a7-11eb-851a-0ad30cf74b42.png)

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added

## 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
- [x] Examples updated
- [ ] Telemetry added. In case of a feature if it's used or not.

## Documentation / Examples

- [x] Make sure the linting passes
2021-06-08 20:45:02 +00:00
Rostyslav Sipakov
4e9c5eeae0
Fix typescript-eslint-jest example to remove Prettier package causing errors (#22452)
Delete "prettier/@typescript-eslint" from .eslintrc.json. 

After update to the last version I getting this error on running lint: ESLint couldn't find the config "prettier/@typescript-eslint" to extend from. 
I explore this issue https://github.com/prettier/eslint-config-prettier/pull/175 and I think those extensions aren't needed anymore.
2021-03-01 02:43:23 +00:00
Kazutaka NAKAMURA
5d5862693f
Upgrade packages for example/with-typescript-eslint-jest (#21963) 2021-02-08 21:08:26 -06:00
Kazutaka NAKAMURA
a98ba4c808
Update react to 17.0.1 in example/with-typescript-eslint-jest (#21870)
I met following warning message after invoking create-next-app for ` example/with-typescript-eslint-jest `:

```
 % yarn dev
yarn run v1.22.10
$ next dev
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
warn  - React 17.0.1 or newer will be required to leverage all of the upcoming features in Next.js 11. Read more: https://err.sh/next.js/react-version
event - compiled successfully
```

I have followed the instructions in the link, and this patch is. Please merge this.

Thank you for reading.
2021-02-04 20:13:57 +00:00
Lee Robinson
5a73859fe8
Update docs and Create Next App to use API Middlewares by default. (#21639) 2021-01-28 23:34:03 +00:00
Kazutaka NAKAMURA
07d4af9307
suppressing eslint warning (#21163) 2021-01-26 10:22:43 -05:00
Luis Alvarez D
e28fd50441
Include utm_source on example links to vercel.com (#21305) 2021-01-19 07:28:54 +00:00
Luc Leray
8eaabe2fb0
Fix deploy buttons URLs (#20834)
Fix all deploy button URLs in the Next.js repo to follow the following format:
```
https://vercel.com/new/git/external?repository-url=https://github.com/vercel/next.js/tree/canary/examples/<EXAMPLE_NAME>&project-name=<EXAMPLE_NAME>&repository-name=<EXAMPLE_NAME>
```

The detailed docs for the Deploy Button can be found here: https://vercel.com/docs/more/deploy-button.

Also updates legacy Vercel import flow URLs (starting with vercel.com/import or with vercel.com/new/project), to use the new vercel.com/new URLs.

---

For example, for the `hello-world` example:

The URL is https://vercel.com/new/git/external?repository-url=https://github.com/vercel/next.js/tree/canary/examples/hello-world&project-name=hello-world&repository-name=hello-world

And the deploy button looks like this:
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/git/external?repository-url=https://github.com/vercel/next.js/tree/canary/examples/hello-world&project-name=hello-world&repository-name=hello-world)

---

For reference, I used the following regexes to search for the incorrect URLs

```
\(https://vercel.com/import/git\?s=https://github.com/vercel/next.js/tree/canary/examples/(.*)\)
\(https://vercel.com/import/git\?c=1&s=https://github.com/vercel/next.js/tree/canary/examples/([^&]*)(.*)\)
\(https://vercel.com/import/project\?template=https://github.com/vercel/next.js/tree/canary/examples/(.*)\)
https://vercel.com/import/git
https://vercel.com/import/select-scope
https://vercel.com/import
https://vercel.com/new/project
```
2021-01-07 01:40:29 +00:00
Kanitkorn Sujautra
6de34e7557
Add missing dependency to with-typescript-eslint-jest (#17864)
In `with-typescript-eslint-jest` example, `identity-obj-proxy` is being used here, but it's not in `package.json` yet.
5b1be2bb98/examples/with-typescript-eslint-jest/jest.config.js (L14)

This PR adds `identity-obj-proxy` to `package.json`.
2020-11-11 00:14:03 +00:00
Quinn Turner
6d4395f22c
fix: Order moduleFileExtensions left-to-right (#18328)
Order moduleFileExtensions from most used to least used extensions.

Sources: https://jestjs.io/docs/en/configuration#modulefileextensions-arraystring
and facebook/jest#7616
2020-10-27 20:20:03 +00:00
Devin Ekadeni
4f1ccda5bd
[Example] With TS Eslint Jest - unnecessary package (#17170)
As mentioned in [here](https://www.npmjs.com/package/@types/testing-library__react), the package has been deprecated and not necessary to be installed.
By removing this from `package.json` will give other devs have more understanding when learning typescript with eslint and jest about what need to be installed on the project.
2020-09-21 03:06:21 +00:00
Jens Meindertsma
a3c47721a1
Include all files in Prettier (#17050)
This uses the "Expand directories" feature introduces in Prettier 2.0 to automatically format all supported file types.

Also, I fixed some badly formatted files.
2020-09-14 02:53:19 +00:00
Piotr Zarycki
6935a93868
Fix extension name for example app (#16906) (#16916)
Fixes: https://github.com/vercel/next.js/issues/16906
2020-09-08 07:21:52 +00:00
NorbertLuszkiewicz
c03d4931de
Simplify example usage instructions (#16678)
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-08-29 22:22:02 -04:00
Tanmay Laud
f00ad581a1
Added .gitignore to examples that are deployed to vercel (#15127)
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-07-16 10:52:23 -04:00
Midnight
987d29a5b4
fixed prettier --write args in package.json (#15187)
prettier --write **/*.{js,ts,tsx} does not work as intended, it never does traverse all files with js,ts,tsx extension. For it to work as intended, extension args should be wrapped in quotes like this "**/*.{js,ts,tsx}"
2020-07-15 14:39:27 +00:00
Simon Goldin
c61fd50419
update test snapshot in with-typescript-eslint-jest (#13847)
Updating snapshot for https://github.com/vercel/next.js/pull/13732 where the `toMatchSnapshot` expectation moved to another test.
2020-06-07 23:54:16 +00:00
Filipe Marins
42140bd1d8
Update test description of with typescript eslint jest example (#13732)
The tests was with description changed
2020-06-03 21:43:53 +00:00
Joe Haddad
b7e17e09e5
Update references to zeit/next.js (#13463) 2020-05-27 17:51:11 -04:00
Erik
268d3572bc
[examples] with-ts-eslint-jest example app (#12025)
* set up with-ts-eslint-jest example app

* eslint ignore new app bc it has a conflicting eslintrc

* make eslint + husky setup manual

* clarify app README setup notes

* move page tests out of pages/ dir

* Simplifying configs

* extend "prettier"

* format fix

* Updated rules

* Added husky configs and removed debug option

* Removed notes and configuration

* Updated pages

* Added links to readme

* Added example to .prettierignore

* Updated snap

* Make the lint work

Co-authored-by: Luis Alvarez D <luis@vercel.com>
2020-05-25 13:16:06 -05:00