From 4504d9f3cd92f9a18ea1957f976bc186b78179e5 Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Wed, 7 Jun 2017 12:00:59 +0530 Subject: [PATCH 1/5] 2.4.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4212ff55..f2803c14 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "next", - "version": "2.4.2", + "version": "2.4.3", "description": "Minimalistic framework for server-rendered React applications", "main": "./dist/server/next.js", "license": "MIT", From c66cafd3625fe469cc2743ff33711f28ac92617e Mon Sep 17 00:00:00 2001 From: Adrian le Bas Date: Thu, 8 Jun 2017 19:11:08 +0200 Subject: [PATCH 2/5] Remove hardcoded address from ws example. (#2204) With a hard coded address on the client, the app no longer works when deploying, which is annoying since there's a handy 'deploy now' button on the readme. By removing the hard coded address socket.io will connect to the location host automatically so it works both on development and production. --- examples/with-socket.io/pages/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/with-socket.io/pages/index.js b/examples/with-socket.io/pages/index.js index 578fb9e3..80251f54 100644 --- a/examples/with-socket.io/pages/index.js +++ b/examples/with-socket.io/pages/index.js @@ -22,7 +22,7 @@ class HomePage extends Component { // connect to WS server and listen event componentDidMount () { - this.socket = io('http://localhost:3000/') + this.socket = io() this.socket.on('message', this.handleMessage) } From 7b62184c0b2e8f24aca7730c103238453098ae74 Mon Sep 17 00:00:00 2001 From: Vinay Puppal Date: Sat, 10 Jun 2017 03:14:26 +0530 Subject: [PATCH 3/5] Add with-react-ga example (#2225) * add with-react-ga example * fix title in Readme --- examples/with-react-ga/README.md | 29 +++++++++++++++++++++ examples/with-react-ga/components/Layout.js | 19 ++++++++++++++ examples/with-react-ga/package.json | 17 ++++++++++++ examples/with-react-ga/pages/about.js | 7 +++++ examples/with-react-ga/pages/index.js | 6 +++++ examples/with-react-ga/utils/analytics.js | 24 +++++++++++++++++ 6 files changed, 102 insertions(+) create mode 100644 examples/with-react-ga/README.md create mode 100644 examples/with-react-ga/components/Layout.js create mode 100644 examples/with-react-ga/package.json create mode 100644 examples/with-react-ga/pages/about.js create mode 100644 examples/with-react-ga/pages/index.js create mode 100644 examples/with-react-ga/utils/analytics.js diff --git a/examples/with-react-ga/README.md b/examples/with-react-ga/README.md new file mode 100644 index 00000000..f37b9c67 --- /dev/null +++ b/examples/with-react-ga/README.md @@ -0,0 +1,29 @@ +[![Deploy to now](https://deploy.now.sh/static/button.svg)](https://deploy.now.sh/?repo=https://github.com/zeit/next.js/tree/master/examples/with-react-ga) + +# React-GA example + +## How to use + +Download the example [or clone the repo](https://github.com/zeit/next.js): + +```bash +curl https://codeload.github.com/zeit/next.js/tar.gz/master | tar -xz --strip=2 next.js-master/examples/with-react-ga +cd with-react-ga +``` + +Install it and run: + +```bash +npm install +npm run dev +``` + +Deploy it to the cloud with [now](https://zeit.co/now) ([download](https://zeit.co/download)) + +```bash +now +``` + +## The idea behind the example + +This example shows the most basic way to use [react-ga](https://github.com/react-ga/react-ga) using `` component with NextJs. You can also use an HOC instead of `` component. Modify `Tracking ID` in `utils/analytics.js` file for testing this example. diff --git a/examples/with-react-ga/components/Layout.js b/examples/with-react-ga/components/Layout.js new file mode 100644 index 00000000..94dac8fd --- /dev/null +++ b/examples/with-react-ga/components/Layout.js @@ -0,0 +1,19 @@ +import React from 'react' +import { initGA, logPageView } from '../utils/analytics' + +export default class Layout extends React.Component { + componentDidMount () { + if (!window.GA_INITIALIZED) { + initGA() + window.GA_INITIALIZED = true + } + logPageView() + } + render () { + return ( +
+ {this.props.children} +
+ ) + } +} diff --git a/examples/with-react-ga/package.json b/examples/with-react-ga/package.json new file mode 100644 index 00000000..e200bbb4 --- /dev/null +++ b/examples/with-react-ga/package.json @@ -0,0 +1,17 @@ +{ + "name": "hello-world", + "version": "1.0.0", + "scripts": { + "dev": "next", + "build": "next build", + "start": "next start" + }, + "dependencies": { + "next": "*", + "react": "^15.4.2", + "react-dom": "^15.4.2", + "react-ga": "2.2.0" + }, + "author": "", + "license": "ISC" +} diff --git a/examples/with-react-ga/pages/about.js b/examples/with-react-ga/pages/about.js new file mode 100644 index 00000000..e4b6d1d5 --- /dev/null +++ b/examples/with-react-ga/pages/about.js @@ -0,0 +1,7 @@ +import Layout from '../components/Layout' + +export default () => ( + +
About us
+
+) diff --git a/examples/with-react-ga/pages/index.js b/examples/with-react-ga/pages/index.js new file mode 100644 index 00000000..281025fd --- /dev/null +++ b/examples/with-react-ga/pages/index.js @@ -0,0 +1,6 @@ +import Link from 'next/link' +import Layout from '../components/Layout' + +export default () => ( +
Hello World. About
+) diff --git a/examples/with-react-ga/utils/analytics.js b/examples/with-react-ga/utils/analytics.js new file mode 100644 index 00000000..61bb596a --- /dev/null +++ b/examples/with-react-ga/utils/analytics.js @@ -0,0 +1,24 @@ +import ReactGA from 'react-ga' + +export const initGA = () => { + console.log('GA init') + ReactGA.initialize('UA-xxxxxxxxx-1') +} + +export const logPageView = () => { + console.log(`Logging pageview for ${window.location.pathname}`) + ReactGA.set({ page: window.location.pathname }) + ReactGA.pageview(window.location.pathname) +} + +export const logEvent = (category = '', action = '') => { + if (category && action) { + ReactGA.event({ category, action }) + } +} + +export const logException = (description = '', fatal = false) => { + if (description) { + ReactGA.exception({ description, fatal }) + } +} From 05f6e3ff11f113e2b2647aa38f248149ae150821 Mon Sep 17 00:00:00 2001 From: Zane Milakovic Date: Thu, 15 Jun 2017 14:49:59 -0500 Subject: [PATCH 4/5] updates styled-jsx to fix issues and bugs (#2275) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f2803c14..9e5891e5 100644 --- a/package.json +++ b/package.json @@ -84,7 +84,7 @@ "send": "0.15.2", "source-map-support": "0.4.15", "strip-ansi": "3.0.1", - "styled-jsx": "1.0.3", + "styled-jsx": "1.0.5", "touch": "1.0.0", "unfetch": "2.1.2", "url": "0.11.0", From a33a01fba59051c0ed264b8976651f93f3f79447 Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Fri, 16 Jun 2017 21:51:03 +0530 Subject: [PATCH 5/5] 2.4.4 --- package.json | 2 +- yarn.lock | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 9e5891e5..6202aa0e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "next", - "version": "2.4.3", + "version": "2.4.4", "description": "Minimalistic framework for server-rendered React applications", "main": "./dist/server/next.js", "license": "MIT", diff --git a/yarn.lock b/yarn.lock index b717e5ec..7db0451e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4786,9 +4786,9 @@ strip-json-comments@~2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" -styled-jsx@1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/styled-jsx/-/styled-jsx-1.0.3.tgz#3d8e2eda09fffccc131d321a02ae6d6f9f79da53" +styled-jsx@1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/styled-jsx/-/styled-jsx-1.0.5.tgz#943fced48295ff70000794311f9f3bf3688e427f" dependencies: babel-plugin-syntax-jsx "6.18.0" babel-traverse "6.21.0" @@ -4799,11 +4799,11 @@ styled-jsx@1.0.3: escape-string-regexp "1.0.5" source-map "0.5.6" string-hash "1.1.1" - stylis "3.0.10" + stylis "3.1.5" -stylis@3.0.10: - version "3.0.10" - resolved "https://registry.yarnpkg.com/stylis/-/stylis-3.0.10.tgz#9f561e8a9799c2c317c596583bcaaa52a0d27663" +stylis@3.1.5: + version "3.1.5" + resolved "https://registry.yarnpkg.com/stylis/-/stylis-3.1.5.tgz#c585186286aaa79856c9ac62bbb38113923edda3" supports-color@^2.0.0: version "2.0.0" @@ -5243,7 +5243,7 @@ xml-name-validator@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-2.0.1.tgz#4d8b8f1eccd3419aa362061becef515e1e559635" -xss-filters@^1.2.7: +xss-filters@1.2.7: version "1.2.7" resolved "https://registry.yarnpkg.com/xss-filters/-/xss-filters-1.2.7.tgz#59fa1de201f36f2f3470dcac5f58ccc2830b0a9a"