Skip to content

Commit

Permalink
Add update notifier (#3678)
Browse files Browse the repository at this point in the history
* Add update notifier

* Make update notifier work with custom server
  • Loading branch information
timneutkens authored and arunoda committed Feb 5, 2018
1 parent 9498fc6 commit cdbbe92
Show file tree
Hide file tree
Showing 3 changed files with 561 additions and 330 deletions.
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -50,6 +50,7 @@
"bin/*": "standard"
},
"dependencies": {
"@zeit/check-updates": "1.1.0",
"@zeit/source-map-support": "0.6.2",
"ansi-html": "0.0.7",
"babel-core": "6.26.0",
Expand Down
6 changes: 6 additions & 0 deletions server/index.js
Expand Up @@ -5,6 +5,7 @@ import { parse as parseQs } from 'querystring'
import fs from 'fs'
import fsAsync from 'mz/fs'
import http, { STATUS_CODES } from 'http'
import updateNotifier from '@zeit/check-updates'
import {
renderToHTML,
renderErrorToHTML,
Expand Down Expand Up @@ -35,6 +36,11 @@ export default class Server {
this.http = null
this.config = getConfig(this.dir, conf)
this.dist = this.config.distDir

if (dev) {
updateNotifier(pkg, 'next')
}

if (!dev && !fs.existsSync(resolve(dir, this.dist, 'BUILD_ID'))) {
console.error(`> Could not find a valid build in the '${this.dist}' directory! Try building your app with 'next build' before starting the server.`)
process.exit(1)
Expand Down

0 comments on commit cdbbe92

Please sign in to comment.