diff --git a/README.md b/README.md index 377dcdd56d..b2149c5cb5 100755 --- a/README.md +++ b/README.md @@ -271,6 +271,7 @@ List of Definitions * [Underscore.js (Typed)](http://underscorejs.org/) (by [Josh Baldwin](https://github.com/jbaldwin/)) * [Underscore-ko.js](https://github.com/kamranayub/UnderscoreKO) (by [Maurits Elbers](https://github.com/MagicMau)) * [universal-analytics](https://github.com/peaksandpies/universal-analytics) (by [Bart van der Schoor](https://github.com/Bartvds)) +* [update-notifier](https://github.com/yeoman/update-notifier) (by [vvakame](https://github.com/vvakame)) * [urlrouter](https://github.com/fengmk2/urlrouter) (by [Carlos Ballesteros Velasco](https://github.com/soywiz)) * [UUID.js](https://github.com/LiosK/UUID.js) (by [Jason Jarrett](https://github.com/staxmanade)) * [Valerie](https://github.com/davewatts/valerie) (by [Howard Richards](https://github.com/conficient)) diff --git a/update-notifier/update-notifier-tests.ts b/update-notifier/update-notifier-tests.ts new file mode 100644 index 0000000000..58fdbd623e --- /dev/null +++ b/update-notifier/update-notifier-tests.ts @@ -0,0 +1,19 @@ +/// + +import updateNotifier = require('update-notifier'); + +var notifier = updateNotifier(); + +if (notifier.update) { + notifier.notify(); +} + +console.log(notifier.update); + +var notifier = updateNotifier({ + updateCheckInterval: 1000 * 60 * 60 * 24 * 7 // 1 week +}); + +if (notifier.update) { + notifier.notify('Update available: ' + notifier.update.latest); +} diff --git a/update-notifier/update-notifier.d.ts b/update-notifier/update-notifier.d.ts new file mode 100644 index 0000000000..965b3631bf --- /dev/null +++ b/update-notifier/update-notifier.d.ts @@ -0,0 +1,36 @@ +// Type definitions for update-notifier +// Project: https://github.com/yeoman/update-notifier +// Definitions by: vvakame +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "update-notifier" { + function t(settings?:t.ISettings):t.IResult; + + module t { + + export interface IResult { + update: IUpdateInfo; + notify(message?:string):void; + } + + export interface ISettings { + callback?:(error:any, update?:IUpdateInfo)=>any; // default null + packagePath?:string; // default 'package.json' + packageName?:string; // default Inferred from packageFile + packageVersion?:string; // default Inferred from packageFile + updateCheckInterval?:number; // default 1000 * 60 * 60 * 24 (1 day) + updateCheckTimeout?:number; // default 20000 (20 secs) + registryUrl?:string; // default 'http://registry.npmjs.org/%s' + } + + export interface IUpdateInfo { + latest:string; + current:string; + type:string; + date:string; + name:string; + } + } + + export = t; +}