next.js stuff that comes in handy

As I use next more and more, I tend to replicate a few patterns when starting a new app from scratch. I’m leaving this here for documenting my best practices while using next as a framework.

Add a few scripts to package.json

"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"deploy": "now && now alias",
"lint": "eslint ."
},
"now": {
 "alias": "xxxxxxxxxxxx.now.sh"
}

Get an .eslintrc  file

Mine

$ wget https://gist.githubusercontent.com/oskosk/9257f15ade7701017bdfe3ad843efdf0/raw/2c52bfd53adbe8bef659fb472bcfdff84c273960/.eslintrc

 

The dependencies

$ npm install --save react react-dom next isomorphic-fetch
$ npm install --save-dev eslint babel-eslint eslint-plugin-react

Create some dirs

$ mkdir pages components lib static && touch pages/index.js && touch static/styles.css

Some commands

$ npm run dev
$ npm run deploy