1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00
Commit graph

685 commits

Author SHA1 Message Date
Tim Neutkens ee3a73f80b Add WebAssembly example 2018-09-17 21:48:06 +02:00
Stephen Sauceda e2d331dbcc add mocha example (#5182)
Adding an example of testing with Mocha

#4767
2018-09-17 00:12:39 +02:00
maurodaprotis 1f64082c03 Add with-context-api example (#5154)
* Add with-context-api example

* Change next dependency to canary and fix CounterProvider import
2018-09-14 12:04:29 +02:00
Rafael Almeida 5d147a82c4 Update with-ant-design example (#5141)
There is no need to wrap every page with a component when you can use the custom document.
2018-09-12 17:24:37 +02:00
Henri b79bbecb13 Add react-jss example (#5140)
Added a clear example on how to use react-jss with injecting the styles on the server.

cssinjs/jss#457
2018-09-12 15:49:54 +02:00
Tim Neutkens 344d770a28
Upgrade with-jest dependencies (#5149) 2018-09-12 15:29:17 +02:00
Kyle Holmberg f85a0bd550 Update next.config in with-webpack-bundle-analyzer example to avoid issue with Next.js in CI (#5135)
See: https://spectrum.chat/thread/030243b0-7ebf-434c-8e02-5f54ea30f3b6

Build works now 💃
2018-09-10 12:00:45 +02:00
Keith Grennan 8f61c335cb [with-apollo-auth] Only run getDataFromTree() on server (fix #4775) (#5112)
Though it sounds like some folks do run getDataFromTree() on the client in order to avoid loading states, it's non-standard usage and potentially confusing.  Also it's inconsistent with the other with-apollo examples.
2018-09-06 09:45:16 +02:00
Tim Neutkens 7627eb87d6
Use publicRuntimeConfig for universal-configuration-runtime example (#5101) 2018-09-05 14:38:39 +02:00
Jacob Page 777aab2b42 Remove unused flow definitions (#5094)
The `with-flow` sample has some obsolete definitions which are unused by the sample code. Removing the un-imported declarations is the easiest approach.
2018-09-05 13:38:28 +02:00
Diogo Dutra 56937fd22c Fixed package.json (#4654)
Fix on relay script to proper ignore schema files
   added graphql as explict dependency
2018-09-04 17:50:44 +02:00
Emmanuel Letallieur 82bdd43285 Fix custom-server-typescript not typechecking (#3954)
Hi

In the current version of the example __custom-server-typescript__, types are never checked.
For instance, change the following line :
```
const dev = process.env.NODE_ENV !== 'production'
```
by :
```
const dev: number = process.env.NODE_ENV !== 'production'
```
then run `npm run dev`. The application launches perfectly, no error is thrown.

In dev environnement, it is preferable to check types all the time, to get immediate feedback. This PR activates type checking. Only when using nodemon, so no impact on production.


Now the above code will (rightfully) refuse to compile : 
```
TSError: ⨯ Unable to compile TypeScript
server/index.ts (6,7): Type 'boolean' is not assignable to type 'number'
```
2018-09-04 17:35:34 +02:00
Kelly Burke 64f3720e7f Update example: with-sitemap-and-robots-express-server (#4579)
I simplified the example by removing `.eslintrc.js` and related packages, as well as `nodemon`. 

I also added a description in the README to address the question by @kachkaev in the original pull request (#4163).
2018-09-04 17:18:05 +02:00
Don Alvarez d4a54b6122 Add with-mobx-state-tree-typescript example (re-submitting due to accidental deletion) (#5077)
I think I accidentally deleted the branch my prior PR was based on before you had a chance to merge or decide whether to merge. In case I borked things with that delete, I'm resubmitting the PR and figuring you can close one or the other or both as desired.

Original notes:

Based on with-mobx-state-tree, but typescript instead of javascript

Aside from a few bits of typing and renaming .js files to .ts and .tsx, most of the the edits are to avoid warnings and errors when running the code through tslint (which can be done via the `npm run tslint` command in the example if desired).

To keep this example simple, the `<styled>` component (which is used by the javascript-based with-redux and with-mobx-state-tree examples for the clock component) is not used in this example. The `<styled>` library can of course be used with typescript but (I think) it requires a more complicated set of typescript and babel .configs than is needed for most other components and libraries, so I'm just directly styling the one formerly `<styled>` div to keep things simple and broadly applicable.
2018-09-04 17:17:30 +02:00
A K b00a140d58 added example with IBM Carbon Components, with demonstrated customizability (#4932) 2018-09-04 17:16:54 +02:00
Tim Neutkens a6114d4d65
Fix dependencies (#5091) 2018-09-04 13:17:22 +02:00
Henrik Wenz c44dab63ff Add with-yarn-workspaces example (#5034)
> Workspaces are a new way to setup your package architecture that’s available by default starting from Yarn 1.0. It allows you to setup multiple packages in such a way that you only need to run yarn install once to install all of them in a single pass.

- [x] Tested in development mode
- [x] Tested in production mode
- [x] Tested with deployment https://with-yarn-workspaces-hwzubdlkul.now.sh/
- [x] Added transpile module example

Closes #3638
2018-09-03 23:41:45 +02:00
Don Alvarez 14c7b25fcc Add with-sitemap-and-robots-express-server-typescript example (#5076)
Pulling out a few core points from the readme...

This example builds from /src into /dist, managing the different expectations of express.js (es5, commonjs) and next.js (es6) by using a pair of tsconfig.json files, both of which are run by `npm run build-ts` or any of the other npm targets.

Hot module reloading is largely but not completely wired up (nodemon is watching /dist but tsc isn't set up to watch /src and transpile changes in /src to /dist automatically (that's mainly because I wasn't sure how to start both nodemon and a pair of tsc watchers and be confident all would get shut down when the user killed dev mode). The readme suggests running `npm run build-ts` manually in another window to push changes from /src into /dev and on into the browser. 

tslint is also wired up via `npm run tslint`
2018-09-03 16:43:19 +02:00
Adam Lane 3d9564215c example with-reasonml dependency updates (#5048)
The original example fails to compile on my windows machine but updating bs-platform fixes that.
Depending on bs-next causes example to fail (package compiled with old incompatible version of bs-platform) so I have included it in a bindings directory where it can serve as an example of reason bindings.
Sources have been migrated to the latest reason-react.
2018-09-03 01:38:54 +02:00
Ivan Starkov 954fcb9674 Fix react-intl example (#4840)
react-intl does not work otherwise
2018-09-02 23:53:43 +02:00
Vince Picone d76b850eac Update .babelrc (#5063)
Some really nasty Internal Server errors come as a result of not having the correct module name here.
2018-08-30 23:33:08 +02:00
Daniel Reinoso 1924e3d868 Fix with-custom-reverse-proxy example (#5064)
Fixes #5052.

Example was using babel 6.
2018-08-30 23:32:19 +02:00
Tomáš Witek 66ec2061c1 Css example upgrade (#5039)
It looks like we don't need the `_document.js` file anymore.
Is that correct?
2018-08-27 16:13:02 +02:00
Jan Mühlemann e11d08ae45 Update with react 18next to latest (#5017)
* update with-react-i18next supporting new _app.js

* update readme to not encourage cloning of repo
2018-08-24 09:49:10 +02:00
dengyun b32763b9e3 fix: SyntaxError @import "./themes/default" (#5018)
fix: bug 🐞

![image](https://user-images.githubusercontent.com/37728280/44520939-05929380-a704-11e8-9e7e-7acbc08c6d39.png)
2018-08-23 16:48:17 +02:00
HaNdTriX 5ff7c0742c Lint examples (#4985)
* Lint examples/with-apollo-and-redux-saga

* Lint examples/with-apollo-auth

* Lint examples/with-apollo

* Lint exampels/with-google-analytics

* Lint examples/with-higher-order-component

* Lint examples/with-react-i18next

* Lint exampels/with-redux

* Lint exampels/with-relay-modern

* Lint examples/with-universal-configuration-runtime

* Add **/examples/**/lib/** to linter
2018-08-20 08:31:24 +02:00
rouzbeh84 639df91c87 docs: removes npx info & moves src link up (#4972)
FIXES: #4970 

confirmed rest of instructions work so left them in, even though duplicate of guide over at Material UI. thoughts?
2018-08-19 22:26:50 +02:00
HaNdTriX edaf1b42a6 Fix with-jest example (#4978)
Running the [with-jest](https://github.com/zeit/next.js/tree/canary/examples/with-jest) example  results in the following error:

```log
 FAIL  __tests__/index.test.js
  ● Test suite failed to run

    SecurityError: localStorage is not available for opaque origins
      
      at Window.get localStorage [as localStorage] (node_modules/jsdom/lib/jsdom/browser/Window.js:257:15)
          at Array.forEach (<anonymous>)

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        0.943s
Ran all test suites.
error Command failed with exit code 1.
```

Upgrading the dependencies (jest) to the latest version helps!

[More info](https://github.com/jsdom/jsdom/issues/2304)

Related #4776
2018-08-17 11:20:56 -07:00
ǝlzlǝoq lǝᴉuɐp ツ 87f5df2454 Factor out NextScript inline source (#4934) (#4939)
This PR factors out the inline script into an own static method; fixes #4934.
2018-08-14 11:05:25 -07:00
Jacob Page 1889c80472 Update routing samples (#4864)
Updated router samples to use the EventEmitter
2018-08-13 14:17:39 -07:00
Luc b9081a5115 Replace deprecated props.url in examples (#4953)
Following https://github.com/zeit/next.js/pull/4952

I found two examples with the deprecated`props.url` :
- `with-ioc`
- `with-next-routes`
2018-08-13 14:12:03 -07:00
Luc b516d094a4 Fix shallow routing examples using old React lifecycle and deprecated props.url (#4950)
* replace componentWillReceiveProps by componentDidUpdate

* replace props.url by withRouter HOC

* fix deprecated `props.url` in with-shallow-routing example
2018-08-13 11:09:45 -07:00
Alexander Kachkaev 9319c158a5 Upgrade Babel to 7.0.0-rc.1 (major) (#4937)
Fixes #4691
Fixes #4614

This PR gives path to https://github.com/zeit/next-plugins/pull/242

I did not add or remove `^` near dependency versions in package.json files. However, I don't exclude that some changes can be made given that rc is more stable than beta.
2018-08-13 10:34:08 -07:00
Tomek e8c1eaec83 update with-loading example (#4836)
Changes:

* Split `Header` component trough `_document.js` and `_app.js`
* Attached Router events with a way described in the [documentation](https://github.com/zeit/next.js#router-events) (though in the documentation is says it should be `Router.events.on` while I managed to get it working only by `Router.router.events.on` and I had to place it inside `componentDidMount`)
2018-08-11 19:39:48 -07:00
Tim Phillips b990b29d2d Update Apollo links in examples (#4933) 2018-08-09 14:00:08 -07:00
Sahal Sajjad 136585e296 Added example: with-typestyle (#4926)
* Added example: with-typestyle

* Fixed bug: Rendering the DOM tree twice
2018-08-08 21:36:34 -07:00
HaNdTriX 06b02e2c62 Update with-custom-babel-config example (#4923)
## Issue

Running [examples/with-custom-babel-config](https://github.com/zeit/next.js/tree/canary/examples/with-custom-babel-config) will result in the following error message:

```
./pages/index.js
Module build failed (from /some_path/next.js/dist/build/webpack/loaders/next-babel-loader.js):
Error: [BABEL] /some_path/next.js/examples/with-custom-babel-config/pages/index.js: 
As of v7.0.0-beta.55, we've removed Babel's Stage presets.
Please consider reading our blog post on this decision at
https://babeljs.io/blog/2018/07/27/removing-babels-stage-presets
for more details. TL;DR is that it's more beneficial in the
  long run to explicitly add which proposals to use.

...
```

## Explanation

Babel removed Babel's Stage presets on July 27, 2018.

More info: https://babeljs.io/blog/2018/07/27/removing-babels-stage-presets

## Solution

I've updated the example so ist just uses the babel plugin it actually needs.

## Related 

Closes: #4772
2018-08-08 09:02:46 -07:00
HaNdTriX d3f1fa630e Rewrite with-dotenv example (#4924)
## Issue

I decided to rewrite the [with-dotenv](https://github.com/zeit/next.js/tree/canary/examples/with-dotenv) using [dotenv-webpack](https://github.com/mrsteele/dotenv-webpack) example because:

- changes doesn't get applied  (#4748, brysgo/babel-plugin-inline-dotenv#13)
- the production mode doesn't work at all
- this approach has already been used in the [examples/relay-modern](9320d9f006/examples/with-relay-modern/next.config.js)
- it is [documented](https://webpack.js.org/plugins/environment-plugin/#dotenvplugin) by webpack

## Alternatives

* remove/deprecate example
* fix babel-plugin-inline-dotenv

## Related

Closes: #4748
2018-08-08 09:01:00 -07:00
HaNdTriX 9018da11ca Remove with-global-stylesheet example (#4913)
* Deprecate with-global-stylesheet example

Use @zeit/next-css instead

https://github.com/zeit/next-plugins/tree/master/packages/next-css

RELATED ISSUE: #4902

* Deprecate with-global-stylesheet-simple example

Use @zeit/next-css instead

https://github.com/zeit/next-plugins/tree/master/packages/next-css

RELATED ISSUE: #4902
2018-08-07 18:36:28 -07:00
HaNdTriX 3286ecb3fc Add slate.js example (#4899) 2018-08-06 21:00:31 -07:00
Thomas Hermann 83970c908d Add with-strict-csp example (#4858) 2018-08-06 20:19:16 -07:00
Hugo Heyman e8aa78204a Improve glamor example (#4893)
Changes:
- Use css prop on the element to style it
- Add webpack + babelrc configuration to remove otherwise needed import boilerplate [according to glamor docs](https://github.com/threepointone/glamor/blob/master/docs/createElement.md)

Rationale: The killer feature of glamor that makes it so great is that it relieves you from naming classes/styles if you use the custom css prop. Together with the babel plugin you also don't need any extra import wherever the css prop is used.

All the real world uses I've seen of glamor has used the css props so I think the example should reflect this. As an example here is docs how to use glamor with gatsby (using the css prop):
https://www.gatsbyjs.org/docs/glamor/
2018-08-05 16:13:28 -07:00
Kate 05b6891620 Fixed server status message in with-redux-observable-example. (#4900)
**Changes:**
- Fixed "was character fetched on server" message by properly passing `isServer`.
- Stop fetching if there was an error (currently it keeps sending requests to the same endpoint every 3 sec)

**Related:**
- https://github.com/zeit/next.js/pull/4818
- https://github.com/zeit/next.js/issues/4724
2018-08-05 10:56:04 -07:00
Tomek b1459bfd60 update with-sentry example (#4859)
Changes:

* moved the configuration from HOC to `_app.js`
* fixed the example, as `componentDidCatch` catches errors during rendering phase, but not within event handlers.
2018-08-04 10:51:35 -07:00
Max Stoiber 80202069cf Note babel-plugin-styled-components (#4882)
Otherwise folks might miss that part and get checksum mismatches!
2018-08-01 13:57:30 +02:00
José Manuel Aguirre 7282f43f7b Missing babel configuration in sw-precache example (#4856)
Missing configuration in package.json and .babelrc causes this example to be broken after installing and running the example.
2018-07-27 22:54:01 +02:00
Tomek 88610694c2 update with-prefetching example (#4850) 2018-07-27 22:08:09 +02:00
Tim Neutkens 283e9afe70
Upgrade serve (#4857) 2018-07-27 21:13:55 +02:00
Tomek f4988e7fa3 update with-markdown example (#4839)
Changes:

* replaced the `markdown-in-js` with nextjs plugin for `MDX`

Highly inspired by the example from [MDX repository](https://github.com/mdx-js/mdx/tree/master/examples/next)
2018-07-25 20:06:40 +02:00
Tomek c090a57e77 update with-flow example (#4835)
Changes:
* updated packages
* moved the content of `layout` to `_app.js` and created simple `Page` component
* replaced `import * as React` because it is not necessary to import everything
* moved `next.js.flow` to `flow-typed` as it is default directory for library definitions
* updated the gif
2018-07-25 13:42:40 +02:00