Commit graph

23 commits

Author SHA1 Message Date
Yamagishi Kazutoshi
32f0c9a403
Support ESLint v8 (#29865)
Co-authored-by: Michaël De Boey <info@michaeldeboey.be>
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2021-11-16 10:18:27 +01:00
Oscar Busk
718003c8a7
Add incremental to template/tsconfig.json to avoid changes on first build (#30357)
I used `create-next-app` to create a new fancy Next 12 app, ran `yarn build` and got a git diff. The tsconfig.json had a `incremental` added by next. Just running build shouldn't need I have uncommitted changes.
2021-10-27 03:11:45 +00:00
Seraphina Orsini
c78d8fad19
Pin create-next-app to eslint@v7 (#29837)
Fixes https://github.com/vercel/next.js/issues/29770

## Description

Pins `eslint` to `v7`. This avoids issues with `v8` from both [changes to the public api](https://eslint.org/docs/8.0.0/user-guide/migrating-to-8.0.0#the-lib-entrypoint-has-been-removed) and [lack of support from rushstack](https://github.com/microsoft/rushstack/issues/2890). See https://github.com/vercel/next.js/issues/29770#issuecomment-940636627 for slightly more detail. 

Local testing showed output of next app correctly pinned to `v7`. 

<img width="495" alt="Screen Shot 2021-10-12 at 12 31 56 AM" src="https://user-images.githubusercontent.com/29002354/136892312-1571718c-882b-4235-98f4-c1b8d4c72d26.png">


### Bug Checklist

- [X] Related issues linked using `fixes #number`
- [ ] Integration tests added
   - Happy to add an integration test for pinning to v7 if we'd like, will need to be updated / removed when v8 is supported. 
- [ ] Errors have helpful link attached, see `contributing.md`
	- No errors to add links for
2021-10-12 16:02:55 +00:00
Tobias Koppers
d78bb6fe46
upgrade to typescript 4.4.3 (#29112)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-09-16 18:06:57 +02:00
Eungyeol
c1dbc12609
Do not have the required package error fix (#28662)
The following error occurred 
when I created a project with the typecript template of createp-next-app 
and did the 'next build'.

```shell
It looks like you're trying to use TypeScript but do not have the required package(s) installed.

Please install @types/node by running:

        yarn add --dev @types/node

If you are not trying to use TypeScript, please remove the tsconfig.json file from your package root (and any TypeScript files in your pages directory).
```

This issue was resolved by adding @types/node.
So I added @types/node to the devDependencies of the create-next-app typecript template.
2021-09-01 02:01:55 +00: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
Houssein Djirdeh
7a1c9eb17e
[ESLint] Introduce a new setup process when next lint is run for the first time (#26584)
This PR introduces an improved developer experience when `next lint` is run for the first time.

### Current behavior

`eslint-config-next` is a required package that must be installed before proceeding with `next lint` or `next build`:

![image](https://user-images.githubusercontent.com/12476932/123468791-43088100-d5c0-11eb-9ad0-5beb80b6c968.png)

Although this has helped many developers start using the new ESLint config, this has also resulted in a few issues:

- Users are required to install the full config (`eslint-config-next`) even if they do not use it or use the Next.js plugin directly (`eslint-plugin-next`).
  - #26348

- There's some confusion  on why `eslint-config-next` needs to be installed or how it should be used instead of `eslint-plugin-next`.
  - #26574
  - #26475
  - #26438

### New behavior

Instead of enforcing `eslint-config-next` as a required package, this PR prompts the user by asking what config they would like to start. This happens when `next lint` is run for the first time **and** if no ESLint configuration is detected in the application.

<img src="https://user-images.githubusercontent.com/12476932/124331177-e1668a80-db5c-11eb-8915-38d3dc20f5d4.gif" width="800" />

- The CLI will take care of installing `eslint` or `eslint-config-next` if either is not already installed
- Users now have the option to choose between a strict configuration (`next/core-web-vitals`) or just the base configuration (`next`)
- For users that decide to create their own ESLint configuration, or already have an existing one, **installing `eslint-config-next` will not be a requirement for `next lint` or `next build` to run**. A warning message will just show if the Next.js ESLint plugin is not detected in an ESLint config. 

  <img width="682" alt="Screen Shot 2021-06-25 at 3 02 12 PM" src="https://user-images.githubusercontent.com/12476932/123473329-6cc4a680-d5c6-11eb-9a57-d5c0b89a2732.png">

---

In addition, this PR also:

- Fixes #26348
- Updates documentation to make it more clear what approach to take for new and existing ESLint configurations
2021-08-04 21:53:15 +00:00
Anindya Dey
caca389cc1
fix error message during create-next-app (#26980)
Fixes [issue #19588](https://github.com/vercel/next.js/issues/19588)

Here's a screenshot of the error message:
![image](https://user-images.githubusercontent.com/30517208/124733436-d1babd80-df31-11eb-96e4-513505ba07a0.png)
2021-07-07 11:12:58 +00:00
Tim Neutkens
de08b1fff1
Remove unsupported examples (#26075)
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-06-14 20:27:06 +02:00
Houssein Djirdeh
bbc28ccae0
next lint + ESLint in Create Next App (#25064)
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: Tim Neutkens <timneutkens@me.com>
2021-06-03 14:01:24 +02:00
James George
9b27d31d36
chore(create-next-app): remove stub type definitions (#25139)
[@types/next](https://www.npmjs.com/package/@types/next) is a stub types definition.
2021-05-16 05:29:50 +00:00
C. Lewis
9c77cda6c5
feat(create-next-app): add --ts, --typescript support (#24655)
Co-authored-by: Tim Neutkens <timneutkens@me.com>
2021-05-07 10:08:16 +02:00
matamatanot
0226e7872a
CNA: Add warning about permission (#14889)
close #14744

<img width="851" alt="screen_shot" src="https://user-images.githubusercontent.com/39780486/86603491-06bec800-bfdf-11ea-9928-ee85cbad86a7.png">


I have some concerns.

- `import { isWriteable } from '../next/build/is-writeable'` **not** from `create-next-app ` package.
- The warning sentence is from npm. Not for Next.js. I'm not a native English speaker. I'd like to know the natural expression for this.
2020-08-19 17:09:34 +00:00
Cristian Dominguez
f4f6fea71f
CNA: replace make-dir with core recursive mkdir (#15006)
Fix #14902 

I created a separated helper that wraps `fs.promises.mkdir` and sets `recursive` option to `true` by default.

I'm not sure if this is the right approach (maybe it should just call `fs.promises.mkdir` from `create-app.ts`?), any thoughts?
2020-07-10 01:29:03 +00:00
Joe Haddad
bee8c31b87
Lint for invalid imports (#13482)
This adds a lint rule to ensure we don't import dev dependencies by accident.
2020-05-28 08:23:10 +00:00
Marco Moretti
b3e45fab5e
feat(cli): use default template when GH is offline (#12194)
fix #12136 

I add a prompt if there is an error when trying to download example files.
Maybe could be better to add an error class and in create-app.ts on every "console.error" trow a new Exception and manage it in catch. What you think ? 👯
2020-05-26 16:39:18 +00:00
Joe Haddad
86160a5190
Upgrade to Prettier 2 (#13061) 2020-05-18 15:24:37 -04:00
Maxi Gimenez
ce830af202
chore(create-next-app): add missing types (#12691) 2020-05-10 17:51:47 -04:00
Brandon Duffany
1fbd20dc37
Allow top-level GitHub repo URLs as examples (#11691)
* Support top-level GitHub repo URLs

Adds support for top-level GitHub repo URLs, e.g.
https://github.com/username/my-cool-next-example.

This is already possible, but you have to enter "/tree/master" (or the
desired branch name) after the repo URL.

The change itself simply expands that URL to
https://github.com/username/cool-next-example/tree/$DEFAULT_BRANCH_NAME
where DEFAULT_BRANCH_NAME is the default branch configured for the repo
in GitHub.

* Fix formatting issues
2020-04-06 15:57:19 +02:00
Luis Alvarez D
75559f1431
Add --example=<github-url> to create-next-app (#10226)
* Initial support for URLs

* Added folder support

* Added --example-path

* Bug fix

* Also install deps

* Updated error message

* Bug fix and replace the file path

* Added tests

Co-authored-by: Shu Uesugi <shu@chibicode.com>
2020-02-27 16:32:32 +01:00
Shu Uesugi
9cfc09e3ab
Simplify create-next-app README (#10545)
* Rename to README-template.md

* Add yarn scripts

* Rewrite CNA README

* Forgot zeit link

* Simplify

* Update deploy doc

* Just link to the doc

* page is reloaded

* reload → update

* Deploy updates
2020-02-16 16:00:12 +01:00
Joe Haddad
00badd4d58
Initialize Git repo on app creation (#9376)
* Initialize Git repo on app creation
This PR initializes a Git repository after Create Next App runs.

We ensure the app was not created in an already-existing Git or Mercurial repo.

Failures of setup (no Git installed) do not fail the application bootstrapping.

Closes #9077 (replaces)

* Add test

* Update index.test.js
2019-11-10 21:42:51 -08:00
Joe Haddad
104d18c607
Rewrite Create Next App (#8030)
* Completely rewrite Create Next App

* Sort imports

* Show what package manager is being used

* Fix project name suggestion

* Update tests for new implementation

* Use normal prepublish command for on-install

* Upgrade Node version

* Switch to 8.16

* Disable v8 cache

* Swap out update check package and fix CLI boot
2019-07-19 15:55:30 -04:00