mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-02-02 17:20:52 +00:00
29 lines
602 B
JavaScript
29 lines
602 B
JavaScript
(function() {
|
|
var isRoot, notifier, packageJSON, updateNotifier;
|
|
|
|
updateNotifier = require('update-notifier');
|
|
|
|
isRoot = require('is-root');
|
|
|
|
packageJSON = require('../../package.json');
|
|
|
|
if (!isRoot()) {
|
|
notifier = updateNotifier({
|
|
pkg: packageJSON
|
|
});
|
|
}
|
|
|
|
exports.hasAvailableUpdate = function() {
|
|
return notifier != null;
|
|
};
|
|
|
|
exports.notify = function() {
|
|
if (!exports.hasAvailableUpdate()) {
|
|
return;
|
|
}
|
|
notifier.notify();
|
|
return console.log('Notice that you might need administrator privileges depending on your setup');
|
|
};
|
|
|
|
}).call(this);
|