Unverified Commit f373d25c authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

Replaced update checker (#4192)

* Use update-check

* Check for tty
parent 1d884efe
......@@ -63,7 +63,6 @@
"@babel/preset-react": "7.0.0-beta.42",
"@babel/runtime": "7.0.0-beta.42",
"@babel/template": "7.0.0-beta.42",
"@zeit/check-updates": "1.1.1",
"ansi-html": "0.0.7",
"babel-core": "7.0.0-bridge.0",
"babel-loader": "8.0.0-beta.2",
......@@ -97,6 +96,7 @@
"touch": "3.1.0",
"uglifyjs-webpack-plugin": "1.1.6",
"unfetch": "3.0.0",
"update-check": "1.3.2",
"url": "0.11.0",
"uuid": "3.1.0",
"walk": "2.3.9",
......
......@@ -4,7 +4,6 @@ import { parse as parseUrl } from 'url'
import { parse as parseQs } from 'querystring'
import fs from 'fs'
import http, { STATUS_CODES } from 'http'
import updateNotifier from '@zeit/check-updates'
import promisify from './lib/promisify'
import {
renderToHTML,
......@@ -44,10 +43,6 @@ export default class Server {
this.hotReloader = dev ? this.getHotReloader(this.dir, { quiet, config: this.nextConfig }) : null
if (dev) {
updateNotifier(pkg, 'next')
}
// Only serverRuntimeConfig needs the default
// publicRuntimeConfig gets it's default in client/index.js
const {serverRuntimeConfig = {}, publicRuntimeConfig, assetPrefix, generateEtags} = this.nextConfig
......@@ -118,6 +113,17 @@ export default class Server {
}
async prepare () {
if (this.dev && process.stdout.isTTY) {
const checkForUpdate = require('update-check')
const update = await checkForUpdate(pkg, {
distTag: pkg.version.includes('canary') ? 'canary' : 'latest'
})
if (update) {
// bgRed from chalk
console.log(`\u001B[41mUPDATE AVAILABLE\u001B[49m The latest version of \`next\` is ${update.latest}`)
}
}
await this.defineRoutes()
if (this.hotReloader) {
await this.hotReloader.start()
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment