This PR updates the docs and examples for `create-next-app` to include pnpm usage.
The following script was used to update every example README:
```js
const fs = require('fs')
const examples = fs.readdirSync('./examples')
for (let example of examples) {
const filename = `./examples/${example}/README.md`
const markdown = fs.readFileSync(filename, 'utf8')
const regex = new RegExp(`^yarn create next-app --example (.*)$`, 'gm')
const output = markdown.replace(regex, (yarn, group) => {
const pnpm = `pnpm create next-app -- --example ${group}`
return `${yarn}\n# or\n${pnpm}`
})
fs.writeFileSync(filename, output)
}
```
There was an `npm` equivalent for `yarn install` (`npm ci`) but not one for `yarn build`. I've added `npm run build` as a commented out option.
## Documentation / Examples
- [x] Make sure the linting passes by running `yarn lint`
* Adding steps to build the app with docker in existing projects (without the need to create the app with the with-docker example)
* Update examples/with-docker/README.md
Fix uppercase
Co-authored-by: Balázs Orbán <info@balazsorban.com>
* lint-fix
Co-authored-by: JJ Kasper <jj@jjsweb.site>
This fixes the comment about disabling telemetry. For now it doesn't disable telemetry for `next build` if you uncomment it.
## 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
* Fix ambiguous flags in Dockerfile example
At least with Docker xx this Dockerfile fails to both `adduser` and `addgroup` commands due to ambiguous flags. The error message for example for `addgroup` is:
```
#5 0.292 Option g is ambiguous (gecos, gid, group)
#5 0.292 Option s is ambiguous (shell, system)
```
This PR switches both commands to use the long-format flags. I think they are also more understandable for the readers of the Dockerfile.
* Apply suggestions from code review
Co-authored-by: Balázs Orbán <info@balazsorban.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: Balázs Orbán <info@balazsorban.com>
Fixed `dockerfile` in `with-docker` example
## Bug
- error when executing `docker build -t nextjs-docker .` - `yarn.lock` file is missing
## Documentation / Examples
- edited to not fail when `package-lock.json` or `yarn.lock` are not found
- example: use `with-docker` example
- [x] Make sure the linting passes by running yarn lint
Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
Update to remove the second `yarn install` step from the docker example as it is no longer needed since we only include necessary files from the output file traces now.
Closes: https://github.com/vercel/next.js/pull/29360
## Documentation / Examples
- [x] Make sure the linting passes by running `yarn lint`
Fixes#29023
## Bug
- [x] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [x] 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
* 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>
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
## 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
- [ ] Telemetry added. In case of a feature if it's used or not.
## Documentation / Examples
- [x] Make sure the linting passes
## 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
- [x] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
## Documentation / Examples
- [x] Make sure the linting passes
* Fix missing yarn.lock
* Add --frozen-lockfile flag to speed up install deps
* Make sure node_modules do not contains devDependencies
* Add --targe stage docker build
* Remove micro example
* Remove page that uses getInitialProps
* Update with-docker example
* Update dynamic import example
* Update Fela example
* Update Flow example
* Update framer motion example
* Remove freactal example
* Remove with-higher-order-component
* Remove with-immutable-redux-wrapper as it shows avenues to performance issues
* Remove example that doesn't have usage
* Update with-kea
* Remove example that is not used
* Update next-page-transitions example
* Remove next-routes example as dynamic routes are supported by default
* Add link to documentation
* Update Overmind example
* Update pretty-url-routing example
* Remove update with low usage
* Update with-react-ga example
* Update React Helmet example
* Remove mobile-detect from carousel example
* Remove react-useragent as it shows a bad practice
* Remove react-uwp example as it has low usage
* Remove recompose example as it shows outdated practices
* Remove refnux example as it has low usage
* Remove example that can be created using api routes
* Update with-segment-analytics
* Update socket.io example
* Remove socket.io example as it's shows bad practices
* Update static export example
* Update universal configuration example
I wrote a [script](https://github.com/j0lv3r4/dependency-version-updater) to update dependencies recursively in `package.json` files, e.g.:
```
$ node index.js --path="./examples" --dependencies="react=^16.7.0,react-dom=^16.7.0"
```
This PR contains the result against the examples folder.