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

Add update notifier (#3678)

* Add update notifier

* Make update notifier work with custom server
This commit is contained in:
Tim Neutkens 2018-02-05 13:39:32 +01:00 committed by Arunoda Susiripala
parent 9498fc60a1
commit cdbbe928b2
3 changed files with 561 additions and 330 deletions

View file

@ -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",

View file

@ -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,
@ -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)

884
yarn.lock

File diff suppressed because it is too large Load diff