Commit graph

1081 commits

Author SHA1 Message Date
Connor Davis
e4ceb903a1
Update README.md 2019-04-15 02:19:37 -05:00
Connor Davis
3363f26a42
Fix missing dash 2019-04-14 20:35:03 -05:00
Javier Alcala
8a326345b9 Enable strict type checking on custom-server-typescript example (#7025) 2019-04-13 19:56:12 +02:00
Frieder Bluemle
9281f4651a Fix GitHub spelling (#7024)
Just a minor typo fix: `Github` -> `GitHub`.
2019-04-13 17:36:07 +02:00
JJ Kasper
09a2fe5c38
Amp page level reload (#6971)
* Only refresh the page when the active
page is updated in AMP mode

* Update handling of page reload to make sure it
still refreshes after a change to another page

* Update checking to be more accurate

* Fix amp-dev not being loaded without
experimental.amp and remove next.config from amp example

* Remove old with-amp example and
rename experimental-amp to with-amp

* update example name

Co-Authored-By: ijjk <jj@jjsweb.site>

* Update comment wording

Co-Authored-By: ijjk <jj@jjsweb.site>

* Use document for reload to keep scroll position

Co-Authored-By: ijjk <jj@jjsweb.site>

* fallback to reloading on error

Co-Authored-By: ijjk <jj@jjsweb.site>

* Update with-amp example readme
2019-04-12 20:54:27 -05:00
Alex Parish
5ed51c0049 Update with-graphql-hooks example to exclude SSR library from commons chunk (#7015) 2019-04-11 17:59:42 -05:00
JJ Kasper
e5111745b5
Replace .amp.js with withAmp(Comp) (#7009)
* Add WithAmp to enable AMP support for
pages instead of .amp.js

* Update handling for exporting AMP

* Fix ampPath in export for / path and
revert isAmp logic to handle right

* Update amphtml test suite

* Add handling for noDirtyAmp during
export and update amp-export test suite

* Update serverless and export-default-map
test suites

* Update require-page tests
2019-04-11 13:59:26 -05:00
Juan Olvera
c564c1416a add package.json to example (#7004) 2019-04-11 11:26:18 +02:00
Kyle Holmberg
139b1487b2 Update root-static-files example (#6967) 2019-04-09 19:08:39 -05:00
Khoi Le
d943d40ed8
Added cross-env package for using on Windows (#6877)
Added [cross-env](https://www.npmjs.com/package/cross-env) package for using the command `npm start` on Windows environment.

Tested on:
- [x] Windows version 1809
- [x] Node.js 10.15.3 (LTS version)
2019-04-09 15:37:17 -04:00
Ivan Jovanovic
f4c160ee46
Custom hapi server example handle static files (#6822)
While implementing hapi as a custom server, I found a minor issue. The example provided isn't showing that we also need to serve static files using next. This change should fix that. Thanks!
2019-04-09 15:37:14 -04:00
Tev
9c8d7290df Custom ReasonML Server (#6970)
- A typesafe custom server built in reasonml.
2019-04-09 15:15:41 -04:00
yi
3e7f836c28 Added example with react-multi-carousel for rendering items on the server-side (#6820)
* Simplified format function in with-redux (#6518)

* Update README.md (#6749)

- fix runtime configuration example to use `customKey`
- standardize warning callouts to use a block quote and bold "**Warning:**" text. Previously there were different ways a warning was mentioned on the docs page:
  - A warning emoji. The warning emoji didn't render in the actual site. 
    <img width="770" alt="Screen Shot 2019-03-21 at 9 22 21 AM" src="https://user-images.githubusercontent.com/1103708/54759302-c655f380-4bbb-11e9-9116-b0fdc2467bc3.png">
  - Italicized "Warning" text. Imo, does not stand out on the page.
    <img width="663" alt="Screen Shot 2019-03-21 at 9 24 43 AM" src="https://user-images.githubusercontent.com/1103708/54759376-f604fb80-4bbb-11e9-85c6-6589b7738dee.png">

* Adde example on how to rendering muiltiple items carousel on server-side with nextjs
2019-04-03 12:58:59 +02:00
Lucien PESLIER
49fd5990a1 Update Sentry to v5 and add @sentry/integrations (#6873)
Hi everyone :)
I just updated Sentry to v5 and added @sentry/integrations due to breaking changes :)
I also fix the documentation. npm commands were in yarn section.
2019-04-03 12:32:36 +02:00
Corbin Crutchley
c120d6b9fb Fastify example dep update (#6714)
This merge request updates `fastify` package from v1 to v2 and adds the `cross-env` package so `NODE_ENV=` can work on Windows as well as OSX/Linux. Also adds example build output to GITIGNORE

Worth mentioning that pressing `a` will bring up a page that says `b` and vice-versa, but this seems to be the logic from the previous example as well. Can change if wanted
2019-04-03 11:56:39 +02:00
Shahzeb K
c97617fdf5 Added an HTTP2 server example (#6856)
As requested in this issue: https://github.com/zeit/next.js/issues/6850

This is a basic HTTP2 server which can handle the `/` and `/about` routes. 

The Readme includes [specific instruction](31877720f0/examples/with-http2/README.md (download-manually)) about how to generate the public/private keys used for this demo server.
2019-04-03 11:31:45 +02:00
Danil Shashkov
2f325e0f69 Add example with astroturf (Zero runtime CSS-in-JS) (#6821)
* Add example with astroturf (Zero runtime CSS-in-JS)
2019-03-28 15:41:05 -05:00
Corbin Crutchley
0f2bd19216 with apollo and redux example: Update deps and fix build (#6733)
* with apollo and redux example: Update deps and fix build

* Fix linting errors
2019-03-27 16:02:05 -05:00
Corbin Crutchley
1d66da15a1 with apollo and redux saga example: Update deps (#6734)
* with apollo and redux saga example: Update deps

* Fix linting problems
2019-03-27 16:00:57 -05:00
Corbin Crutchley
e03266008c form handler example: Update deps and fix build from dep update (#6732)
* form handler example: Update deps and fix build from dep update

* Ran lint error fixers

* Fixes errors that occur when commit occurs

* Commit linter fixes
2019-03-27 16:12:45 -04:00
Václav Nosek
02966afd5a [with-sentry] example: Make 'utils/sentry.js' more flexible (#6769)
* Make `ctx` optional in `captureException` function

* Make 'release' optional when calling sentry util

* Fix code style
2019-03-27 13:23:34 +01:00
Chris Cowan
1888467696 Improve with-google-analytics example (#6787)
The with-google-analytics example had the "routeChangeComplete" event listener set up in components/Page.js, but that the event listener would only be set up if the user visited a page using that component. From the example, it's not clear if google analytics can be used without making every page use a component like components/Page.js. Someone following the example may make pages that don't use components/Page.js and fail to have page views reported, or feel compelled to force a shared component into their design unnecessarily, or might even make a mistake by making multiple different components like Page.js which each add a new "routeChangeComplete" event listener, causing page views to be over-reported when the user navigates between pages using the different components.

This PR moves the "routeChangeComplete" event listener into _app.js, where it's guaranteed to be executed for every page and is more obviously decoupled from page-layout-related components.

This PR also fixes a React warning about the lack of an onChange handler on an input tag, and removes the unnecessary implementation of `getInitialProps` in _document.js (the default implementation is inherited if not present, there's nothing this example needs to do with `getInitialProps` specifically, and the body of the method seems to have been based on an old version of next's internal implementation).

This PR also fixes the url being passed to google tag manager incorrectly. It looks like page_path should be used instead of page_location because the `url` value only has the path, not the full url with the domain name, etc. (https://developers.google.com/analytics/devguides/collection/gtagjs/pages)
2019-03-27 13:21:41 +01:00
Tomáš Hapl
99362592b9 example with orbit-components (#6793) 2019-03-27 01:49:12 +01:00
Corbin Crutchley
9504a389c0 Update dependencies of various examples (#6731)
Minor changes to examples. Updating major semver updates with only `package.json` changes. 
I've done my best to make sure that these packages.json files all have `latest` for the `nextjs` package, `cross-env` for those with `server.js` files, etc.
I also added a `package.json` to `with-dynamic-app-layout` (it was missing one previously)

Made sure to test all of these packages post-upgrade to ensure maintained functionality
2019-03-27 01:42:49 +01:00
Michele Salvini
affe356a90 Pass mapDispatchToProps as an object (#6786)
wrapping `startClock` in `bindActionsCreator` there's no need to pass `dispatch` in:
```
this.props.startClock(dispatch)
```
Furthermore `bindActionsCreator` is not needed because following already bind actions:
```
const mapDispatchToProps = {
  startClock
};
```
2019-03-26 12:28:18 +01:00
Tim Neutkens
cf73809cb9
Revert "Add static-no-js site example (#6770)" (#6774)
This reverts commit 879da36888.
2019-03-25 09:08:41 +01:00
Giuseppe
879da36888 Add static-no-js site example (#6770) 2019-03-25 09:04:47 +01:00
Julio Carlos Menendez
7ae0ff38e9 Adds example for Office UI Fabric React. (#6705)
* Adds example for Office UI Fabric React.

* Fixes code style errors.
2019-03-19 13:30:05 +01:00
Jehun Seem(심제훈)
ce329cce96 Fix with-mobx-state-tree-typescript modules export (#6704)
* Update libraries

* Fix for export modules for type
2019-03-19 11:43:12 +01:00
JJ Kasper
12cbb934b3 Add support for creating AMP pages (#6706)
* Add support for .amp.js pages and
resolving /page?amp=1 to page.amp.js

* Update amp tests

* Update example and clean up amp page resolving

* Add nested amp test

* page => normalizedPage

* Add type to page options

* Add handling of amp with all pageExtensions
and normalize page

* Make sure findPageFile only falls back to
amp if enabled
2019-03-18 23:24:21 -04:00
March Works
71c4728598 update with-rematch example (#6699)
Solved the following issue [#6686](https://github.com/zeit/next.js/issues/6686)
2019-03-18 14:37:49 +01:00
Kyle Gallagher
05ddf3e4e0 Small fix to example custom-server-typescript (#6695)
I noticed that the nodemon.json file was not watching for all file changes in the correct location for filetype .ts (typescript). After some research I found that the "ext" option in the nodemon.json fixes the issue and should work across all operating systems.
2019-03-18 11:57:39 +01:00
Danil Shashkov
fbedce4de1 Add with-linaria example (#6510)
Next.js with Zero-runtime CSS-in-JS
2019-03-17 00:25:20 +01:00
John Lombardo
5e4886cdb9 Port with-mobx to with-mobx-react-lite (#6617)
Replicates the behaviour of the `with-mobx` example but implemented using `mobx-react-lite` and React context.

I'm still working out a best practice regarding actions and welcome feedback on anything.
2019-03-16 16:47:28 +01:00
Brent Ertz
4c4459f931 Update custom-server-typescript example (#6627)
* Typecheck server vs. client code independently, ensuring that each respects its own tsconfig.
* Use nextjs default distDir in tsconfig
* Update packages
* Fix type error in server.listen callback
2019-03-16 16:42:22 +01:00
Ravinder Mahajan
1c31d79c38 Creating one more example which only uses redux and no thunk as middl… (#6636)
Adding one more example which only uses redux and not thunk. This helps a lot for a beginner to understand basic redux first.
2019-03-14 17:40:00 +01:00
Christian Alfoni
6ba41915e4 initial overmind example (#6548)
* initial overmind example

* fix linting

* add with-overmind readme
2019-03-12 12:42:42 +01:00
Jan Potoms
176b5466bb Remove stray comma (#6593)
* eliminate need for render() method

* remove stray
2019-03-10 13:18:17 +01:00
Jan Potoms
0bcfd33c38 eliminate need for render() method (#6591)
This simplifies the example and reuses the existing `initialProps.styles` logic.
2019-03-10 12:17:18 +01:00
JJ Kasper
17da3f86ad Update with-now-env to use env config (#6581)
* Update with-now-env to use `env` config
instead of webpack.DefinePlugin

* Remove mention of DefinePlugin from index page
2019-03-08 20:41:07 +01:00
JJ Kasper
17806e2bb2
Add links for now info to parameterized-routing example (#6565) 2019-03-07 13:38:42 -06:00
k-kawakami
d9060f5abd Remove trailing spaces (#6547)
### changes
#### remove trailing spaces

When I was using example I noticed trailing spaces.
So, this PR removes the trailing spaces of json file, README, and others.

`examples/with-jest-typescript/src/modules/cars/Overview.tsx` also has it, but this time it did not change as tslint error occurs at commit.
2019-03-07 17:40:08 +01:00
Tim Neutkens
51fc26161d
Update README.md 2019-03-07 13:20:46 +01:00
Marton Langa
5f003105ef Change redirect status to 302 (#6562)
As discussed in #6546, changing redirect status to 302, so the redirect is only temporary
2019-03-07 12:51:45 +01:00
Marton Langa
0a4f0e6356 Fix page not loading with ending the request (#6546) 2019-03-07 11:29:25 +01:00
Roger Hutchings
068dd825f3 Add Grommet example (#6529)
Adds a new example showing how to use the [Grommet UI library](https://grommet.io/) with Next.js.
2019-03-05 14:00:57 +01:00
GaelS
2e00ebfe6c Update login.js (#6527)
Playing with this example, I realized that it was not doing what I expected in case of an error coming back from the API (e.g : throw properly the error and save it in the state).
2019-03-05 01:07:22 +01:00
Jess Telford
a3d94a56a4 [examples/with-sentry] Better docs + correct dependencies (#6521) 2019-03-03 23:09:18 +01:00
Mike Francis
8e807ca203 Added with-typescript-styled-components example (#6511)
* Added with-typescript-styled-components example

* Fix linting errors
2019-03-02 15:30:11 +01:00
JJ Kasper
89ad01cab8 Update with-zones example to support Now v2 / serverless (#6485)
Fixes: #6468
2019-03-02 01:11:37 +01:00
Joe Warren
5fd7b85280 Add graphql-hooks example (#6482)
Adds an example app using [graphql-hooks](https://github.com/nearform/graphql-hooks) that started life as the with-apollo example app. It uses the same graph.cool backend, mostly to demonstrate how similar it is.
2019-03-01 18:21:03 +01:00
JJ Kasper
23178db575 Add styles to experimental-amp example (#6461)
After discussion added global styles to experimental-amp example
2019-02-27 22:01:49 +01:00
JJ Kasper
70d611f0de Update with-hashed-statics example (#6472)
Fixes: https://github.com/zeit/now-builders/issues/160
2019-02-27 21:26:45 +01:00
Kiko Beats
3998805b2e Use cacheable-response for ssr (#6393)
Hello,

I have been using next.js for a while in a bunch of projects, so first for all thanks for all the vibrant effort around the project 🖤. 

Always I see the server side next.js approach as an advantage, but also a weakness for the extra resources you need to have, specially comparing how cheap is a client side app.

In order to do my things cheaper, I started using the SSR pattern you suggested in your examples, so useful! It saves time and resources.

However, it was *too simple*. In a real production scenario, you need a bit more, specially related with send the right response headers to keep the rest of external network agent updated of your cache state.

I started a tiny script code for doing that; basically, I copy/paste it on my ssr projects.

Now, after a time, I think it's worth it publish it as [cacheable-response](https://github.com/Kikobeats/cacheable-response) module.

The PR is for adding the module leverage into the next.js ssr example. 

It's doing the same, plus:

- be possible use a multi storage cache (memory by default; mongodb, redis, mysql, supported).
- sending `cache-control` response headers.
- sending `X-Cache-Expired-At`, just a humanize way to see the expiration time.
- support for forcing invalidation via `force=true` query parameter.

I hope you like it 🙂
2019-02-27 13:14:50 +01:00
Samundra Shrestha
aed7f643e2 add extra info to authentication (#6435)
* add extra info to authentication

* Update auth.js
2019-02-27 12:55:25 +01:00
Luc
806bfdfa99 Update with-jest, with-jest-react-testing-library examples (#6464)
The latest version of babel-jest doesn't require `babel-core` with the bridge version anymore (updated in this PR : https://github.com/facebook/jest/pull/7016).

So I'm updating with-jest and with-jest-react-testing-library examples accordingly.
2019-02-27 12:32:12 +01:00
Peter Kellner
62f84bb1ea Create example for adding env variables from next.js.config / Final (#6318)
* This is a non-working example of using PHASE_DEVELOPMENT_SERVER and PHASE_PRODUCTION_SERVER in production. I followed @timneutkens gist but was unable to make it work so I've boiled it down into this non-working example which I believe is the same.  The README is not updated. Once it is figured out why this is not working, I'll clean up the project and update the pull request to be complete but for now just want to make it work.

* added .eslintrc so that ` eslint . --fix` would work (not sure if that was really necessary). I assume that is same as `yarn lint-fix`.

* fixes for standard style

* fixes for standard style

* Fix example and add some comments

* Updated documentation and small change to logic of prod,dev,staging to work as expected.
Added significantly more doc then I normally would in the hopes that it helps someone avoid the mis-understanding I went through.  If it's too much, LMK and I'll reduce.

* removed eslint and updated package.json to get rid of eslint and standardjs
2019-02-27 12:18:04 +01:00
laiso
fdb10d4f1d Update to Next v8.0 example on with-graphql-react (#6454)
I'm working on examples/with-graphql-react changes to:
- Next v7 to v8.0 and update dependencies
- fix some errors for the change of graphql-react API
2019-02-26 23:44:45 +01:00
Matsumoto Toshi
967542cc83 Update @zeit/next-preact example (#6390)
* update next-preact

* Update package.json
2019-02-26 10:01:15 -05:00
JJ Kasper
074432d92c Drop images from experimental-amp and with-amp examples (#6446) 2019-02-26 00:38:13 +01:00
Joe Haddad
99867a1728 Add new experimental-amp example (#6444) 2019-02-25 23:49:49 +01:00
HelloRusk
78d560e5d7 fix link in with-react-with-styles sample (#6438)
with-aphrodite example link didn't work properly
2019-02-25 16:55:45 +01:00
Jesse Hoffman
a971d295ab Remove jsonPageRes Documentation Reference (#6440)
Next.js no longer uses `jsonPageRes`.

This PR removes it from `en-us` and `zh-cn` documentation (formatting picked up some changes on zh-cn readme).

Also updated the Flow type def for `getInitialProps`.

Resolves #6363
2019-02-25 16:49:11 +01:00
Jepser Bernardino
993cab89e5 Update Hapi example (#6429)
Since version 18 (released in January), Hapi's `request.url` returns the parsed URL, so `parse` is not needed.

Ref:
- https://hapijs.com/api#-requesturl
- https://github.com/hapijs/hapi/pull/3822
2019-02-24 13:44:12 +01:00
Pierre de la Martinière
e05229be54 Fix hot reloading in the yarn workspaces example (#6402)
* Fix hot reloading in the yarn workspaces example

* Update README links
2019-02-22 12:17:45 +01:00
Kévin Dunglas
e0896e5dbe Add an example using ESI cache (with React ESI) (#6225)
[React ESI](https://github.com/dunglas/react-esi) is a brand new cache library for vanilla React and Next.js applications, that can make highly dynamic applications as fast as static sites by leveraging the open Edge Server Include specification.

https://github.com/dunglas/react-esi

Because this spec is widespread, React ESI natively supports most of the well-known cloud cache providers including Cloudflare Workers, Akamai and Fastly. Of course, React ESI also supports the open source Varnish cache server that you can use in your own infrastructure for free (configuration provided).

This PR shows how to integrate React ESI with Next.js.
2019-02-22 09:32:51 +01:00
Joe Haddad
1757ad022c Drop cli-cursor dependency (#6387) 2019-02-21 15:34:35 +01:00
HelloRusk
414e8fab6c Update link in wasm example (#6389)
I renewed Rust installation Link.
2019-02-21 15:34:20 +01:00
Vincent Grafé
d7856c6698 fixes a few inconsistencies in server routes (#6382)
I spotted a few typos in the server files, that might confuse new/unexperienced users. I hope I did catch them all!
2019-02-21 13:21:22 +01:00
Robert Sköld
9f5d1ef31b Add example using lingui.js (#6210) 2019-02-21 12:53:02 +01:00
Ariel Fuggini
5ab3f00441 Fixed missing next deployment directory bug (#6331)
Fixes https://github.com/zeit/next.js/issues/6201 
Fixes #5912
2019-02-21 00:45:07 +01:00
Jess Telford
09508ed4bb [with-sentry] Use env config instead of webpack where possible (#6381) 2019-02-21 00:33:32 +01:00
Connor Davis
61de215e04
Move webpack config to TypeScript (#6348) 2019-02-20 13:24:02 -06:00
Jess Telford
ecbecb9edb Fixes for with-sentry example (#6362) 2019-02-20 14:49:16 +01:00
Jess Telford
9d7385c3d8 Add SSR'd Portals example (#6365) 2019-02-20 14:06:28 +01:00
HelloRusk
6eacea4361 updated module and removed old example in socket.io example (#6368) 2019-02-20 13:56:48 +01:00
JJ Kasper
bf69357f27 Remove onDemandEntries WebSocket server in favor of EventSource connection (#6354)
After talking with @timneutkens it was decided it'd be more streamlined to replace the onDemandEntries WebSocket with an alternative. Using the EventSource connection gives us these benefits over the WebSocket one:

- less code needed
- no extra server running
- no extra config for onDemandEntries
2019-02-19 21:58:47 +01:00
Jess Telford
cc83e751f1 Load styled-components example on codesandbox (#6321)
If this is an acceptable pattern, I'm happy to open a PR to add these links to all the other examples also 👍
2019-02-18 10:16:23 -05:00
Timon Borter
f9fedaeba6 recreate stdChannel (or saga middleware). (#6330) 2019-02-17 20:57:59 +01:00
Ahmed Tarek
5cef35b811 Fix style importing (#6322) 2019-02-17 13:32:58 +01:00
JJ Kasper
5d779a0289 Add falling back to fetch based pinging for onDemandEntries (#6310)
After discussion, I added falling back to fetch based pinging when the WebSocket fails to connect. I also added an example of how to proxy the onDemandEntries WebSocket when using a custom server. Fixes: #6296
2019-02-15 22:22:21 +01:00
Timon Borter
d2ef34429c push redux-saga to major release 1.0.1. (#6300) 2019-02-14 19:05:27 +01:00
Felix Mosheev
04ce3e7174 Use process.browser instead of env probing (#6286) 2019-02-14 19:05:08 +01:00
Jonathan Reed
7dbe837ae4 fixes hashed statics readme (#6293)
# Description

* Fixes incorrect assertion of configuration file in the `with-hashed-statics` README as well as adds link to line for updating
2019-02-13 19:53:42 +01:00
Tim Neutkens
4fea345f5d Merge branch 'master' into canary
# Conflicts:
#	lerna.json
#	packages/next-server/package.json
#	packages/next/package.json
2019-02-13 07:19:58 +01:00
Spencer Elliott
4dd6094639 styled-components example: use a fragment for styles initial prop (#6252)
`initialProps.styles` is a React node, but not guaranteed to be an
array, so we can use a fragment to concatenate additional styles.

See https://github.com/DefinitelyTyped/DefinitelyTyped/issues/32932#issuecomment-462372319
2019-02-11 20:48:03 +01:00
Juan Olvera
80cb91ec87 Add setup to run example with cookie authentication locally (#6101)
* extract request login from auth

* add clarification that the monorepo is for deploy in Now only and fix typo

* Refactor HOC

- add authorization to HOC
- add displayName to HOC
- remove unnecessary `run`s in local routing
2019-02-11 14:17:43 +01:00
Fredrik Höglund
2ab1ae7f61 Updated examples for build-time env configuration for v8 (#6237)
* Updated examples for build-time env configuration for v8

* Add comment to build time config example with how to include entire .env
2019-02-11 14:15:06 +01:00
Resi Respati
3746d7d90b [with-typescript] Fixed incorrect query type (#6238) 2019-02-11 10:32:10 +01:00
Tim Neutkens
163830c026 Merge branch 'canary'
# Conflicts:
#	examples/with-apollo-and-redux/README.md
#	examples/with-sentry/README.md
#	examples/with-sentry/package.json
#	examples/with-sentry/pages/_app.js
#	package.json
#	packages/next/build/webpack-config.js
#	packages/next/client/index.js
#	server/document.js
#	server/render.js
#	test/integration/production/test/index.test.js
2019-02-11 08:22:31 +01:00
Resi Respati
f8a80f1aa9 [with-typescript] remove unnecessary passHref in Link components (#6233)
As per discussion in #6165, I removed the `passHref` in `Link` as
they're unnecessary.
2019-02-11 00:00:05 +01:00
Fredrik Höglund
b05df70872 Fix first render of with-react-helmet example (#6235) 2019-02-10 20:48:13 +01:00
Henri
98cf0a8311 [examples] Update react jss example (#6198)
This updates the react-jss example to work with the v10 alpha
2019-02-04 11:51:38 +01:00
Resi Respati
8fdb133903 [with-typescript] Improved intial props examples, added example detail (#6165)
I've just thought of a way to improve the initial props page by adding
an example for a list/detail page structure. To do that, I've created a
separate `/detail` page, and a mock API which calls data from the array
we made on the previous PR.

A ListDetail component is created as an example for displaying detail.

Page structure is also cleaned up. Should I go ahead and add an example
on how to style with styled-jsx + its TS declarations? I might decide to
do it within this week anyway.
2019-01-31 17:36:02 +00:00
Petr Messner
968475fb95 Update with-relay-modern and with-relay-modern-server-express (#6182)
Update examples with-relay-modern and with-relay-modern-server-express to react-relay 2.0.0

- react-relay has started to use new Context API instead of Legacy Context API
- add `parseInt` because graphql 14.0.0 introduced stricter scalar value coercion

Closes #6157
2019-01-31 10:38:19 +01:00
Timon Borter
cf31021e25 Bugfix/redux saga 1 0 0 not ready (#6176)
This reverts the changes made in [this pr](https://github.com/zeit/next.js/pull/6109).
`redux-saga: "1.0.0"` changed the way it handles it's queues. Because of that we're still having trouble to implement the synchronous side-effects flow in `next-redux-saga`. See [this discussion](https://github.com/bbortt/next-redux-saga/pull/1) for more information.
Therefore I would feel more comfortable not to mislead users by giving them a non-working example in the main branch.
2019-01-30 15:34:18 +01:00
Jan Bejvl
b8057edd6e Updated README.md with proper link (#6172)
Updated README.md with proper link to 'root-static-files' example.
2019-01-29 13:42:58 +01:00
Benjamin Hanes
dbdd663921 Update with-react-native-web example to use babel (#6170)
Fixes https://github.com/zeit/next.js/issues/6138

Tested with both latest and 8.0.0-canary.17
2019-01-29 13:42:44 +01:00
Marcin Czenko
1475491568 Updates with-semantic-ui example (#6158)
I tried to make the example a bit more descriptive. I changed `publicPath` in `now.config.js` to be `/_next/static/`, in place of `./`, and `outputPath` to `static/` in place of `static/css/`.  The reason is that the webpack config will still fallback to `file-loader` for any content that is imported by the user and which is bigger that `8192` bytes. I think this content should not land in the css folder, which should probably stay css specific.

Moreover, for user content, like regular images, the former settings will fail.

If you have this:

```javascript
import LargeFile from './LargeFile.png'
```

it would be placed in `static/css/` but its url would resolve to `<base-url>/LargeFile.png`, which will fail. It works for semantic-ui alone, because `@zeit/next-css` will put the styles in `static/css/` and so `publicPath` of `./` would work just fine.

Putting assets in `static/` and setting `publicPath` to '/_next/static/' will resolve correctly for both semantic-ui related assets as well as for regular user assets.

I hope I am not mixing something up. I tested it locally and in serverless deployment, and this looks pretty consistent.
2019-01-28 08:37:24 +01:00
Timon Borter
7adb6c57f4 merge to redux-saga 1.0.0, api breaking changes included. (#6109)
Hi there
I noticed you have not yet included the api breaking changes in `"redux-saga": "1.0.0"`. Therefore I felt free to upgrade the dependencies in `examples/with-redux-saga`.
I do not know anything about apollo nor graphql, that is why I did not upgrade `examples/with-apollo-and-redux-saga`. But, I think you should do this on occasion.
Keep the great work up.
Regards
2019-01-25 22:25:08 +01:00
Resi Respati
6d41ed7e6f [with-typescript] Updated typescript and removed unused deps (#6116)
I've updated the TypeScript dependency to the latest version. Also
removed some dependencies that may not be needed.

I've also fixed tslint errors which may have appeared because of
previous updates to this starter kit, as well as added comments
to explain some parts of the code.
2019-01-24 10:18:43 +01:00
Lucas Feliciano
ca521b36e6 Manually call sheet.seal() to avoid memory leaks on with-styled-components example (#6107)
I was noticing some bad memory leak on my company's application and I ended up finding this github issue ( https://github.com/styled-components/styled-components/issues/1624 ) .

This comment ( https://github.com/styled-components/styled-components/issues/1624#issuecomment-425382979 ) caught my attention, which lead to this other issue on the repository of styled components website ( https://github.com/styled-components/styled-components-website/issues/329 )

After applying the changes on my project I noticed a huge improvement on memory consumption.

So would be nice to update the example or start a discussion on how to solve this properly
2019-01-24 10:16:47 +01:00
Justin Noel
d6ec10a4bf add new nextjs typings with samples (#6102)
The current `examples/with-typescript` is not using the latest type definitions currently available on DefinitelyTyped project for next.

Added new list page examples that demonstrate how to use the new Types for both stateless functional components and classes.  Also modified examples for list to demonstrate typings for `getInitialProps`.
2019-01-23 12:37:09 +01:00
Henri
02e44d13a9 [examples/react-jss] Add support for styled custom App component (#6094)
With the current example it's not possible to use any components with styles inside a custom App component.
 
Reference issue: cssinjs/jss#939
2019-01-20 14:41:49 +01:00
Matthias Wilhelm
b0a469233b Close #5607 - Bug in examples/with-data-prefetch (#6093)
ctx.pathname was set to url including the query of the page to prefetch
therefore the page was cached with the wrong key (article%3Fid=1?id=1),
and that's why the cache didn't work (right key: article?id=1)
2019-01-20 13:41:49 +01:00
Gary Meehan
b8c9a1b574 Add next-seo example (#6088)
This PR adds a basic example using [next-seo](https://www.npmjs.com/package/next-seo).
2019-01-19 13:07:13 +01:00
Gary Meehan
0786dbfb04 Update with-storybook example (#6089)
Updates to the latest version of Storybook.
2019-01-19 12:04:44 +01:00
James Mulholland
9f08e48d72 With segment (#6060)
RE: https://github.com/zeit/next.js/issues/4587, this pull request improves the with-segment example.

Previously, only SSR page loads were tracked. This pull request adds manual page view logging via `Router.events.on('routeChangeComplete')` in `Page.js`.

There is also a minor bug fix on the textarea to remove a console error.
2019-01-18 20:40:23 +01:00
Saro Vindigni
c957c9d1a0 ADD user to docker-compose (#6085) 2019-01-18 12:03:48 +01:00
Peter Kellner
53f2d88566 Updated with-context-api to include an about page and also events that pass data to context provider (#6082)
…aces (home and about pages). This makes it the example more clear and why someone might want to use _app.js in the first place.  Also, added a button on the about page that allows for passing and arbitrary value from the about page to the context provider. I disagree with the naming convention of calling the class CounterProvider. It includes both a Provider and Consumer so it should have some name that covers both.  Maybe it should be called CounterContext but I did not change that. I've seen other examples of the same naming conversion so figure I'm the odd duck here (still think it's wrong no matter how many people do it).
2019-01-17 22:13:34 +01:00
Tim Neutkens
02ab732096
Remove next/asset (#6046)
* Remove next/asset

Reasoning described in #5970

* Remove next/asset tests

* Bring back asset-page
2019-01-14 01:32:20 +01:00
Peter Kellner
341fb9947b fixed spelling not to no (#6044)
small spelling correction
2019-01-13 22:26:21 +01:00
astenmies
68ceef68e1 Add multiple Editors example (#6031) 2019-01-11 13:48:46 +01:00
Jayden Seric
eb24e6ffc6 Add an example with graphql-react (#5984)
Adds an example with [`graphql-react`](https://github.com/jaydenseric/graphql-react), using [`next-graphql-react`](https://github.com/jaydenseric/next-graphql-react).

[`graphql-react`](https://github.com/jaydenseric/graphql-react) is a lightweight but powerful [GraphQL](https://graphql.org) client for React; the first [Relay](https://facebook.github.io/relay) and [Apollo](https://apollographql.com/docs/react) alternative with server side rendering.
2019-01-09 10:24:38 +01:00
Peter Kellner
3a3347dc5f The current TypeScript "with-typescript" looks like it was put there as a place holder. I'm fairly new to TypeScript but I'm sure the changes I've made here will be a huge improvement. Open to suggestions and to update as appropriate. Also, Tried to run yarn lint --fix to no avail. I can't figure out how to get it to find lint whether I'm running on my mac or PC. I tried lots of variations around npm i lint -g but had no success. (#6011) 2019-01-08 22:29:58 +01:00
Zack Tanner
f9b98e6cf7 SSR for styled-components babel plugin (fixes #5988) (#6001)
Enables SSR for styled-components babel-plugin to prevent HTML attribute mismatch warnings during rehydration.
2019-01-07 00:12:35 +01:00
Zack Tanner
22f9009816 remove decorator proposal plugin from ant example (fixes #5985) (#6002) 2019-01-07 00:11:16 +01:00
tylim
5d8ae4456e improve with-unstated example (#5998)
improve the example so that it can preserve unstated from server to client unstated
2019-01-06 16:58:06 +01:00
Juan Olvera
7e12997af6 Test updater script on examples folder (#5993)
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.
2019-01-05 12:19:27 +01:00
Juan Olvera
89a4cabbd6 Change React version of examples to latest (#5990)
I changed the version to the following files:

- [x] - examples/with-next-css/package.json
- [x] - examples/with-draft-js/package.json
- [x] - examples/custom-server-polka/package.json
- [x] - examples/with-cerebral/package.json
- [x] - examples/with-zones/package.json
- [x] - examples/with-universal-configuration-runtime/package.json
- [x] - examples/with-apollo/package.json
- [x] - examples/with-higher-order-component/package.json
- [x] - examples/with-hashed-statics/package.json
- [x] - examples/with-pkg/package.json
- [x] - examples/with-jest/package.json
- [x] - examples/with-glamorous/package.json
- [x] - examples/with-custom-reverse-proxy/package.json
- [ ] - examples/with-emotion/package.json
- [x] - examples/with-styled-jsx-scss/package.json
- [x] - examples/with-styled-jsx-plugins/package.json

`with-emotion/package.json` already has the latest, so I guess it's other packabe. BUT I think we need to update this example with the latest version of `emotion` since it changed a little bit (for better).
2019-01-05 12:16:07 +01:00
Dima
e3499553c4 unnecessary prop store in getInitialProps (#5983) 2019-01-02 21:39:38 +01:00
Niklas Wagner
85fd832ed8 Fix rtl-test example & add Snapshot testing (#5981) 2019-01-02 16:28:40 +01:00
Adam Lane
c4b9e079bf Add example of getInitialProps to with-reasonml (#5975)
The current reasonml needs an example of how to do getInitialProps.  tmepple posted the only known way of doing it in [this comment](https://github.com/zeit/next.js/issues/4202#issuecomment-439175214).   It is unlikely reasonml users are going to discover that comment or figure it out on their own so having it in an example is critical. 

Also, dependencies updated.  After updating dependencies, I get this error:
```
ModuleBuildError: Module build failed (from ./node_modules/next/dist/build/webpack/loaders/next-babel-loader.js):
[1] Error: Cannot find module '@babel/core'
[1]  babel-loader@8 requires Babel 7.x (the package '@babel/core'). If you'd like to use Babel 6.x ('babel-core'), you should install 'babel-loader@7'.
```
Seems like @babel/core is required as peer dependency per [this comment](https://github.com/babel/gulp-babel/issues/124#issuecomment-326853222) so I added it.

The way to do getInitialProps has changed in 7.0.2 canary so this also has a comment in the code about what change is required to get that working.
2019-01-02 11:43:19 +01:00
Rafael Mariano
75efa817c0 Modify with-universal-configuration example (#4498) (#5948)
Explains in details how the "with-universal-configuration" example works and rename it to "with-universal-configuration-build-time". Changing the example name makes the purpose of the example clear.

The "env-config.js" file introduce one more sample of variable usage that instantiates an immediate value of the local environment variable. This makes it even clearer how build-time variable configuration works. The "index.js" page makes explicit the use of these configured environment variables.

The universal configuration confusion happens when the value of the environment variable is used directly in the application causing an effect in server-side but not on the client side.
2018-12-26 20:19:31 +01:00
Steven Bell
05479400e3 Update react and react-dom to use "latest" (#5942) 2018-12-24 11:24:25 +01:00
Jean
bdfa37cd4d Add react-testing-library example (#5940)
This example show how you can test Next.js apps with [react-testing-library](https://github.com/kentcdodds/react-testing-library).

This library encourages your applications to be more accessible and allows you to get your tests closer to using your components the way a user will, which allows your tests to give you more confidence that your application will work when a real user uses it. And also, is a replacement for enzyme.

<img width="733" alt="Image showing the words next.js + react testing library" src="https://user-images.githubusercontent.com/4689228/50387208-40223200-06de-11e9-9358-607092eb25a0.png">
2018-12-23 23:23:16 +01:00
Zack Tanner
ec33b83843 Fix with-jest-typescript example to keep babel-jest in sync with jest (#5941)
This fixes the `with-jest-typescript` example to keep jest in sync with babel-jest (also updated to the latest of both). Having them resolve to different versions was resulting in weird errors.

When attempting to update the `transform` property in `jest.setup.js` to add babel-jest support to *.js/jsx files, it would throw:

> Plugin 0 specified in "node_modules/next/babel.js" provided an invalid property of "default" (While processing preset: "node_modules/next/babel.js")

Indirectly, this will fix https://github.com/zeit/next.js/issues/5917, once the author updates `jest.setup.js` to have:
```js
  transform: {
    '^.+\\.(js|tsx)?$': 'babel-jest',
  },
```
2018-12-23 21:55:35 +01:00
Martin Alix
b5fa6c5969 Corrects Typo from next-bundle-analyzer/readme.md (#5939)
c.f. https://github.com/zeit/next-plugins/blob/master/packages/next-bundle-analyzer/readme.md
2018-12-23 19:59:51 +01:00
Zihua Wu
24400d1e61 fix: update with-mobx example (#5936)
Babel related content in README.md is updated according to the updated .babelrc
2018-12-23 11:20:27 +01:00
Michael Hsu
62905ce683 Add with-carlo example (#5930)
This example show how you can use Next.js with [Carlo](https://github.com/GoogleChromeLabs/carlo).

```bash
npm run dev

npm run build
npm start
```

#### Demo

![large gif 582x438](https://user-images.githubusercontent.com/1527371/50331830-0ebd3100-053b-11e9-8d9c-d792ce0065fa.gif)
2018-12-21 09:56:36 +01:00
Tim Neutkens
9c4eefcdbf
Add prettier for examples directory (#5909)
* Add prettier for examples directory

* Fix files

* Fix linting

* Add prettier script in case it has to be ran again
2018-12-17 17:34:32 +01:00
Dale Inverarity
f7477a9e2e Adding is @tailwind components; (#5897)
Without `@tailwind components;` plugins (like container which is added by default) will not work.
See: https://github.com/tailwindcss/tailwindcss/issues/446#issuecomment-378792892 for details
2018-12-16 16:23:18 +01:00
Pojen Chen
dfa0f82669 Remove <link ...style.css"> from Head in _document (#5890) 2018-12-15 02:57:33 +01:00
Juan Olvera
798ae043ac Example with cookie auth (#5821)
Fixes #153

This is my attempt at https://github.com/zeit/next.js/issues/153

Following @rauchg instructions:

- it uses an authentication helper across pages which returns a token if there's one
- it has session synchronization across tabs
- <strike>I deployed a passwordless backend on `now.sh` (https://with-cookie-api.now.sh, [src](https://github.com/j0lv3r4/next.js-with-cookies-api))</strike> The backend is included in the repository and you can deploy everything together by running `now`

Also, from reviewing other PRs, I made sure to:

- use [isomorphic-unfetch](https://www.npmjs.com/package/isomorphic-unfetch).
- use [next-cookies](https://www.npmjs.com/package/next-cookies).

Here's a little demo:

![GIF](https://i.imgur.com/067Ph56.gif)
2018-12-14 23:05:54 +01:00
Pojen Chen
b4e877c8a8 Remove <link ...style.css"> from Head in _document (#5887) 2018-12-14 15:37:53 +01:00
Leon
c2a208d141 Update styletron example (#5879)
Missed a fix for the styletron api. Previous config won't work for server rendering.
2018-12-13 17:23:06 +01:00
adrianoted
81a2a6c429 Removing link ref style.css (#5871)
This link ref is no more necessary to include in the Head Section.  It cause error 404 in the console: http://localhost:3000/_next/static/style.css net::ERR_ABORTED 404 (Not Found)
2018-12-13 00:30:43 +01:00
Oscar Busk
71d1d363ad Fix/update "examples/custom-server-typescript" (#5865)
* Update all dependencies and remove redundant ones from package.json. (60f9ee5)
* Fixes #5596 by adjusting nodemon scripts (d4b7d3a)
* Fixes `npm start` on windows by using `cross-env` (9555217)
* Move compiled server out from `.next`. Compiling other JS into `.next` seems incorrect. (79fce02, 
9ce7086)
* Partly fixes #5753 by making sure typescript compiles with `es2017` as target, at least ensuring code is runnable on node 8. Previously it was compiled with `esnext`. (9176e92)

--- 

I tried improving the structure by keeping source in `src/app` and `src/server` and then building to `dist/server` and `dist/app` but I didn't really get it to work and made most configs more complicated. Moved the built server out from `.next` anyway.
2018-12-12 11:04:39 +01:00
Brian Beck
50662c6a83 Fix initialNow in react-intl example (#5867)
The `initialNow` prop is used to avoid content mismatches when Universal/SSR apps render date values using components like `<FormattedRelative>`.

If this value is created in `render()`, then the server will generate it and then the client will also generate it during hydration / initial render, resulting in two different values and content mismatches like:

> Warning: Text content did not match. Server: "in 1,741,545 seconds" Client: "in 1,741,543 seconds"

If the value is instead generated in `getInitialProps`, then the client's initial rendering will match because it will use the same value sent down by the server.
2018-12-12 11:02:36 +01:00
Oscar Busk
4345343d88 Update/fix "examples/with-firebase-hosting-and-typescript" (#5864)
There were several issues with the example [examples/with-firebase-hosting-and-typescript](https://github.com/zeit/next.js/tree/canary/examples/with-firebase-hosting-and-typescript)
* `npm run serve`
  * Has no `pre` task that actually builds the app. Requires manual running of all build scripts.
  * Will choke on windows because trying to set environment variables with `NODE_ENV=production`
* Outdated Typescript and Tslint
* Not being able to deploy because `firebase-tools` being of a deprecated version.
* Structure, which I understand is based on `firebase-tools` generation, is confising with `src/functions/src` being generally bad structuring.

I remedied this and also improved some other factors:

* Remove dependency `prettier` as it is unused (f4d6f54)
* Upgrade all dependencies (09a9193)
  * Use upgraded firebase dependencies to deploy to node 8 environment (87e1e09, 7d8055b)
  * Remove deprecated tslint rule `no-unused-variable` (9392162)
* Flattened filestructure in `src/functions` (097a25a)
* Use ES import when importing next (6c99adb)
* Fixed incorrect name and added somewhat to the description in package.json.
  `with-firebase-hosting` → `with-firebase-hosting-and-typescript` (1ffa0b5)
* Fixed `serve` script by building before running, using [`cross-env`](https://www.npmjs.com/package/cross-env) to set environment variables and remove unecessary flag. (3a1e221, 422ccee, 8811e44)
* Add `.firebase` cache to `.gitignore` (4d7cbe4)
* Add `-C` (clean) flag when copying dependency files `copy-deps` (0826708)
* Use `strict: true` in the functions tsconfig (229b04f)

This was tested by running serve on windows and linx(WSL) and deploy on linux(WSL)

---

This is based on #5819 but correctly based from `canary`
2018-12-11 23:24:18 +01:00
Oscar Busk
82c5cc38d5 Update/fix "examples/with-firebase-hosting" (#5853)
Hello! 
I was looking at the [`with-firebase-hosting`](/zeit/next.js/tree/canary/examples/with-firebase-hosting) example and was having some various issues running it:

* `npm run serve` will choke on windows because trying to set enviroment variables with `NODE_ENV=production`
* `npm run build-funcs` failing because of babeljs mismatches between `@babel/cli@^7.0.0-rc.1` and `next@^6.0.3`
* Not being able to deploy because `firebase-tools` being a deprecated version.

I remedied this and also improved some other factors:

* Use standard JSON formatting on `package.json` so that `npm install` doesn't cause changes on every run. (a83e930)
* Remove "prettier" as a devDependency as there is no use of it in the example and most other examples does not have it as a dependency. (6095663)
* Update all dependencies. The simple usecase in this example didn't really require any changes to the code. (ccde086)
  * [`firebase-admin@6`](https://github.com/firebase/firebase-admin-node/releases/tag/v6.0.0)
  * [`firebase-functions@2`](https://github.com/firebase/firebase-functions/releases/tag/v2.0.0) 
  * [`firebase-tools@4`](https://github.com/firebase/firebase-tools/releases/tag/v4.0.0)
  * [`firebase-tools@5`](https://github.com/firebase/firebase-tools/releases/tag/v5.0.0)
  * [`firebase-tools@6`](https://github.com/firebase/firebase-tools/releases/tag/v6.0.0)
* Make `npm run serve` runnable on windows using [`cross-env`](https://www.npmjs.com/package/cross-env). (b20dda7)
* Update `.gitignore` to ignore firebase cache (bf761b7)
* Remove `src/app/.babelrc` that seems to have been added as a previous bugfix but doesn't seem to do anything currently. (1b02045)
* Remove point from [`README.md`](https://github.com/zeit/next.js/blob/canary/examples/with-firebase-hosting/README.md) that was mentioning any `predeploy` hooks in `firebase.json` as they were removed in 4f4b7a1bce. (5636d9f)
* Use the possibility added by upgrading `firebase-tools` to [`>=4.0.0`](https://github.com/firebase/firebase-tools/releases/tag/v4.0.0) and `firebase-functions` to [`>=2.0.0`](https://github.com/firebase/firebase-functions/releases/tag/v2.0.0) to make the deployable functions use node 8 rather than node 6. Also make babel compile with node 8 as target for less polyfills etc. (c954cc2)
  * Added comment to [`README.md`](https://github.com/zeit/next.js/blob/canary/examples/with-firebase-hosting/README.md) explaining how firebase deploys to node 8 and that babel will compile code for node 8. (d8b2e65, 91953dc)

This was tested to `serve` on windows, linux(WSL) and on mac. Deploy was tested on linux(WSL) and mac.

---

This PR is a based on #5806 with correct base.

---

🔔 @jthegedus @timneutkens
2018-12-11 11:45:58 +01:00
Adam Stankiewicz
cd1d3640a9 Improve with-sentry example (#5727)
* Improve with-sentry example

* remove nonexisting keys from request and update errorInfo handling

* readd query and pathname

* read query and params and add pathname and query to client
2018-12-10 23:59:12 +01:00
Tim Neutkens
6b7864e57e Fix linting 2018-12-10 22:05:53 +01:00
Diogo Dutra
a996fba09c Added a new example with relay modern and a graphql server with express. (#4670)
* Added a new example with relay modern and a graphql server with express.

* removed .graphqlconfig file from with-relay-modern-server-express example
2018-12-10 16:50:35 +01:00
Saro Vindigni
2fdd43c307 Create with-firebase-hosting-and-docker example (#5373)
* ADD with-firebase-hosting-and-docker example

* Improve doc
2018-12-10 16:19:57 +01:00
Leon
9ddc1d7b6f update styletron example (#5573) 2018-12-10 15:04:58 +01:00
Justin Stahlman
6a75118247 Use more recent version of svg plugin (#5788)
The demo did not work. Updating to babel-plugin-inline-react-svg v1.0.1 did work.
2018-12-10 14:45:15 +01:00
moflo
b0148cf453 Update for use with Firestore (#5793)
Google seems to be deprecated the legacy realtime database and moving towards default use of Firestore, although it's still officially in beta. This PR migrates towards Firestore and the recommended loading methods for the Firebase 5.6.0 libraries. Note: the Firebase and Firebase-Admin dependencies should be updated to 5.6.0 and 6.3.0 respectively.
2018-12-10 14:25:40 +01:00
Bill Searle
77d5f36eea improved ant-design with less (#5847)
Hey @timneutkens I've updated this example a bit.

- Fixed `/asserts` spelling to `/assets`.
- Removed the `/assets/styles.less` as importing this caused the entire ant-design css sheet to be loaded, now only the React components imported will have their styles loaded via the babel plugin which was already configured. Resulted in dropping the CSS for this example from ~630kb to ~220kb.
- Removed `index.js` as it's not needed.
2018-12-10 12:20:01 +01:00
Peter Kellner
c03d25b97a Added length calculation for insert of cache rather then default to 1… (#5835)
* Added length calculation for insert of cache rather then default to 1. changed default cache from 100 to 100MB

* adjusted for lint
2018-12-06 23:17:59 +01:00
Jeroen Knoops
510eb5771c Updates version of firebase (#5829)
Firebase has some issues with grpc. ( Firebase has some issues with grpc ) This is resolved in a newer version of firebase. Especially with npm 6.4.1. https://github.com/firebase/firebase-js-sdk/issues/1341

Issue #5688
2018-12-06 11:17:18 +01:00
Hirofumi Wakasugi
e463c2a1bb Remove outdated note from with-jest example (#5820) 2018-12-05 11:34:40 +01:00
tylim
81cfea7d90 improve Unstated example so that it can shares state when switching pages (#5822)
* add new example

* update gitignore

* fix lint

* fix linting

* fix linting again

* update unstated example

* remove unsued var

* update readme
2018-12-05 11:32:45 +01:00
nodegin
cdd5129ef3 Simplify with-absolute-imports example (#5812)
* Delete .babelrc

* Update package.json

* Create next.config.js

* Update next.config.js
2018-12-04 16:38:39 +01:00
陈雨童
7ffcb0bf86 Update polyfills (#5814)
#5521
2018-12-04 14:53:24 +01:00
M
38db893a33 fix typo (#5813) 2018-12-04 12:48:15 +01:00
Jeroen Knoops
fcae74c49d Removes some quotes in with-emotion example (#5802)
There were some strange quotes and misaligned html on the page in the `with-emotion` example.
2018-12-04 11:55:33 +01:00
Jess Telford
2f3b0c4de6 MDX example app (#5796)
Example deployment on now v2: https://nextjswith-mdxexample-r8b1vzjbn.now.sh
2018-12-03 19:41:12 +01:00
Matthew Lilley
cefbb84230 Fix for locale.split is not a function. (#5794)
* Fix for locale.split is not a function.

Following from https://github.com/zeit/next.js/pull/5488

- Renamed languages to supportedLanguages
- Firstly, accept languages based on supportedLanguages
- And finally, accept a single language, if it returns false, the default of 'en' is used.

I looked at the navigator library, which is used by 'accept', this should be a more solid solution, since we can now know that `const locale` is always a string.

// Before (Sometimes returns an array as `const local`)
const locale = accept.language(languages) || 'en' 

// After (Always returns a string)
const locale = accept.language(accept.languages(supportedLanguages)) || 'en';

* Update server.js

Update variable name.
2018-12-03 09:10:31 -08:00
Justin Stahlman
c43975a927 Use more recent version of svg plugin (#5788)
The demo did not work. Updating to babel-plugin-inline-react-svg v1.0.1 did work.
2018-12-02 14:17:23 +01:00
Steven Bell
af1d10c941 update with-emotion example to emotion 10 (#5770) 2018-11-29 20:12:25 +01:00
Jan Mühlemann
09a8960f1a Add next-i18next as the solution to integrate i18next into next.js (#5761)
* replace all i18next related examples with the recommended next-i18next module

* update readme
2018-11-28 20:39:54 +01:00
garnerp
c5630d3bc5 Fix with-babel-macros by upgrading packages (#5762)
Added next/babel in .babelrc
Upgraded babel-macros to babel-plugin-macros
Upgraded preval.macro
2018-11-28 20:34:46 +01:00
Anderson Leite
48d3ae2dd6 Remove unused vars and fix typo. (#5752)
- Removed unused "render" and "appPort" var from tests
- Fix typo on "occured" to "occurred"
2018-11-27 12:28:34 +01:00
Isaac Hinman
c178e98a67 Move with-i18next example to external repo (#5743) 2018-11-25 19:25:33 +01:00
Voon Ming Hann
e3c7d3fdb8 firebase cloud messaging example (#5689) 2018-11-25 16:37:34 +01:00
Ting-Hsiang Hsu
21d5aebd53 feat(example): add react-relay-network-modern example (#5349)
In this example, we can:
- `QueryRenderer` SSR
- caching the data
- use the feature of `react-relay-network-modern` which is the powerful tool for `relay-modern`

I copy the example `with-relay-modern`, but I just modified the code. Some detail are not modified.
If you think this example is needed, I will fix those. Otherwise, close this **PR** to let me know this example is not needed.
2018-11-25 15:14:36 +01:00
Obed Marquez Parlapiano
b63487c331 Update with-firebase-auth example (#5742)
- The with-firebase-auth example won't run unless a database with proper rules is created first. 
- Add a small error callback to addDbListener to help with debugging if someone's database connection doesn't work.
2018-11-25 14:57:15 +01:00
Hozefa
401594ed36 remove glamorous example since its no longer maintained (#5738)
Since glamorous is [no longer maintained](https://github.com/paypal/glamorous#status-unmaintained) removing it from readme.
2018-11-23 21:18:13 +01:00
Matt Jewell
7076727d3e Fix location of production server file (#5731)
(At least with my set up, mac osx, node 10.13.0, yarn 1.12.1)

Couldn't get the server to start with `npm start`, this appears to fix that
2018-11-22 16:55:47 +01:00
Darryl
f177be9e05 Fix bug report with-portals example #5694 (#5714)
I'm trying to contribute on resolving issues,
hope this help.

Fixes #5694
2018-11-21 09:25:00 +01:00
Már Örlygsson
766d7d5fe4 Run initializeStore() only once per route on server (#5644)
On the server `props.initialMobxState` received by the `constructor` is a fully functioning mobx store that was instantiated by `getInitialProps()` only a few ticks earlier.
Thus, creating a new instance is unneccessary.

In the browser, however, `props.initialMobxState` is a hydrated plain object and thus the store needs to be initialized.
2018-11-20 15:53:28 +01:00
paulogdm
e5d8eb2374 Update README.md (#5698)
Fixes #5680
2018-11-18 20:45:22 +01:00
Luc
74abf25396 remove <title> in _document.js in examples (#5679) 2018-11-15 16:31:56 +01:00
luffyZhou
8ed7795495 update && optimize with-ant-design-less example (#5658)
Current with-ant-design-less example has some problems.

- Upgrade next7, console found a 404 error.
![](https://user-gold-cdn.xitu.io/2018/11/11/167015fb80017e79?w=2606&h=1000&f=jpeg&s=124801)
  > After upgrade next7, .next folder didn't find /static/style.css and there is /static/css/style.chunk.css.
- The /_next/static/style.css link don't need be placed in the <Head> tag. The style.chunk.css file will be add in the head tag automatically after build.
- The project with more pages include _app.js, _document.js...the antd-custom.less will not work well.
  > The solution is use `modifyVars` of  `lessLoaderOptions`. It work well in my project~
2018-11-11 18:09:30 +01:00
Adam Lane
b36382bb83 update with-reasonml dependencies (#5651) 2018-11-10 08:09:51 +01:00
Jamie Barton
196f71feb7 Refactor with tailwindcss example to use next-css (#5461)
Instead of bundling `postcss-cli` we can now make use of `@zeit/with-css`.

This also means we can get rid of the `<style>` import and concurrent build step for css. 🎉
2018-11-08 14:42:55 +01:00
Tim Neutkens
ed2c379fc7
Simplify styled-components example (#5631)
- use `enhanceApp` so that styled-components used in _app.js are server rendered
- call parent getInitialProps, fixes #5629
- return `styles`, making the render() method obsolete.

cc @mxstbr @probablyup
2018-11-08 12:43:16 +01:00
Giuseppe
76d534881f Add with-external-styled-jsx-sass (#5618)
because of this https://twitter.com/rem/status/1059563246007566336
2018-11-07 18:42:44 +01:00
Davide Curletti
819efed2c0 Fix incorrect path for ts server example (#5612)
The customer-server-typescript example has a bug where the `yarn start` command has the incorrect path to the server entry point file.
2018-11-07 14:33:33 +01:00
Már Örlygsson
420f74c867 examples/with-mobx : Fix and simplify (#5537)
I spent far too much time fiddling with this example project before realizing it contained a bug in the store initialization logic and it was a bit more complex than it needed to be.

* The custom server was not needed
* The store-initialization did effectively the same thing twice for no reason
* And wrapping MyApp component in a HOC was wholly unnecessary indirection

My changes are split into four discrete commits for clarity.
2018-11-06 10:18:26 +01:00
Rafael Cossovan
14668aa3ee Update next.config.js (#5593)
Tests using a case insensitive expression.
Fixes assets output folder.
Reduce `limit` so we can use `file-loader` on larger files.
2018-11-04 19:42:53 +01:00
AJ Livingston
cb312eb18b Examples: with-typings-for-css-modules (#5446)
* added example for using typings-for-css-modules-loader

* Update examples/with-typings-for-css-modules/README.md

* Update examples/with-typings-for-css-modules/README.md

* Update examples/with-typings-for-css-modules/next.config.js
2018-11-02 23:21:59 +01:00
Henrik Wenz
dccbc1ea35 Update examples/with-antd-mobile (#5495)
* Update examples/with-antd-mobile

- Reduced noise
- Simplify setup

* Create more more complex example
2018-11-02 19:50:30 +01:00
Giuseppe
c95abc209b Add with style-sheet example (#5572)
* Remove pathname (#5428)

Same as #5424

* fix typo (#5451)

* Add with style-sheet example

* Fix readme

* Fix typo
2018-11-01 14:05:39 +01:00
Anton Moiseev
e8a9472bcd Remove broken link from progressive-render example (#5552)
- Looks like no other example provides a link to a hosted demo
- There is the "Deploy to now" badge, so it can be deployed on demand when needed
- The link is broken anyway
- Probably any example hosted by an individual contributor sooner or later will be cleaned up, doesn't feel like a reliable way to provide a live demo
2018-10-30 11:35:41 +01:00
Anton Moiseev
58583a2b81 Examples: fix <title> warning in the TypeScript example (#5549)
* Replace _document.tsx example with _app.tsx

* Fix title

* Remove _app.tsx
2018-10-29 19:32:01 +01:00
Janek Rahrt
a7b6ffa914 Fix ssr auth bug and dependency problems (#5543)
* fix graphql dep

* fix ssr auth bug

* fix linting issues
2018-10-28 13:13:28 -07:00
Quentin Sommer
def2ce7eda feat: Added react-useragent example (#5507)
Add an example how to use `@quentin-sommer/react-useragent` with next.

I've been asked this https://github.com/quentin-sommer/react-useragent/issues/10 and plan to link this example as reference!

See readme for details
2018-10-23 23:33:41 +02:00
David Calhoun
ba5f1b2c21 [change] Update react-native-web example (#5489)
Utilize ES modules, which are now the default export for
`react-native-web`.

_NOTE:_ [This example requires `next@^7.0.0`](https://bit.ly/2PaEhao).
2018-10-22 22:32:24 +02:00
Christopher Lee
98eb710189 removed deprecated useBuiltIns from .babelrc (#5486) 2018-10-20 21:09:03 +02:00
ultrox
2ce3f39585 fix(examples/with-react-intl): Bug when accept-language is anything other then 'en' (#5488)
package accept returns false if can't find language in offered list of languages, then later on
bool is attempted to be split, and app crashes in prod & dev
2018-10-20 20:11:59 +02:00
Tim Neutkens
e8c73b45fa Run yarn lint —fix 2018-10-20 19:37:42 +02:00
Henrik Wenz
18488f47b0 Fix linter (#5350)
* Fix linter

* Add test env

* Fix lint errors
2018-10-20 17:00:01 +02:00
Anthony Cerbic
4be4452fd8 Add cloud9 (c9.io) to examples (#5448) 2018-10-20 16:58:21 +02:00
komkanit
3e72da686f upgrade react-native-web to fix bug (#5459) 2018-10-20 16:58:03 +02:00
zsx
5b6489ebf3 Fix the bug with not passing props to wrapped element of with-rematch example (#5483) 2018-10-20 14:31:26 +02:00
Seth Bergman
f5156b2297 Fixed broken link (#5479)
Fixes link to 404 page in sentry docs
2018-10-19 14:52:41 +02:00
Jerome Fitzgerald
6eba3ad9ab 🐳️ multistage: remove devDependencies (#5477)
Docker Multistage
* Remove `devDependencies` from `./node_modules`
 in `builder` for faster copy on `base` init

* Added `isomorphic-unfetch` to show it not
 being copied over to `base`.

* `isomorphic-fetch` will still show from `next`
2018-10-19 00:36:04 +02:00
Gerhard Preuss
9634bad79d Remove note on OSS/non-OSS issue (#5474)
I successfully deployed this example with `now` and `now --public` (I am on premium plan).
Did this before deploy

```sh
$ cp Dockerfile.multistage Dockerfile
```
2018-10-18 11:14:17 +02:00