|
|
@ -3,12 +3,24 @@ import pkg from '../../package'; // relative to `build/` :\ |
|
|
|
import fetch from 'node-fetch'; |
|
|
|
import chalk from 'chalk'; |
|
|
|
|
|
|
|
const isTTY = process.stdout.isTTY; |
|
|
|
|
|
|
|
// if we're not in a tty the update checker
|
|
|
|
// will always return a resolved promise
|
|
|
|
const resolvedPromise = new Promise((resolve, reject) => resolve()); |
|
|
|
|
|
|
|
/** |
|
|
|
* Configures auto updates. |
|
|
|
* Sets up a `exit` listener to report them. |
|
|
|
*/ |
|
|
|
|
|
|
|
export default function checkUpdate (opts = {}) { |
|
|
|
if (!isTTY) { |
|
|
|
// don't attempt to check for updates
|
|
|
|
// if the user is piping or redirecting
|
|
|
|
return resolvedPromise; |
|
|
|
} |
|
|
|
|
|
|
|
let updateData; |
|
|
|
|
|
|
|
const update = check(opts).then((data) => { |
|
|
|