Commit graph

33 commits

Author SHA1 Message Date
Steven
57dcc9d329
Update pnpm create next-app for latest pnpm 6 and 7 (#37254)
This command changed in pnpm [6.32.13](https://github.com/pnpm/pnpm/releases/tag/v6.32.13) and [7.1.1](https://github.com/pnpm/pnpm/releases/tag/v7.1.1) so lets update it since its been a few weeks and we can expect pnpm users to update more regularly than npm users.

- Fixes https://github.com/vercel/next.js/pull/37240 
- Fixes https://github.com/vercel/next.js/pull/37045
- Fixes https://github.com/vercel/next.js/pull/37032
- Fixes https://github.com/vercel/next.js/pull/36602
- Fixes https://github.com/vercel/next.js/pull/36496
2022-05-27 21:21:40 +00:00
Tom
3e178bb801
add pnpm link to docs (#37221)
## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)


Co-authored-by: Steven <steven@ceriously.com>
2022-05-27 15:46:38 -04:00
Michael Novotny
52fefb13e2
Adds removeListener handler to with-electron-typescript example. (#36323)
Without removing the listener in `useEffect`, the home / index page will keep adding a new listener each time you come back to the home page.

![CleanShot 2022-04-20 at 15 38 44](https://user-images.githubusercontent.com/446260/164318945-f1779c57-ff30-437b-8914-961cd6ebc176.gif)
2022-04-20 20:54:33 +00:00
Michael Novotny
be3c804b8d
Fixes scripts in Electron examples. (#36133)
There were a few issues with the scripts in the Electron examples:

* `dist` and `pack-app` would fail without a `name` and `version` in `package.json`.
* `type-check` didn't work because there isn't a `tsconfig.json` at the root. It needs to look in the `electron-src` and `renderer` folders respectively.

`electron-builder` also needed to be updated in order to run on macOS 12.3+ (see https://github.com/electron-userland/electron-builder/issues/6606). 

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`


Co-authored-by: Lee Robinson <9113740+leerob@users.noreply.github.com>
2022-04-14 00:04:41 +00:00
Steven
9f9214abe5
Updated create-next-app docs to include pnpm usage (#35755)
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)
}
```
2022-03-30 21:03:21 +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
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
daku10
9d14dd8d1d
Update tsconfig of example to be consistent with default output of next.js (#25581)
remove `alwaysStrict: true` rule from tsconfig.json in with-typescript example, because the rule is included in `strict: true` has been already written in tsconfig.json and other included rules such as `noImplicitAny: true` have not been written.  

[tsconfig documentation link](https://www.typescriptlang.org/tsconfig#alwaysStrict)

## Documentation / Examples

- [x] Make sure the linting passes
2021-06-03 22:31:14 +00:00
Tomotaka Sakuma
aada946f84
up-to-date electron (#25551)
Bump up electron of an example, `with-electron-typescript` adding `contextIsolation`,  https://www.electronjs.org/docs/tutorial/context-isolation#context-isolation.
2021-06-03 02:50:44 +00:00
Shashi Srinath
9fd9d83221
added an ipcRenderer usage sample to the electron-typescript example (#20000)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-01-21 16:37:40 +01:00
Almad
920c22157c
Use archive link for electron-next in the examples (#20879)
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2021-01-11 13:53:31 +01:00
Laura Beatris
d96de6ea6b
Fix typos found on examples docs (#20516)
This PR fixes some typos found on examples docs
2020-12-27 17:14:58 +00:00
LittleboyHarry
08ce06a3ef
Improve with-electron-typescript example (#18277)
1. updates the `.gitignore` for this example to ignore the temporary output folders. ( similar to #15783 )
2. change yarn run script to npm run script ( I don't like use yarn currently. )
2020-11-12 21:02:43 +00:00
Davidson Nascimento
019bbb284a
chore: fix some with-electron-typescript example setup (#18976)
- Changed script `start` to `dev` and improved it #18934 adding commando to transpile electron code;
- Added some folders into `.gitignore`;
- Updated react to avoid issues as #18916

Fixes #18934
2020-11-09 13:34:16 +00:00
Kristoffer K
2acb53bd30
chore: update example names to match their folders (#16268)
**What's the problem this PR addresses?**

A decent amount of the examples don't have a `name` field in `package.json` that matches their folder name, meaning they either lack a name or the names are duplicated.

I was testing Yarn 2 workspaces using the entire examples directory and needed to get rid of the duplicates.

**How did you fix it?**

Updated the names to match the names of their folders
2020-09-05 21:23:51 +00:00
Joe Haddad
f17d435166
Ensure all examples are MIT licensed (#16691) 2020-08-29 22:32:35 -04: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
Kim T
ea026151b2
with-electron-typescript build error fix (#15803)
Fixes #15802 

Added Params type to prevent typescript error during build step
2020-08-03 13:17:38 +00:00
laiso
2c9c07f96d
Update Electron, Typescript example (#15524)
It seems like the error occurs with `next export` when building the current example.

```
$ cd examples/with-electron-typescript
$ yarn && yarn build

Error occurred prerendering page "/detail". Read more: https://err.sh/next.js/prerender-error
Error: Error for page /detail: pages with `getServerSideProps` can not be exported. See more info here: https://err.sh/next.js/gssp-export
Error: Export encountered errors on following paths:
        /detail
    at exportApp (/Users/kstg/src/github.com/zeit/next.js/examples/with-electron-typescript/node_modules/next/dist/export/index.js:22:1166)
error Command failed with exit code 1.   
```

I changed routes to statically resolve pages generating from `pages/detail.tsx` and added `getStaticPaths` and `getStaticProps`. so then it will export as follows

```
yarn run v1.22.4
$ next build renderer && next export renderer
Creating an optimized production build...

Compiled successfully.

Automatically optimizing pages...

Page                            Size     First Load JS
┌ ○ /                           336 B          62.6 kB
├ ○ /404                        2.54 kB        61.6 kB
├ ○ /about                      338 B          62.6 kB
├ ● /detail/[id]                440 B          62.7 kB
├   ├ /detail/101
├   ├ /detail/102
├   ├ /detail/103
├   └ /detail/104
└ ● /initial-props              530 B          62.8 kB
+ First Load JS shared by all   59.1 kB
  ├ static/pages/_app.js        983 B
  ├ chunks/commons.9facbe.js    10.9 kB
  ├ chunks/framework.b76773.js  40.3 kB
  ├ runtime/main.800476.js      6.22 kB
  └ runtime/webpack.c21266.js   746 B

λ  (Server)  server-side renders at runtime (uses getInitialProps or getServerSideProps)
○  (Static)  automatically rendered as static HTML (uses no initial props)
●  (SSG)     automatically generated as static HTML + JSON (uses getStaticProps)

> using build directory: /Users/kstg/src/github.com/zeit/next.js/examples/with-electron-typescript/renderer/.next
  copying "static build" directory
> No "exportPathMap" found in "next.config.js". Generating map from "./pages"
  launching 7 workers
Exporting (0/4)
Exporting (1/4)
Exporting (2/4)
Exporting (3/4)
Exporting (4/4)

Export successful
Done in 11.47s.
```
2020-07-28 23:00:56 +00: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
Todor Totev
097287489f
[Examples] Refactor with-electron-typescript (#13802)
Related to [11014](https://github.com/vercel/next.js/issues/11014).

Removed getInitialProps in favor of getStaticProps and getServerSideProps. Refactored one of the components from class to functional. Removed redundant imports. Removed React.FC/FunctionComponent. Added two build files to gitignore.

Let me know if you want something to be changed.
2020-06-05 16:00:10 +00:00
Joe Haddad
7d038dfef1
Suggest npx over npm init (#13637)
This updates old examples to the more universal `npx` command.

Fixes https://github.com/vercel/next.js/discussions/12103
2020-06-01 17:36:57 +00:00
Joe Haddad
b7e17e09e5
Update references to zeit/next.js (#13463) 2020-05-27 17:51:11 -04:00
JJ Kasper
1f6ce106ae
Update codeload and deploy links for org rename (#13141)
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-05-27 14:11:39 -04:00
Joe Haddad
86160a5190
Upgrade to Prettier 2 (#13061) 2020-05-18 15:24:37 -04:00
Minh Nguyen
ec76d9265c
Rename functional component -> function component (#11850)
See the following for context:

- https://reactjs.org/docs/components-and-props.html#function-and-class-components
- https://overreacted.io/how-are-function-components-different-from-classes/
- https://twitter.com/dan_abramov/status/1057625147216220162
- https://twitter.com/kentcdodds/status/1136274289965928448
2020-04-13 11:33:06 +02:00
Shu Uesugi
6804039e94 Make example READMEs more consistent (#10124)
* npx create → npm init

* Fix inconsistent instructions

* Update amp-first

* Update with-graphql-react

* with-firebase-cloud-messaging

* Update with-higher-order-component

* change create-next-app url

* Update create-next-app instruction

* Update instructions to use npm instead of npx

* Move "the idea behind the example" to top

* Rename

* Rename

* Update contributing.md with a README template
2020-01-16 23:23:56 +01:00
Jeremy Asuncion
1f9a40b644 Fix source in electron build (#9802)
* copy only compiled files into electron build for with-electron-typescript

* updated npm deps for with-electron-typescript

* copy only compiled files into electron build for with-electron

* updated npm deps for with-electron

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2019-12-21 13:25:27 -06:00
Joe Haddad
18a9c7e371
Improve linting rules to catch more errors (#9374)
* Update `packages/`

* Update examples

* Update tests

* Update bench

* Update top level files

* Fix build

* trigger
2019-11-10 19:24:53 -08:00
Luis Alvarez D
f10f3304fe Replace the deprecated Create Next App URL (#9032) 2019-10-10 23:34:14 -04:00
Lukáš Huvar
7863b60ef6 Prettier fix (#8754) 2019-09-16 15:24:42 +02:00
Jakub Karabuła-Stysiak
5496e0f8b3 Add electron typescript example (#8682)
* Add initial Electron-Typescript-Next example

* Move and add types

* Update readme

* Update renderer

* remove config
2019-09-10 14:22:00 -05:00