Commit graph

764 commits

Author SHA1 Message Date
dengyunxie
4744fbd096 Make the file beautiful (#4694)
unified format😀😋
2018-06-29 17:02:00 +02:00
Niklas Wagner
dde20fc841 Added note for AWSAppSyncClient (#4611)
I had some trouble to get server side rendering with the AWSAppSyncClient working. I finally found a solution in https://github.com/awslabs/aws-mobile-appsync-sdk-js/issues/82 but it might be worth to share it here as well. Instead of adding a big code block to each file I'll just refer to this Pull Request.

______

In case you want to use the `AWSAppSyncClient` you just need to replace the `create()` function with this function:
```jsx
import AWSAppSyncClient from 'aws-appsync';
import { AUTH_TYPE } from 'aws-appsync/lib/link/auth-link';

function create(initialState) {
  const client = new AWSAppSyncClient({
    url: AWS_AppSync.graphqlEndpoint,
    region: AWS_AppSync.region,
    auth: {
      type: AUTH_TYPE.API_KEY,
      apiKey: AWS_AppSync.apiKey,

      // Amazon Cognito Federated Identities using AWS Amplify
      //credentials: () => Auth.currentCredentials(),

      // Amazon Cognito user pools using AWS Amplify
      // type: AUTH_TYPE.AMAZON_COGNITO_USER_POOLS,
      // jwtToken: async () => (await Auth.currentSession()).getIdToken().getJwtToken(),
    },
    disableOffline: true,
  }, {
    cache: new InMemoryCache().restore(initialState || {}),
    ssrMode: true
  });

  return client;
}
```
2018-06-29 10:08:26 +02:00
Bünyamin Benny Genel
6ed2da4575 with-socket.io Example updated with _app.js (#4644)
with-socket.io example was using a single index file and was managing connection in there. This would lead handling connection (disconnecting and reconnecting) in each added page.

I updated example with addition of `_app.js` and handled connection in there. This helped only subscribing to event in page and maintaining connection throughout example.
2018-06-23 22:17:37 +02:00
Brice BERNARD
0989ecc223 [with-jest] Move jest deps to devDeps (#4650) 2018-06-22 17:12:31 +02:00
Bünyamin Benny Genel
67cb87adb5 Added with-unstated example (#4628)
Small example app using [unstated](https://github.com/jamiebuilds/unstated) library. Example uses components and logic from [with-redux](https://github.com/zeit/next.js/tree/canary/examples/with-redux) example.
2018-06-19 21:50:37 +02:00
Telegin Evgeniy
cdfcde16a6 Update with-universal-configuration (#4624)
resolves #4623
2018-06-17 13:50:52 +02:00
Telegin Evgeniy
3566b92900 Update with-markdown example (#4612)
I have updated [examples/with-markdown](https://github.com/zeit/next.js/tree/canary/examples/with-markdown) in order to make it works with next 6 🎉 

<details>
<summary>Error</summary>
Error: Plugin/Preset files are not allowed to export objects, only functions. In /Users/zhenyatelegin/Desktop/next.js/examples/with-markdown/node_modules/markdown-in-js/babel.js
</details>
2018-06-15 20:55:14 +02:00
Telegin Evgeniy
6cdd7cb291 Update with-absolute-imports example to Babel 7 (#4610)
Hello!

I have updated `babel-plugin-module-resolver` to `^3.1.1` and moved it to `devDependencies` in [with-absolute-imports](https://github.com/zeit/next.js/tree/canary/examples/with-absolute-imports) example to make it work with Babel 7 :)

## Error logs
```
zhenyatelegin@MBP-Zhenya  ~/Desktop/next.js/examples/with-absolute-imports   canary  yarn build
yarn run v1.5.1
warning package.json: No license field
$ next build
> Failed to build
{ Error: (client) ./pages/index.js
Module build failed: Error: Cannot find module 'babel-plugin-module-resolver' from '/Users/zhenyatelegin/Desktop/next.js/examples/with-absolute-imports'
    at Function.module.exports [as sync] (/Users/zhenyatelegin/Desktop/next.js/node_modules/resolve/lib/sync.js:40:15)
    at resolveStandardizedName (/Users/zhenyatelegin/Desktop/next.js/node_modules/@babel/core/lib/config/files/plugins.js:78:29)
    at resolvePlugin (/Users/zhenyatelegin/Desktop/next.js/node_modules/@babel/core/lib/config/files/plugins.js:27:10)
    at loadPlugin (/Users/zhenyatelegin/Desktop/next.js/node_modules/@babel/core/lib/config/files/plugins.js:35:18)
    at createDescriptor (/Users/zhenyatelegin/Desktop/next.js/node_modules/@babel/core/lib/config/config-descriptors.js:152:21)
    at /Users/zhenyatelegin/Desktop/next.js/node_modules/@babel/core/lib/config/config-descriptors.js:104:12
    at Array.map (<anonymous>)
    at createDescriptors (/Users/zhenyatelegin/Desktop/next.js/node_modules/@babel/core/lib/config/config-descriptors.js:103:27)
    at createPluginDescriptors (/Users/zhenyatelegin/Desktop/next.js/node_modules/@babel/core/lib/config/config-descriptors.js:99:10)
    at /Users/zhenyatelegin/Desktop/next.js/node_modules/@babel/core/lib/config/config-descriptors.js:50:19
    at plugins (/Users/zhenyatelegin/Desktop/next.js/node_modules/@babel/core/lib/config/config-descriptors.js:40:25)
    at mergeChainOpts (/Users/zhenyatelegin/Desktop/next.js/node_modules/@babel/core/lib/config/config-chain.js:296:68)
    at /Users/zhenyatelegin/Desktop/next.js/node_modules/@babel/core/lib/config/config-chain.js:251:7
    at buildRootChain (/Users/zhenyatelegin/Desktop/next.js/node_modules/@babel/core/lib/config/config-chain.js:85:20)
    at loadPrivatePartialConfig (/Users/zhenyatelegin/Desktop/next.js/node_modules/@babel/core/lib/config/partial.js:41:53)
    at Object.loadPartialConfig (/Users/zhenyatelegin/Desktop/next.js/node_modules/@babel/core/lib/config/partial.js:66:16)
 @ multi ./pages/index.js
    at /Users/zhenyatelegin/Desktop/next.js/dist/server/build/index.js:144:31
    at runWithDependencies (/Users/zhenyatelegin/Desktop/next.js/node_modules/webpack/lib/MultiCompiler.js:154:4)
    at /Users/zhenyatelegin/Desktop/next.js/node_modules/async/dist/async.js:1140:9
    at /Users/zhenyatelegin/Desktop/next.js/node_modules/async/dist/async.js:473:16
    at iteratorCallback (/Users/zhenyatelegin/Desktop/next.js/node_modules/async/dist/async.js:1064:13)
    at /Users/zhenyatelegin/Desktop/next.js/node_modules/async/dist/async.js:969:16
    at /Users/zhenyatelegin/Desktop/next.js/node_modules/async/dist/async.js:1137:13
    at runCompilers (/Users/zhenyatelegin/Desktop/next.js/node_modules/webpack/lib/MultiCompiler.js:96:47)
    at fn (/Users/zhenyatelegin/Desktop/next.js/node_modules/webpack/lib/MultiCompiler.js:101:6)
    at compiler.run (/Users/zhenyatelegin/Desktop/next.js/node_modules/webpack/lib/MultiCompiler.js:150:5)
    at emitRecords.err (/Users/zhenyatelegin/Desktop/next.js/node_modules/webpack/lib/Compiler.js:265:13)
    at Compiler.emitRecords (/Users/zhenyatelegin/Desktop/next.js/node_modules/webpack/lib/Compiler.js:371:38)
    at emitAssets.err (/Users/zhenyatelegin/Desktop/next.js/node_modules/webpack/lib/Compiler.js:258:10)
    at applyPluginsAsyncSeries1.err (/Users/zhenyatelegin/Desktop/next.js/node_modules/webpack/lib/Compiler.js:364:12)
    at next (/Users/zhenyatelegin/Desktop/next.js/node_modules/tapable/lib/Tapable.js:218:11)
    at Compiler.compiler.plugin (/Users/zhenyatelegin/Desktop/next.js/node_modules/webpack/lib/performance/SizeLimitsPlugin.js:99:4)
  errors:
   [ '(client) ./pages/index.js\nModule build failed: Error: Cannot find module \'babel-plugin-module-resolver\' from \'/Users/zhenyatelegin/Desktop/next.js/examples/with-absolute-imports\'\n    at Function.module.exports [as sync] (/Users/zhenyatelegin/Desktop/next.js/node_modules/resolve/lib/sync.js:40:15)\n    at resolveStandardizedName (/Users/zhenyatelegin/Desktop/next.js/node_modules/@babel/core/lib/config/files/plugins.js:78:29)\n    at resolvePlugin (/Users/zhenyatelegin/Desktop/next.js/node_modules/@babel/core/lib/config/files/plugins.js:27:10)\n    at loadPlugin (/Users/zhenyatelegin/Desktop/next.js/node_modules/@babel/core/lib/config/files/plugins.js:35:18)\n    at createDescriptor (/Users/zhenyatelegin/Desktop/next.js/node_modules/@babel/core/lib/config/config-descriptors.js:152:21)\n    at /Users/zhenyatelegin/Desktop/next.js/node_modules/@babel/core/lib/config/config-descriptors.js:104:12\n    at Array.map (<anonymous>)\n    at createDescriptors (/Users/zhenyatelegin/Desktop/next.js/node_modules/@babel/core/lib/config/config-descriptors.js:103:27)\n    at createPluginDescriptors (/Users/zhenyatelegin/Desktop/next.js/node_modules/@babel/core/lib/config/config-descriptors.js:99:10)\n    at /Users/zhenyatelegin/Desktop/next.js/node_modules/@babel/core/lib/config/config-descriptors.js:50:19\n    at plugins (/Users/zhenyatelegin/Desktop/next.js/node_modules/@babel/core/lib/config/config-descriptors.js:40:25)\n    at mergeChainOpts (/Users/zhenyatelegin/Desktop/next.js/node_modules/@babel/core/lib/config/config-chain.js:296:68)\n    at /Users/zhenyatelegin/Desktop/next.js/node_modules/@babel/core/lib/config/config-chain.js:251:7\n    at buildRootChain (/Users/zhenyatelegin/Desktop/next.js/node_modules/@babel/core/lib/config/config-chain.js:85:20)\n    at loadPrivatePartialConfig (/Users/zhenyatelegin/Desktop/next.js/node_modules/@babel/core/lib/config/partial.js:41:53)\n    at Object.loadPartialConfig (/Users/zhenyatelegin/Desktop/next.js/node_modules/@babel/core/lib/config/partial.js:66:16)\n @ multi ./pages/index.js',
     '(server) ./pages/index.js\nModule build failed: Error: Cannot find module \'babel-plugin-module-resolver\' from \'/Users/zhenyatelegin/Desktop/next.js/examples/with-absolute-imports\'\n    at Function.module.exports [as sync] (/Users/zhenyatelegin/Desktop/next.js/node_modules/resolve/lib/sync.js:40:15)\n    at resolveStandardizedName (/Users/zhenyatelegin/Desktop/next.js/node_modules/@babel/core/lib/config/files/plugins.js:78:29)\n    at resolvePlugin (/Users/zhenyatelegin/Desktop/next.js/node_modules/@babel/core/lib/config/files/plugins.js:27:10)\n    at loadPlugin (/Users/zhenyatelegin/Desktop/next.js/node_modules/@babel/core/lib/config/files/plugins.js:35:18)\n    at createDescriptor (/Users/zhenyatelegin/Desktop/next.js/node_modules/@babel/core/lib/config/config-descriptors.js:152:21)\n    at /Users/zhenyatelegin/Desktop/next.js/node_modules/@babel/core/lib/config/config-descriptors.js:104:12\n    at Array.map (<anonymous>)\n    at createDescriptors (/Users/zhenyatelegin/Desktop/next.js/node_modules/@babel/core/lib/config/config-descriptors.js:103:27)\n    at createPluginDescriptors (/Users/zhenyatelegin/Desktop/next.js/node_modules/@babel/core/lib/config/config-descriptors.js:99:10)\n    at /Users/zhenyatelegin/Desktop/next.js/node_modules/@babel/core/lib/config/config-descriptors.js:50:19\n    at plugins (/Users/zhenyatelegin/Desktop/next.js/node_modules/@babel/core/lib/config/config-descriptors.js:40:25)\n    at mergeChainOpts (/Users/zhenyatelegin/Desktop/next.js/node_modules/@babel/core/lib/config/config-chain.js:296:68)\n    at /Users/zhenyatelegin/Desktop/next.js/node_modules/@babel/core/lib/config/config-chain.js:251:7\n    at buildRootChain (/Users/zhenyatelegin/Desktop/next.js/node_modules/@babel/core/lib/config/config-chain.js:85:20)\n    at loadPrivatePartialConfig (/Users/zhenyatelegin/Desktop/next.js/node_modules/@babel/core/lib/config/partial.js:41:53)\n    at Object.loadPartialConfig (/Users/zhenyatelegin/Desktop/next.js/node_modules/@babel/core/lib/config/partial.js:66:16)\n @ multi ./pages/index.js' ],
  warnings: [] }
error An unexpected error occurred: "Command failed.
Exit code: 1
Command: sh
Arguments: -c next build
Directory: /Users/zhenyatelegin/Desktop/next.js/examples/with-absolute-imports
Output:
".
info If you think this is a bug, please open a bug report with the information provided in "/Users/zhenyatelegin/Desktop/next.js/examples/with-absolute-imports/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
```
2018-06-15 11:10:25 +02:00
Constantine
6d47d03611 with-styled-components: Move babel plugin to dev dependency (#4602) 2018-06-14 14:33:41 +02:00
Lon Ilesanmi
81802d2e60 Clean up Redux example (#4594)
- Remove unused imports

- Edit some comments

- Rename Wrapper App Class
2018-06-13 14:40:59 +02:00
James Hegedus
4f4b7a1bce with-firebase-hosting: fix npm scripts, remove firebase.json predeploy scripts (#4593)
* remove `predeploy` scripts from `firebase.json` in favour of `npm` `pre` scripts as they are consistent across `deploy` and `serve` commands. (to revisit once Firebase add support in the `firebase.json` for `preserve`)
* update deps
* workaround some bug where Babel could not resolve the standard `next/babel` config. Explicitly defining this seems to remove the issue.
* closes #4562
2018-06-12 17:37:13 +02:00
Telegin Evgeniy
567da9adbf Upgrade gh-pages example to next 6.0.3 (#4575)
Hello! I have got an error while building [gh-pages example](https://github.com/zeit/next.js/tree/canary/examples/gh-pages) with next 6.0.3. I have found solution to use CommonJS modules in `.babelrc`

This resolves #4227
2018-06-10 13:08:52 +02:00
Brice BERNARD
7e8acf3a30 [with-apollo-auth] simplify apolloState prop (#4563)
We don't need `.data` as `apollo.cache.extract()` returns at least `{}` when cache is empty
2018-06-08 11:48:10 +02:00
Brice BERNARD
e318de62c0 [with-apollo-auth] Remove useless check from constructor (#4560)
We don't pass apolloClient as props, so I removed the check as confusing and always false.

see https://github.com/zeit/next.js/blob/canary/examples/with-apollo-auth/lib/withApollo.js#L72-L75

Again please explain me if I am wrong :)
2018-06-08 10:27:31 +02:00
Brice BERNARD
1a8bdba56b [with-apollo-auth] Remove useless apolloState from App's props (#4554)
App component does not need/use apolloState prop, so let's remove it. If I'm wrong please explain me the purpose of this.
2018-06-08 08:54:19 +02:00
Giau Tran Minh
631e6c7eba Added example for Ant Design with LESS (#4520)
* Added example for Ant Design with LESS

* Fix ESLINT
2018-06-07 13:14:27 +02:00
Eugene Sokovikov
3684231add stop duplicating charset (#4546)
**Make amp example valid**

I'm using amp validator chrome plugin which shows that `meta charset=utf-8` is duplicated.
I assume that `Head` component adds `<meta charset="utf-8" class="next-head next-head">`
anyway.
And this line just duplicating it.

<img width="987" alt="screen shot 2018-06-06 at 15 54 45" src="https://user-images.githubusercontent.com/1488195/41036743-198ca00a-69a2-11e8-978c-5a5cb5a994d2.png">
2018-06-06 14:23:20 +02:00
Nick Gauthier
bbbf7ab498 Upgrade with-jest-typescript example to next 6.0.0 (#4543)
Hello! I ran into an issue using typescript and jest with next 6.0.0. I was able to work through fixing it and I wanted to share my solution back to next.js, by upgrading the with-jest-typescript example to next 6.0.0.

The steps I followed were:

1. `npx babel-upgrade --write` which added babel-core@^7.0.0-bridge.0 to allow jest's babel 6 to play nice with next's babel 7
2. Remove `ts-jest` and replace with `babel-jest` to use babel to transform the typescript code, as is done when the dev and production builds run
3. Update the babelrc to use commonjs modules in test mode to be compatible with jest

Also, I removed the `NODE_ENV=test` on the jest task, because jest sets the env to test anyways, and I'm on windows where this code is incorrect. The other option is to use `cross-env` but I felt it was simpler to just remove the environment override.

To my knowledge, this PR would help on the following issues:

#3663 #4227 #4531 #4528 #4239
2018-06-06 10:31:21 +02:00
Tobi
905da6f92b fixes bug in with-react-intl example: messages and locale variables were undefined on CSR (#4517) 2018-06-01 23:16:11 +02:00
Jorge Cuadra
8082eddaef Remove unused import (patch) (#4493) 2018-05-29 19:33:21 +02:00
Shu Ding
8cbc0be845 Add with-next-less example (#4492) 2018-05-29 10:37:03 +02:00
daniel tea
832c494470 fix README typo (#4476)
`idead` to `idea`
2018-05-26 12:11:09 +02:00
Tim Neutkens
2e9bed098d Remove page-transitions example 2018-05-25 14:19:40 +02:00
Kelly Burke
3f6834dfec sitemap.xml and robots.txt example (#4163)
This example app shows you how to set up sitemap.xml and robots.txt files for proper indexing by search engine bots.
2018-05-25 14:01:32 +02:00
Luke Barton
cbfdcce32d Update typescript examples to use 1.0.1 of next-typescript (#4472)
* Update typescript examples to use 1.0.1 of next-typescript

* Add .babelrc modifications to upgraded typescript examples
2018-05-25 11:28:35 +02:00
Rob Brennan
0330962618 Improve custom server typescript example v2 (#4470) 2018-05-25 11:03:59 +02:00
Dimka Vasilyev
763ddc08a1 added support flex: 1 and and tag support Dimensions (#4460) 2018-05-23 22:47:16 +02:00
Tim Neutkens
c461d46efd Fix viewport issue in with-react-native-web 2018-05-23 22:44:22 +02:00
Jerome Fitzgerald
dbe28e1471 📝️Restructure with-material-ui per #4439 (#4444)
Restructure with-material-ui (patch)
2018-05-21 22:14:31 +02:00
Luis Fernando Alvarez D
2ef80a354c Fixed error with the cookie parser in with-apollo-auth (#4445)
Fixes #4442
2018-05-21 21:51:00 +02:00
Tage A. L. K
54e152b11b Minor update to with-apollo-auth (#4426)
Changes
* Update dependencies.
* Remove sending client prop to component on pages.
* Use withApollo correctly on components.
* Use `client.cache.reset()` instead of `prop.client.resetStore()`.

@adamsoffer @timneutkens
2018-05-21 12:13:56 +02:00
James Hegedus
57be892d02 with-firebase-hosting: update to work with next v6 (#4435)
* with-firebase-hosting: update next.js 6, readme about customization

* now next.js 6 is on Babel 7, remove conflicting babel deps
* update Next Server/Cloud Function .babelrc config
* update other deps: Cloud Functions to 1.x.x etc
* rm install-deps script as it is no longer used on deployment (firebase does not upload node_modules)
* make scripts consistent in their wrapping of dirs with \" (escaped double quotes)

* with-firebase-hosting: pin next to "latest" version

* with-firebase-hosting: fix lint errors
2018-05-21 10:28:09 +02:00
Sampson Oliver
35d32b48cc Create with-firebase-hosting-and-typescript example (#4443)
Adds an example based off of @jthegedus work on firebase hosting, compatible with next v6 and using typescript in both the firebase functions and the next app.
2018-05-21 10:25:45 +02:00
Luis Fernando Alvarez D
915673fcd6 Example updated: with-apollo-auth to Next 6 (#4420) 2018-05-18 10:55:12 +02:00
Luc
db545d9bc9 Fix and improve example : with-componentdidcatch (#4400)
* Fix example with-componentdidcatch

* Improve demo in example
: with-componentdidcatch

* Change next dependency to latest

* Revert _app.js
2018-05-18 10:51:11 +02:00
Nathan Walters
f5402476cf Add example with next-page-transitions (#4404) 2018-05-17 12:47:19 +02:00
yhirano55
ee1b6d93ce Minor improve with-typescript example [ci skip] (#4402)
* Added license to package.json.
* Modified package name same as dir name.
2018-05-17 12:45:13 +02:00
Lionel
c8bf63e72c Update with-url-object-routing (#4314)
Use `withRouter` HOC to avoid _deprecation warning_ using `url`
2018-05-16 12:35:27 +02:00
Jesús Lobos
b0128c7e2d Fix "with-i18next" example (#4393)
* Fix "with-i18next" example

Fixes #4380

* Trailing space removed
2018-05-16 12:10:01 +02:00
Yuri Yakovlev
59aa5a4dde Return empty string instead of null in the Authorization (#4389)
I was unable to make right check of `authorization` in the header on GraphQL side because now it returns `null` as string instead of empty string
2018-05-16 12:09:23 +02:00
HaNdTriX
79a7878c7d Update with-electron example (#4386)
Electron recommends to disable nodeIntegration in BrowserViews.
This PR follows this recommendation and updates the example accordingly.

 Changes:

- disable nodeIntegration
- update dependencies
2018-05-16 10:49:13 +02:00
yhirano55
b90c77b17f Improve with-redux-saga example (#4392)
* Rename page component's class name: Counter => Index, Counter => Other
* Rename counter component class name: AddCount => Counter
* Add counter actions `decrement` and `reset` same as with-redux example
* Modify page link by NavigateTo attr in Page component
* Modify license MIT => ISC same as others in package.json
* Modify README
2018-05-16 10:47:12 +02:00
yhirano55
e8c7dd4958 Fix with-mobx example (#4394)
fixes #4390

* Installing only `babel-plugin-transform-decorators-legacy` didn't work
* It also needs to install `babel-plugin-transform-class-properties`
2018-05-16 10:20:13 +02:00
yhirano55
3db3f4b42a Improve with-redux example (#4377)
It's better that Counter behave not only `increment (add)` but also `decrement` or `reset`.

* Add decrement, reset handlers and rename add handler in `components/counter.js`
* Add increment, decrement, reset actions to `store.js`
* Rename page component class name: Counter => Index in `pages/index.js`
* Remove needless dispatch count event on getInitialProps in `pages/index.js`
* Format JSX to be readable in `pages/_app.js`
* Remove needless line from `components/examples.js`
* Remove needless spaces in `lib/with-redux-store.js`
2018-05-15 09:49:07 +02:00
yhirano55
c762dc10d7 Add license section in with-pretty-url-routing [ci skip] (#4366) 2018-05-14 01:40:08 +02:00
yhirano55
f29d6671bf Update with-asset-imports [ci skip] (#4365)
* Add name, version, license to package.json
2018-05-14 00:29:39 +02:00
yhirano55
82e77a8838 Update ssr-caching example (#4363)
* Remove unnecessary dir key from next's argument
* Add license section to package.json
2018-05-14 00:00:37 +02:00
yhirano55
8512bf49f7 Update pass-server-data example [ci skip] (#4362)
* Update react, react-dom major version
* Add license section to package.json
* Use isomorphic-unfetch instead of isomorphic-fetch
2018-05-14 00:00:03 +02:00
Gaston Fartek
4f59c95149 updating with-redux-saga example (#4356) 2018-05-13 18:26:17 +02:00
yhirano55
af1082286e Fix class name in data-fetch example (#4358)
* Fixed class name in data-fetch example
* Removed needless empty lines
2018-05-13 18:12:03 +02:00
yhirano55
b2047de51a Update package.json in with-docker example (#4359)
* Added name, version, license keys.
2018-05-13 18:10:00 +02:00
yhirano55
8c5c2c23bb Update babel-plugin-module-resolver version in with-global-stylesheet (#4360)
I found build error, so I've updated babel-plugin-module-resolver
2018-05-13 18:09:25 +02:00
yhirano55
b3e47d19f8 Update README in with-global-stylesheet-simple [ci skip] (#4361)
Use https instead of http for tachyons URL
2018-05-13 18:08:44 +02:00
Petr Messner
fa5c0b8a47 Fix example with-custom-babel-config: update to Babel 7 (#4349)
The option `"decoratorsLegacy": true` seems mandatory, fails without it:

> The new decorators proposal is not supported yet. You must pass the `"decoratorsLegacy": true` option to @babel/preset-stage-0
2018-05-13 00:47:56 +02:00
Tim Neutkens
db29791cdc Merge branch 'master' into canary 2018-05-12 20:20:20 +02:00
Tim Neutkens
2c3f40600c Upgrade with-typescript to use latest next-typescript 2018-05-12 13:59:15 +02:00
Karthik Muralidharan
16ff96b107 rename; Clock.js to clock (#4342)
Fixes the compilation error : 

```
* ./clock in ./components/examples.js
ModuleNotFoundError: Module not found: Error: [CaseSensit
ivePathsPlugin] `/components/clock.js` does not matc
h the corresponding path on disk `Clock.js`.
```
2018-05-11 22:08:42 +02:00
Jason Leibowitz
126507cc1c Add Example of Redux Wrapper with Immutable.js (#4327)
* Add immutable redux example

* Updated readme

* Fix linting errors
2018-05-10 19:40:21 +02:00
Pascal Birchler
6b04b55354 Fix typo in next-with-apollo-auth test docs (#4328) 2018-05-10 19:02:29 +02:00
Andrew Razumovsky
0d4d7d840a [with-react-i18next] Fix flickering on page change via <Link /> (#4318)
* Fix flickering on page change via <Link />

* Remove process.browser check
2018-05-09 15:06:37 +02:00
Volker Rose
aec4c00214 Update next-typescript to latest version 0.1.1 (#4176)
This example gave me 404s on `pages/*.tsx` when using it with the latest nextjs (`5.1.0`) and `@zeit/next-typescript@0.0.11`. The latest next-typescript plugin version fixes it.
2018-05-08 17:38:21 +02:00
Kirill Konshin
76f5e979b3 Support _app approach for upgraded Redux Wrapper (#4207)
* Support _app approach for upgraded Redux Wrapper

* Updated according to discussion

* Package.json versions
2018-05-08 14:57:41 +02:00
Michael Hsu
4b95725e09 fix(with-pkg): update pkg config for next.js (#4307)
* fix(with-pkg): update pkg config for next.js

* update docs
2018-05-08 11:52:52 +02:00
Jorge Cuadra
596bd21e33 Add eslint parser to avoid errors in IDE. (#4297) 2018-05-07 21:11:14 +02:00
Tim Neutkens
0697c289f8
Implement with-redux using _app.js (#4295)
* Simplify redux example

* Simplify redux example even more

* Remove empty space
2018-05-07 15:03:54 +02:00
Tim Neutkens
6c0091fb7a
Add new apollo example using _app.js (#4286)
* Add new apollo example

* Update readme

* Update with-apollo to use _app.js

* Move withData to _app

* Make SSR work again

* Remove withData

* Use HOC to provide apolloClient

* Spread pageprops
2018-05-07 15:02:56 +02:00
Tim Neutkens
6bc363e615
Fix with-jest example (#4278)
Fixes #4263
2018-05-05 05:36:59 -07:00
Tim Neutkens
3685c30fb4 Merge branch 'master' into canary 2018-05-05 14:23:05 +02:00
Michael Hsu
738376c812 Add docker example (#4261)
* Add docker example

* fix lint
2018-05-05 04:12:56 -07:00
Tim Phillips
08965008c6 Prevent now-env from running in production (#4259) 2018-05-04 22:14:59 -07:00
Tim Neutkens
62f9736ca3 Add basic export example 2018-05-01 19:06:06 -07:00
Tim Neutkens
f1b9577210 Merge branch 'canary'
# Conflicts:
#	package.json
#	yarn.lock
2018-04-29 11:43:37 -07:00
Tony Kovanen
6158243339 with-reasonml: better setup (#4218)
With this setup we're compiling the .re/.ml files directly to source
directories with a .bs.js extension, and enabling next.js to pick up
that extension for pages.
2018-04-27 08:24:46 -07:00
Tony Kovanen
f378448b79 with-reasonml: use default exports (#4217) 2018-04-26 20:35:30 -07:00
Tony Kovanen
2457df5d06 examples/with-reasonml: use bs-next for Next.Link (#4214)
Fixes #4028
2018-04-26 10:05:04 -07:00
Iago Dahlem Lorensini
a0019b3dc9 Update broken link on with-redux-reselect-recompose example (#4209) 2018-04-25 09:29:48 -07:00
Tim Neutkens
0daf9beedc Add _app layout example 2018-04-24 12:31:26 -07:00
Tim Neutkens
326c84a730 Add readme for componentDidCatch example 2018-04-23 15:07:48 -07:00
Tim Neutkens
65c0014ad1 Add componentDidCatch example 2018-04-23 14:22:36 -07:00
Bhargav Ponnapalli
5187d142ea Added example for usage with rematch (#4095)
* Usage with rematch

* Run lint fix

* Add counter-display example and readme
2018-04-18 14:03:24 +02:00
Fouad Matin
676d82abf9 fix(examples/using-preact): use latest next-preact (#4152) 2018-04-14 07:49:06 +02:00
Harun Đulić
c5c5564dbf Added with-jest-typescript example (#4124)
* Added with-jest-typescript example with files and readme

* Updated package.json

As per the comment, updated the package.json so the info is same as in other examples.

* Proper name in package.json
2018-04-13 16:53:59 +02:00
Prateek Rastogi
fbd023c032 added example of integration with videojs (#4139)
* added videojs integration example

* added videojs example

* lint fix

* Revert "lint fix"

This reverts commit 39010fa0b58a66d06b91987a5bef46c044181470.

* removed unexpected lint fix
2018-04-12 12:22:37 +02:00
Seth Etter
769d8e3a84 Update next-typescript version in custom-typescript-server example (#4130) 2018-04-09 18:41:41 +02:00
Odin Ugedal
c486682b44 Relay modern example fixes (#4120)
* Fix with-relay-modern example

Starting with react-relay 1.5.0 the schema canno't be in the same dir as
the src. This can be fixed by excluding the schema dir. Globs should
also be inside quotation marks, to avoid non-deterministic behavior of
different shells.

* Add missing key on BlogPosts
2018-04-07 12:41:26 +02:00
James Hegedus
f2e56609cd Examples: stabalise README format and create-next-app usage (#4009)
* Examples: clarify language around Yarn create & npx

* add missing READMEs and create-next-app usage

* suggest people tag jthegedus in firebase related issues

* add yarn alt instructions

* cerebraljs example readme & fixes
2018-04-03 14:19:05 +02:00
Tim Neutkens
2d8c19a450
Upgrade Babel 6 to Babel 7 (major) (#4050)
Upgrade Babel 6 to Babel 7 (major)
2018-04-03 09:34:07 +02:00
Bhargav Ponnapalli
3556a3a63f Added example for usage with rematch (#4095)
* Usage with rematch

* Run lint fix

* Add counter-display example and readme
2018-04-03 09:09:30 +02:00
Tim Neutkens
43fe9ace54 Merge branch 'canary' of github.com:zeit/next.js into canary 2018-03-31 16:07:16 +02:00
Tim Neutkens
c07cf5e83f Upgrade Next in with-firebase-hosting 2018-03-31 16:06:12 +02:00
Jonathan James
b39958e780 Fix serve command (#3989)
* Fix serve command

From the Firebase docs, you must use --only in order to run the local function emulator.
See https://firebase.google.com/docs/functions/local-emulator

* Add production env for firebase serve

Doesn't work without this

* Update text as suggested by @jthegedus
2018-03-31 15:59:24 +02:00
Luis Fernando Alvarez D
b43af823dd Updated example with-now-env (#4081)
* New example: with-now-env

* updated the example with-now-env
2018-03-31 08:17:21 +02:00
Tage A. L. K
b321e6e942 Remove deprected and refactor with-apollo-auth (#4070)
* Remove deprected use of apollo-client-preset, and refactor

Changes
* Remove deprected use of apollo-client-preset in favor of apollo-boost
* Refactor for usage of react-apollo@2.1

* Use standard

Just ran standard --fix
2018-03-31 08:11:36 +02:00
Tim Neutkens
69ca73ca56 Upgrade @zeit/next-typescript in with-typescript example (patch) 2018-03-30 00:07:33 +02:00
Tim Neutkens
069f45d74e Upgrade @zeit/next-typescript in custom-server-typescript example (patch) fixes #4071 2018-03-29 21:06:53 +02:00
Wes Bos
3949c82bdf Add missing url prop (#4078)
This was causing react-apollo  to crash on any SSR page that needed the page's query to make the GraphQL queries. 

It's magically passed on the client, but we have to manually pass it to the composed component here
2018-03-29 18:01:12 +02:00
Pavel Prichodko
2ba8ad9760 Add with-google-analytics example (#4036)
* Rename example with-analytics to with-segment-analytics

* Add with-google-analytics example
2018-03-29 17:03:28 +02:00
Luis Fernando Alvarez D
9f4e707682 New example: with-now-env (#4073) 2018-03-29 00:11:40 +02:00
Will Meier
4570f2d050 Update with-apollo examples (#4067)
* Update with-apollo examples to include note about top-level withData HOC

* Update with-apollo examples to include note about top-level withData HOC
2018-03-28 22:30:42 +02:00
Tim Neutkens
ebf0c47c25
Upgrade standard.js (#4064)
* Upgrade standard.js

# Conflicts:
#	yarn.lock

* Upgrade babel-eslint
2018-03-27 20:11:03 +02:00
Rasool Dastoori
603b90ce02 Fix loading and rendering GraphQL data on the server in the with-apollo-and-redux example (#4054) 2018-03-25 17:40:25 +02:00
Gianmarco
7bef864a6f Fixes install command in with-absolute-imports example. (#4049)
Fixes installation command for `with-absolute-imports` example.
2018-03-23 14:00:18 +01:00
Luke Plaster
a6af11c6ae Improved with-ant-design example (#4034)
* Improved with-ant-design example

* standardjs fix maybe
2018-03-23 12:52:34 +01:00
Prateek Rastogi
9470b91ba1 migrated from apollo-client-preset to apollo-boost (#4047) 2018-03-23 12:51:58 +01:00
Shaleen Jain
cd1d9e0c35 with-apollo: Improve lib/withData (#3973)
* pass down getInitialProps ctx to ComposedComponent
* pass apollo client instance directly to getDataFromTree instead of through the ApolloProvider wrapper.
* Avoid redundant empty serverState initialization (It's always initialized)
2018-03-16 11:52:30 +01:00
James Hegedus
b1d8b839dd Examples: use npx and yarn create to run create-next-app on examples (#4002)
* remove global npm install of create-next-app

* add npx to create-next-app command in examples

* add bash to shell snippets

* add yarn create to next-app command in examples

* fix READMEs named with lowercase

* change READMEs to use UPPERCASE
2018-03-14 09:09:46 +01:00
Wagner Camarao
0eb5bab452 Fix a/b typo in custom-server-typescript routing (#4003) 2018-03-14 09:06:53 +01:00
PetrSnobelt
d391c2a040 Presets should be array (#3996) 2018-03-12 17:30:28 +01:00
Anton Egorov
2d7ba7f489 Remove error handling from custom-server-koa's server example (#3982)
Koa's `listeningListener` callback is invoked with no arguments according to the Koa's type definitions, hence error handling is extraneous.
2018-03-10 12:22:40 +01:00
Saro Vindigni
d3518242a6 FIX deploy with-firebase-hosting (#3946)
* FIX deploy with-firebase-hosting

* add npm run command in place of yarn in firebase.json predeploy hooks

* Change yarn with npm

* firebase-hosting example: Add warning in examples README

* firebase-hosting example: clarify warning language

* firebase-hosting example: remove the warning and upgrade to canary

* firebase-hosting example: actually upgrade pkg.json
2018-03-08 13:54:32 +01:00
Alexander Kachkaev
d5ce7aa3ca Update debug flag in with-react-i18next example (#3964)
Do not set it to true in production
2018-03-07 09:31:03 +01:00
Alexander Kachkaev
2e641e9e8c Use separate tsconfig for server in custom-server-typescript example (#3963) 2018-03-07 09:13:12 +01:00
Alexander Kachkaev
8bd81f6a68 Split exports in with-react-18next example to avoid ambiguity (#3959)
See context in https://github.com/i18next/react-i18next/issues/397
2018-03-07 08:42:14 +01:00
Robin Frischmann
6f0914c788 FIX #3757 update Fela example for Next 5 (#3949)
* #3757 update Fela for Next 5

closes #3757

* add missing props passdown
2018-03-06 14:27:47 +01:00
Ondrej Maksi
359e25af13 extendable with-redux example (#3947)
* copied with-redux -> with-redux-wrapper, changed links in readme

* added simplified redux wrapper

* removed next-redux-wrapper dep

* changed imports to local wrapper

* changed readme to reflect changes
2018-03-06 13:34:28 +01:00
Alexander Kachkaev
a225da4bb1 Fix null pointer exception in with-react-18next (#3944)
The example does not crash if a user chooses a non-existing language (e.g. goes to localhost:3000/?lng=ru)
2018-03-06 10:39:35 +01:00
Alexander Kachkaev
dbb1b732a0 Update with-react-i18next example (#3932)
- simplify pages by introducing withI18next hoc
- add Trans component example
- replace <div> with <p> in demo components to make text on pages easier to read

German translation by @marinaroot
2018-03-05 12:46:13 +01:00
Alexander Kachkaev
39be7183a5 Update custom-server-typescript example (#3936)
- Add "jsx": "preserve" to tsconfig.json
- Rename lib to production-server to remove incompatibility with other examples

Context: https://github.com/zeit/next.js/pull/3838#issuecomment-370189242 and below
2018-03-05 09:49:48 +01:00
James Hegedus
b4b5b1fa6d with-firebase-hosting improvements & fixes (#3886)
* Next.js v5 update, _error & _document bugs fixes

* document clean script

* remove old build artefact

* add babelrc

* reset next.js version to 'latest' from '^5.0.0'

* typo in readme

* format code

* remove _files as they were a fix for a solved, but unreleased problem
2018-02-28 11:54:48 +01:00
Evan Tahler
a39e54c675 custom-server-actionhero (#3905) 2018-02-27 13:16:17 +01:00
Rob
681c055220 Changed code to use the new css & asset imports instead of loading the whole lib from CDN (#3884)
* Changed code to use the new css & asset imports instead of loading the whole lib from CDN.

* Fixed formatting.
2018-02-25 18:57:20 +01:00
Jerome Fitzgerald
5ebb943c84 [example] with-apollo-and-redux-saga (#3488)
* [example] with-apollo-and-redux-saga

- Using Apollo to get GraphQL Data? Dope.
- Using Redux Saga to do other stuff outside of that? Cool.
- Nary the two shall meet? Most likely. 😀️

This is a breakout of #3463 where we were combining Apollo and Redux.

This may not be an example that gets a PR.

Why? Well, the examples are meant to pick and choose and combine
yourself. At least I believe, and this is basically a combination of two
examples (`with-apollo` and `with-redux-saga`) with some reworking.

**pages/**:
`index`: withReduxSaga()
`about`: ()
`blog/index`: withReduxSaga(withApollo())
`blog/entry`: withApollo()

* [refactor] fix lint (again), remove superfluous calls

* [fix] package.json: with-apollo-and-redux-saga

Updated the `name` and made sure `es6-promise` was in dependencies

* [refactor] remove semi-colons in clock/sagas

* [refactor] remove old migration code
2018-02-25 00:17:04 +01:00
Brice BERNARD
206470283e [with-hocs] Revamp example to use real world hocs (#3423)
* Revamp example to use real world hocs

* Add missing sync await parts

* Remove process.browser usage

* Get parent initialProps in last position
2018-02-24 13:04:17 +01:00
Ibrahim Ansari
99fb191286 Add custom-server-typescript example (see #3694) (#3838)
* Add custom-server-typescript example (see #3694)

* Fix linting errors in custom-server-typescript

* Provide proper arguments to ts-node.

* Fix import and fix all linting errors.

* Use import in server as well.

* Update nodemon.json
2018-02-22 16:29:47 +01:00
Tim Neutkens
a10324d591
Merge master into canary (#3846)
* Move security related test cases into a its own file.

* Removes the unused renderScript function

* Add a nerv example. (#3573)

* Add a nerv example.

* Fix for indentation/style

* Fix for name

* Release 5.0.0

* Add multi-zones docs. (#3688)

* with emotion example - hoist styles out of the index page component (#3821)

* Use indexOf instead of startsWith (#3758)

* Use indexOf instead of startsWith

This fixes an IE11 regression, see #3755

* Lint the code
2018-02-19 15:47:50 +01:00
Alexander Kachkaev
97aef52def Update tsconfig.json in with-typescript example (#3837)
Fixes https://github.com/zeit/next.js/pull/3698#issuecomment-366442816
2018-02-18 12:42:22 +01:00
Jan Mühlemann
7a937505f5 update with-react-i18next sample with latest dependencies (#3835) 2018-02-18 12:41:40 +01:00
Abel Tamayo
69b236b976 Upgrade Firebase and Firebase-Admin (#3786)
Firebase and Firebase Admin versions are upgraded.
2018-02-16 11:12:57 +01:00
Jay Phelps
bc185878e8 change mergeMap -> map in redux-observable example (#3794)
Using `mergeMap` with an inner Observable `of` is the same as using `map` by itself, so this is more idiomatic and clear.
2018-02-16 11:01:00 +01:00
Ari Leo Frankel
7b975d2156 examples: Add an example for the next-css plugin (#3739)
- with css modules
- with additional webpack config
- with post css
- without css modules

Fix #3699
2018-02-16 10:59:11 +01:00
AlbertGao
48e6decc2d Fix #3700 Added examples for next-sass (#3729)
* #3700 Add examples for next-sass

* #3700 Use React.Fragments and more

* Fix #3700 remove some keys to make more clear

* Fix #3700, change to without-css-modules

* Replace PageWrapper with _document for more concise code. #3700
2018-02-16 10:51:13 +01:00
Fumihiro Xue
972db9ba43 Fix #3814 (#3815)
* fix: module name typo

* fix: issue #3814
2018-02-16 10:49:25 +01:00
Brent Clark
24d862cd6b Remove console.log derp (#3810)
* fix copy pasta issue

* remove console.log derp

* resolve merge conflicts
2018-02-15 11:02:33 +01:00
thom
ebe39a63e6 Display errors when using glamor/server in a custom document (#3804) 2018-02-14 18:05:02 +01:00
David Calhoun
4469bd056c Fix react-native-web example typo (#3802) 2018-02-14 15:34:35 +01:00
Sitian Liu
6de3ff9d78 Remove redux comment (#3792)
Apollo client 2.0 is no longer implemented with redux
2018-02-13 23:20:22 +01:00
David Calhoun
8b1458af4f Add with-react-native-web example (#3781)
* Add with-react-native-web example

Showcase the required work to use
[react-native-web](https://github.com/necolas/react-native-web) with
Next.js.

* Repair lint warnings
2018-02-13 17:42:31 +01:00
Abel Tamayo
024d0c70ff Update README.md (#3784)
Detailed instructions for configuring authentication.
2018-02-13 13:20:16 +01:00
vuldin
74866edc40 fix setInterval usage in mobx examples to work in firefox (#3769) 2018-02-12 11:02:05 +01:00
Brent Clark
a8d07af355 use null instead of empty string for coerced className (#3771) 2018-02-12 10:10:01 +01:00
Fabrício Matté
e3079187fd Fix with-redux-saga server rendered clock, fixes #3760 (#3762)
Also updated the tick interval to one second, the clock works better this way and this is how the with-redux example is currently implemented as well.
2018-02-11 19:55:16 +01:00
Shogun Sea
7d7deca1b3 With redux example clock interval fix (#3756) 2018-02-11 13:36:33 +01:00
Ángel M
2ba6a9aff7 Fix svg-components example and improve babel example file (#3746) 2018-02-09 15:41:09 +01:00
astenmies
b8076a84a0 With DraftJS example (#3736) 2018-02-09 09:40:32 +01:00
Tim Teeling
1b473e478d Fix with-polyfills example for Next 5 (#3740) 2018-02-09 09:31:30 +01:00
Yevhen Uzhva
73bf0ab162 [Fix] with-global-stylesheet example (#3741) 2018-02-09 09:29:10 +01:00
Bonggyun Lee
87ab61eba5 example/with-typescript (#3698)
* example/with-typescript2

* apply standard js style

* remove unnecessary file & code

* fix link url

* replace with-typescript
2018-02-06 11:06:48 -05:00
Olivier Tassinari
9404beb12f Use latest instead of zones for with-zones example (#3710) 2018-02-06 10:09:01 -05:00
Romain Quellec
2a845a61b7 Correct url to blog post (#3709) 2018-02-06 15:22:32 +01:00
Olivier Tassinari
2473b55871 [ssr-caching] Only cache 200 status requests (#3708)
* [ssr-caching] Only cache 200 requests

I'm assuming caching an error page is a bad pattern.

* Update server.js
2018-02-06 17:51:49 +05:30
Juan Campa
efed85e495 Fix webpack-bundle-analyzer example to work with Next 5 (#3692) 2018-02-06 12:48:38 +05:30
Sitian Liu
905ff32b7f Create example using custom charset (#3697)
https://github.com/zeit/next.js/issues/3401
2018-02-06 12:22:31 +05:30
Tomáš Witek
9498fc60a1 Use correct port in with-zones example (#3679) 2018-02-05 12:05:59 +01:00
Tim Huff
31b8e7ed47 Indicate how to import fonts (#3676)
Got this fix from issue #2302. Libraries like `font-awesome` are pretty common. Indicating how to get them to work should be indicated in the `README.md` (if not added to the example)
2018-02-05 10:43:43 +01:00
M Pacer
3bbfbfad5c Refactor redux observable example (#3495)
* move imports into files using lettable operators, remove rxjs-library

* refactor to be more in keeping with redux conventions

from the single reducer.js, I split the functionality into actionTypes
(actionTypes.js), actions (actions.js), and epics (epics.js). Most of
the fetching should be done in an epic, but that requires introducing a
new action and so was
better in a separate commit.

* switch to fetching on the front-end via an epic

The fetching previously was triggered using an api call that had side
effects, but was triggered from inside of an epic and was not an action.
Now calls on the front-end all of the api calls are occuring via an
action through fetchCharacterEpic. This does not remove the api.js file
as I have not yet been able to get the epic to trigger correctly on the
server-side, thus the api.fetchCharacter call is awaited in
getInitialProps for initialising the state serverSide.

* remove need for the serverSide api by directly handling the dispatch

This still seems to be an incomplete solution to the problem as it
circumvents the standard redux event flow on the serverside. However, it
does obey the spirit of the redux event flow (as it passes an Observable
of an action into the epic to then trigger other actions). Additionally,
this removes the problem of code duplication.

* update README.md and move lib/ to redux/

* Fix linting
2018-02-04 12:56:32 +01:00
Jon Espen Kvisler
4d9cf1940c [with-apollo] Use getDataFromTree in browser (#3457)
* use getDataFromTree in browser

* formatting

* removed ssrMode argument, not needed
2018-02-04 12:36:35 +01:00
Arunoda Susiripala
97cf4281dc [Example] with-polyfills : show how to load polyfills (#3568)
* Add an example showing how to use polyfills.

* Add some example polyfills.

* Fix a typo.
2018-02-04 11:50:48 +01:00
John Polacek
b50c596d06 Format subhead in gh-pages README example (#3670) 2018-02-03 20:03:47 +01:00
Chris
7afc008aa7 Example: Passing data from server through API (#2594)
* Add example on how to pass data through js api during SSR

Requested in #1117

* Use content negotiation instead of a separate route

* Codereview feedback

* Move security related test cases into a its own file.

* Removes the unused renderScript function

* Add a nerv example. (#3573)

* Add a nerv example.

* Fix for indentation/style

* Fix for name
2018-02-03 17:11:47 +01:00
John Polacek
d103345aa1 Fix typos in gh-pages example README (#3669) 2018-02-03 17:11:16 +01:00
Frank Dai
f046c0f6c2 Fixed the example with-react-intl, cannot read property 'locale' of undefined (#3392) 2018-02-02 20:13:05 +01:00
Luis Fernando Alvarez D
80fc0f4511 (custom-server-express) avoid a 404 when navigating to a custom route (#3645)
* next export will expand symlinks now

* Make sure next export doesn't includes _document.js in windows

* avoid a client side not found page when navigating to a custom route
2018-01-31 22:38:36 +01:00
Tim Neutkens
f0703f8e13 Update preact example 2018-01-31 11:19:34 +01:00
Tim Neutkens
6db44f8058 Deprecate css examples 2018-01-31 11:19:34 +01:00
Jerome Fitzgerald
ab889369d5 [fix] apollo-redux: Separate out entire example #3463 (#3629)
* [fix] apollo-redux: Separate out entire example #3463

Apollo and Redux are completely separate ways of managing state. This example serves as a conduit if you were using Apollo 1.X with Redux, and are migrating to Apollo 2.x, however, you have chosen not to manage your entire application state within Apollo (`apollo-link-state`).

There is no "withData" function that allows you to call either/or. You must call "withRedux" and/or "withApollo" on your Component. They can be combined in the example at `index.js` or remain separate as seen in `apollo.js` and `redux.js`.

Going forward, this example may go the way of the dodo.

* [chore] reformat code to match next syntax

Localize prettier sometimes has a mind of its own. 😄️

* Fix linting
2018-01-31 10:40:32 +01:00
Brice BERNARD
053a248c44 [with-portals] Remove dynamic import, add <Portal /> (#3571) 2018-01-31 10:35:59 +01:00
Stephen Mathieson
9165d753d0 Add an example using analytics (#3580)
This patch adds an example of a Next.js app using analytics. A custom
document injects the [Segment](https://segment.com) bootstrapping
snippet into the `<head>`, allowing "page" and "track" calls to be made.

An issue came up in CNA asking how we handle this in our apps (see
https://github.com/segmentio/create-next-app/issues/24), so I figure an
"official example" could help.

NOTE: I am affiliated with Segment.
2018-01-31 10:35:27 +01:00
Logan McAnsh
4965387a3c add Polka server example (#3588)
* add Polka server example

* Update package.json

* Fix linting
2018-01-31 09:24:38 +01:00
Sergio Xalambrí
99272808d9 Update custom-server-micro example to latest version (#3594) 2018-01-31 09:22:43 +01:00
Alex Indigo
e401e2cf5f Added IoC example (#3595)
* Added `with-ioc` example

* pre-compile deps until we get nextjs magic working
2018-01-31 08:36:20 +01:00
Tim Neutkens
9a82ca4029 Update Next.js version on examples 2018-01-30 21:46:15 +01:00
Matías Hernández Arellano
c4830c3a61 upgraded flow version and updated code to use of React.Node (#2) (#3635) 2018-01-30 21:11:37 +01:00
Tim Neutkens
e093441bad Universal Webpack (#3578)
* Speed up next build

* Document webpack config

* Speed up next build

* Remove comment

* Add comment

* Clean up rules

* Add comments

* Run in parallel

* Push plugins seperately

* Create a new chunk for react

* Don’t uglify react since it’s already uglified. Move react to commons in development

* Use the minified version directly

* Re-add globpattern

* Move loaders into a separate variable

* Add comment linking to Dan’s explanation

* Remove dot

* Add universal webpack

* Initial dev support

* Fix linting

* Add changes from Arunoda's work

* Made next dev works.
But super slow and no HMR support.

* Fix client side hot reload

* Server side hmr

* Only in dev

* Add on-demand-entries client + hot-middleware

* Add .babelrc support

* Speed up on demand entries by running in parallel

* Serve static generated files

* Add missing config in dev

* Add sass support

* Add support for .map

* Add cssloader config and fix .jsx support

* Rename

* use same defaults as css-loader. Fix linting

* Add NoEmitErrorsPlugin

* Add clientBootstrap

* Use webpackhotmiddleware on the multi compiler

* alpha.3

* Use babel 16.2.x

* Fix reloading after error

* Remove comment

* Release 5.0.0-univeral-alpha.1

* Remove check for React 16

* Release 5.0.0-universal-alpha.2

* React hot loader v4

* Use our static file rendering machanism to serve pages.
This should work well since the file path for a page is predictable.

* Release 5.0.0-universal-alpha.3

* Remove optional loaders

* Release 5.0.0-universal-alpha.4

* Remove clientBootstrap

* Remove renderScript

* Make sure pages bundles are served correctly

* Remove unused import

* Revert to using the same code as canary

* Fix hot loader

* Release 5.0.0-universal-alpha.5

* Check if externals dir exist before applying config

* Add typescript support

* Add support for transpiling certain packages in node_modules

Thanks to @giuseppeg’s work in https://github.com/zeit/next.js/pull/3319

* Add BABEL_DISABLE_CACHE support

* Make sourcemaps in production opt-in

* Revert "Add support for transpiling certain packages in node_modules"

This reverts commit d4b1d9babfb4b9ed4f4b12d56d52dee233e862da.

In favor of a better api around this.

* Support typescript through next.config.js

* Remove comments

* Bring back commons.js calculation

* Remove unused dependencies

* Move base.config.js to webpack.js

* Make sure to only invalidate webpackDevMiddleware one after other.

* Allow babel-loder caching by default.

* Add comment about preact support

* Bring back buildir replace

* Remove obsolete plugin

* Remove build replace, speed up build

* Resolve page entries like pages/day/index.js to pages/day.js

* Add componentDidCatch back

* Compile to bundles

* Use config.distDir everywhere

* Make sure the file is an array

* Remove console.log

* Apply optimization to uglifyjs

* Add comment pointing to source

* Create entries the same way in dev and production

* Remove unused and broken pagesGlobPattern

* day/index.js is automatically turned into day.js at build time

* Remove poweredByHeader option

* Load pages with the correct path.

* Release 5.0.0-universal-alpha.6

* Make sure react-dom/server can be overwritten by module-alias

* Only add react-hot-loader babel plugin in dev

* Release 5.0.0-universal-alpha.7

* Revert tests

* Release 5.0.0-universal-alpha.10

* Make sure next/head is working properly.

* Add wepack alias for 'next' back.

* Make sure overriding className in next/head works

* Alias react too

* Add missing r

* Fragment fallback has to wrap the children

* Use min.js

* Remove css.js

* Remove wallaby.js

* Release 5.0.0-universal-alpha.11

* Resolve relative to workdir instead of next

* Make sure we touch the right file

* Resolve next modules

* Remove dotjsx removal plugins since we use webpack on the server

* Revert "Resolve relative to workdir instead of next"

This reverts commit a13f3e4ab565df9e2c9a3dfc8eb4009c0c2e02ed.

* Externalize any locally loaded module lives outside of app dir.

* Remove server aliases

* Check node_modules reliably

* Add symlink to next for tests

* Make sure dynamic imports work locally.
This is why we need it: b545b519b2/lib/MainTemplate.js (L68)
We need to have the finally clause in the above in __webpack_require__.
webpack output option strictModuleExceptionHandling does that.

* dynmaic -> dynamic

* Remove webpack-node-externals

* Make sure dynamic imports support SSR.

* Remove css support in favor of next-css

* Make sure we load path from `/` since it’s included in the path matching

* Catch when ensurepage couldn’t be fulfilled for `.js.map`

* Register require cache flusher for both client and server

* Add comment explaining this is to facilitate hot reloading

* Only load module when needed

* Remove unused modules

* Release 5.0.0-universal-alpha.12

* Only log the `found babel` message once

* Make sure ondemand entries working correctly.
Now we are just using a single instance of OnDemandEntryHandler.

* Better sourcemaps

* Release 5.0.0-universal-alpha.13

* Lock uglify version to 1.1.6

* Release 5.0.0-universal-alpha.14

* Fix a typo.

* Introduce multi-zones support for mircofrontends

* Add section on css
2018-01-30 16:44:44 +01:00
Saro Vindigni
202ceca1af Fix Doc in with-firebase-authentication (#3626) 2018-01-27 15:12:25 +01:00
Gavin
8c366defaf fix(store): product env cannot find module 'redux-devtools-extension'. (#3618)
Problem description:
- Cannot find module 'redux-devtools-extension'
2018-01-26 17:09:49 +01:00
Shaleen Jain
c40f184a6a Extend with-data-prefetch to handle advanced use cases (#3525) 2018-01-26 17:07:17 +01:00
Tim Neutkens
bba744d3fa Merge branch 'master' into fix/canary 2018-01-13 06:33:19 +01:00
Wei Zhu
9263ad13f7 Update Ant Design example (#3485) 2018-01-06 17:14:22 +01:00
Cory House
b5739d5361 Grammar fixes (#3531) 2018-01-03 14:06:45 +01:00
credifiable
e80d9b4696 Updated material-ui-next URI (#3509) 2017-12-28 16:25:11 +01:00
Jerome Fitzgerald
46b57a6eff [refactor] with-apollo-and-redux: 2.0.0 (#3484)
* [refactor] with-apollo-and-redux: 2.0.0

- This ports over `with-apollo` (w/ recent `withRouter` fix and addition
for Post) along with implementing `apollo-cache-redux` #3463
- The `redux` side of things is lacking (it is the *same* as the
original example)
- Created a `routes.js` for use on Server and Client Side (to expand the
PostList functionality)
- SSR is maintained
- Redid the "PostVote" a bit... sorry. 😬️

Possible todo(s):
- Add in API and Clock Examples from `with-redux` to show Apollo and
Redux working together a bit more
- redux-saga (I personally use this, may be too opinionated for the base
example though)

Packages updated:
- apollo-cache-redux
- apollo-client-preset
- graphql
- graphql-anywhere
- graphql-tag
- isomorphic-unfetch
- next-routes
- prop-types
- react
- react-apollo
- react-dom
- redux

* [refactor] fix linting issues

When I run `yarn lint` explicitly these were caught, but not doing a
build proper. Apologies on that!

* [chore] 📦️ package.json: like other examples

* [refactor] +apollo-cache-inmemory, -apollo-cache-redux

Separation of Apollo and Redux. 😄️
We could stand to use a few actual examples of Redux, though this is a
good starting block.
Some other code cleanup as well.
2017-12-27 19:57:57 +01:00
Sergio Xalambrí
ffdf4e3228 Add with-data-prefetch example (#3420)
* Add with-data-prefetch example

* Fix typos

* Improve example code
2017-12-26 21:46:46 +01:00
Ricardo Pierre-Louis
f2989c5739 Examples/with reflux (#3476)
* Update withData.js (#3458)

#3234

* Begun with-reflux example

* Built with-reflux example

* Built with-reflux example
2017-12-19 10:33:01 +01:00
Brice BERNARD
5bb710a0d2 [with-jest] Upgrade to jest 22 and so remove raf deps (#3477) 2017-12-19 10:29:29 +01:00
Petr Huřťák
9bc681bea1 Fix glamorous example (#3462)
It used old version 1 and when I run npm run dev it returned 500.
Once I updated to 4, everything works as expected.
2017-12-18 11:28:57 +01:00
Abdulhalim Kara
69aa647535 Update withData.js (#3458)
#3234
2017-12-18 11:27:16 +01:00
Brice BERNARD
35ffad968c [with-apollo] Fix missing rootContext (#3468) 2017-12-18 11:25:06 +01:00
Sergio Xalambrí
5040de3b3f Fix SVG component example dependencies (#3448) 2017-12-13 01:44:11 -08:00
Bertrand Marron
c8d2da68cf Use "preset-env" option to configure env preset in with-jest example (#3424) 2017-12-08 20:01:05 -08:00
Thierry Charbonnel
4cab5228a0 Github gh-pages Example (#3383)
* gh-page-exemple

* add babelrc for gh-page exemple

* Fix example (exemple in fr)

* example fix typo

* lint fix
2017-12-08 18:17:04 -08:00
Tim Neutkens
51f120ec70 Add markdown-in-js example (#3410) 2017-12-06 18:20:38 -08:00
Tim Neutkens
24c1ac6ca9
Use canary for all example downloads (#3411) 2017-12-06 18:12:42 -08:00
Tim Neutkens
b64365b550 Add markdown-in-js example (#3410) 2017-12-06 16:59:32 -08:00
Thomas Greco
278f58b54b pushing updated emotion example (#3344)
* pushing updated emotion example

* Fix linting
2017-12-05 16:46:06 -08:00
Brice BERNARD
48ed89f93d [with-apollo] Fix warning about missing _allPostsMeta and more (#3397)
* Fix coding style

* Fix className type

* Upgrade deps

* Fix coding style of lib/

* Simplify onSubmit handler

* Fix missing missing _allPostsMeta warning

* Follow lint rules
2017-12-05 10:50:45 -08:00
Brice BERNARD
25005d158b [with-jest] Fix tests (#3395)
* Fix tests

* Follow linting rules
2017-12-05 10:43:30 -08:00
Tibor Vukovic
e8f39ad74c Update hapi example to support hapi@17 (#3357) 2017-12-05 10:42:57 -08:00
Arunoda Susiripala
820e3ff716
Always load pages with ".js" extension (#3393)
* Always fetch pages with '.js' extention from client side.

* Load error page always from _error.js rather _error/index.js

* Load pages from page.js instead of page/index.js from the client for static exports.

* Update index.js

* Simplify the path re-write logic in the webpack pages-plugin.
2017-12-05 04:49:53 +05:30
Giuseppe
5daafa4f87 Upgrade styled-jsx to v2.2.1 (#3358)
* Pulled encoding to top of head (#3214)

* Remove next.d.ts to use @types/next (#3297)

* Add with-mobx-state-tree example (#3179)

* Adapt with-mobx example for with-mobx-state-tree

* Remove unnecessary lastUpdate parameter to show off snapshot

* update readme

* make other.js more closely mimic index.js

* Upgrade styled-jsx to v2.2.1

Includes some bug fixes.

* Fix linting
2017-12-04 08:15:30 -08:00
dsantic
3a651971e1 Upgrading with-flow example to the latest flow-bin ver. 0.59.0 (#3337)
For upgrading I used flow-upgrade module by https://yarnpkg.com/en/package/flow-upgrade
2017-12-03 14:58:46 -08:00