- 24 12月, 2018 3 次提交
-
-
由 Jean 提交于
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">
-
由 Zack Tanner 提交于
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', }, ```
-
- 23 12月, 2018 1 次提交
-
-
由 Zihua Wu 提交于
Babel related content in README.md is updated according to the updated .babelrc
-
- 21 12月, 2018 2 次提交
-
-
由 Michael Hsu 提交于
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)
-
由 Florian Hämmerle 提交于
-
- 19 12月, 2018 1 次提交
-
-
由 Tim Neutkens 提交于
This brings us one step closer to outputting serverless functions as renderToHTML now renders the passed components, which allows us to bundle the renderToHTML function together with statically imported components in webpack.
-
- 18 12月, 2018 5 次提交
-
-
由 Erik Nguyen 提交于
-
由 Tim Neutkens 提交于
-
由 Tim Neutkens 提交于
-
由 Tim Neutkens 提交于
We already checked if Document is a valid component, but we didn't yet for App.
-
由 Tim Neutkens 提交于
* Add prettier for examples directory * Fix files * Fix linting * Add prettier script in case it has to be ran again
-
- 17 12月, 2018 3 次提交
-
-
由 Tim Neutkens 提交于
-
由 Kyle Holmberg 提交于
Resolves #4055 Credit: https://github.com/zeit/next.js/pull/5095 I didn't use the ignore webpack plugin from the original PR and tested bundle size with https://github.com/zeit/next.js/pull/5339 - seems to be safe on that front. Was able to get tests to pass locally, unsure of what goes wrong in CI
🤷 ♂️ **Questions** 1) The initial PR didn't include changes to `next-server/lib/router` in `getRouteInfo()`. Should the same changes be made within? 2) Should we add a test for rendering a component created via `forwardRef()`? `component-with-forwardedRef`: ```javascript export default React.forwardRef((props, ref) => <span {...props} forwardedRef={ref}>This is a component with a forwarded ref</span>); ``` some test: ```javascript test('renders from forwardRef', async () => { const $ = await get$('/component-with-forwardedRef') const span = $('span') expect(span.text()).toMatch(/This is a component with a forwarded ref/) }) ``` -
由 Brian Beck 提交于
As I detailed in [this thread on Spectrum](https://spectrum.chat/?t=3df7b1fb-7331-4ca4-af35-d9a8b1cacb2c), the dev experience would be a lot nicer if the server started listening as soon as possible, before the slow initialization steps. That way, instead of manually polling the dev URL until the server's up (this can take a long time!), I can open it right away and the responses will be delivered when the dev server is done initializing. This makes a few changes to the dev server: * Move `HotReloader` creation to `prepare`. Ideally, more things (from the non-dev `Server`) would be moved to a later point as well, because creating `next({ ... })` is quite slow. * In `run`, wait for a promise to resolve before doing anything. This promise automatically gets resolved whenever `prepare` finishes successfully. And the `next dev` and `next start` scripts: * Since we want to log that the server is ready/listening before the intensive build process kicks off, we return the app instance from `startServer` and the scripts call `app.prepare()`. This should all be backwards compatible, including with all existing custom server recommendations that essentially say `app.prepare().then(listen)`. But now, we could make an even better recommendation: start listening right away, then call `app.prepare()` in the `listen` callback. Users would be free to make that change and get better DX. Try it and I doubt you'll want to go back to the old way. :)
-
- 16 12月, 2018 8 次提交
-
-
由 Tim Neutkens 提交于
-
由 Tim Neutkens 提交于
-
由 Tim Neutkens 提交于
-
由 Tim Neutkens 提交于
-
由 Tim Neutkens 提交于
-
由 Tim Neutkens 提交于
-
由 Tim Neutkens 提交于
-
由 DevSide 提交于
This message is from @timneutkens after making changes: - Convert executables to Typescript - Remove `minimist` in favor of `arg` - Implement `--node-args` usage: `--node-args="--throw-deprecation"` - Adds tests for usage of the `next` cli
-
- 15 12月, 2018 2 次提交
-
-
由 Pojen Chen 提交于
-
由 Juan Olvera 提交于
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)
-
- 14 12月, 2018 7 次提交
-
-
由 Pojen Chen 提交于
-
由 JJ Kasper 提交于
Fixes #4495 Here's my approach for replacing the XHR on-demand-entries pinger #1364 #4495. I'm not sure if this is the way everyone wants to accomplish this since I saw mention of using a separate server and port for the dynamic entries websocket, but thought this would be a fairly clean solution since it doesn't need that. With this method the only change when using a custom server is you have to listen for the upgrade event and pass it to next.getRequestHandler(). Example: ``` const server = app.listen(port) const handleRequest = next.getRequestHandler() if(dev) { server.on('upgrade', handleRequest) } ```
-
由 Tim Neutkens 提交于
* Disable webpack cache option in prod * Remove cache option as it’s added by mode === ‘development’
-
由 Tim Neutkens 提交于
-
由 Tim Neutkens 提交于
-
由 Tim Neutkens 提交于
Inspired by https://twitter.com/addyosmani/status/1073118564423356416 I've made the checking function slightly smaller (including both conditions on one line makes Terser optimize the condition). cc @addyosmani
-
由 Leon 提交于
Missed a fix for the styletron api. Previous config won't work for server rendering.
-
- 13 12月, 2018 4 次提交
-
-
由 Tim Neutkens 提交于
For some reason the canary branch is failing on Typescript while the PR was not.
-
由 Connor Davis 提交于
# Fixes https://github.com/zeit/next.js/issues/5674 This adds config option ```js // next.config.js module.exports = { crossOrigin: 'anonymous' } ``` This config option is defined in the webpack Define Plugin at build. `Head` and `NextScript` now use the config option, if it's not explicitly set on the element. This value is now passed to Webpack so it can add it to scripts that it loads. The value is now used in `PageLoader` (on the client) so it can add it to the scripts and links that it loads. Using `<Head crossOrigin>` or `<NextScript crossOrigin>` is now deprecated.
-
由 Tim Neutkens 提交于
* Convert render.js to typescript * Compile tsx files too * Remove internal renderErrorToHTML function * Interopt component result * requirePage doesn’t need async * Move out enhancing logic into it’s own function * Remove buildManifest from renderPage * Move render into it’s own function * Change let to const * Move renderDocument into it’s own function
-
由 adrianoted 提交于
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)
-
- 12 12月, 2018 4 次提交
-
-
由 Benjamin Kniffler 提交于
This PR will - allow nextjs export to use all available CPU cores for rendering & writing pages by using child_process - make use of async-sema to allow each thread to concurrently write multiple paths - show a fancy progress bar while processing pages (with non-TTY fallback for CI web consoles) The performance gain for my MacBook with 4 CPU cores went from ~25 pages per second to ~75 pages per second. Beefy CI machines with lots of cores should profit even more.
-
由 Oscar Busk 提交于
* 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.
-
由 Brian Beck 提交于
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.
-
由 Oscar Busk 提交于
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`
-