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:
parent
9498fc60a1
commit
cdbbe928b2
|
@ -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",
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue