mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
update-notifier: Add export = declaration (#13839)
This commit is contained in:
parent
198918d97c
commit
b259e475a5
@ -8,7 +8,7 @@ const path = require("path");
|
||||
const symlinkedTslintPath = "../node_modules/types-publisher/node_modules/tslint"
|
||||
let tslintPath = existsSync(path.join(pkg, symlinkedTslintPath)) ? symlinkedTslintPath : "../node_modules/tslint";
|
||||
// An older version (e.g. abs/v0) is in a nested directory, so needs to look one more level up for tslint.
|
||||
if (pkg.includes("/")) {
|
||||
if (pkg.includes("/") && pkg[pkg.length - 1] !== "/") {
|
||||
tslintPath = path.join("..", tslintPath);
|
||||
}
|
||||
|
||||
|
||||
80
update-notifier/index.d.ts
vendored
80
update-notifier/index.d.ts
vendored
@ -1,47 +1,53 @@
|
||||
// Type definitions for update-notifier
|
||||
// Type definitions for update-notifier 1.0
|
||||
// Project: https://github.com/yeoman/update-notifier
|
||||
// Definitions by: vvakame <https://github.com/vvakame>, Noah Chen <https://github.com/nchen63>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export interface ISettings {
|
||||
pkg?: IPackage;
|
||||
callback?: (update?: IUpdateInfo) => any;
|
||||
packageName?: string;
|
||||
packageVersion?: string;
|
||||
updateCheckInterval?: number; // in milliseconds, default 1000 * 60 * 60 * 24 (1 day)
|
||||
}
|
||||
export = UpdateNotifier;
|
||||
|
||||
export interface IBoxenOptions {
|
||||
padding: number;
|
||||
margin: number;
|
||||
align: string;
|
||||
borderColor: string;
|
||||
borderStyle: string;
|
||||
}
|
||||
declare function UpdateNotifier(settings?: UpdateNotifier.Settings): UpdateNotifier.UpdateNotifier;
|
||||
|
||||
export interface INotifyOptions {
|
||||
message: string;
|
||||
defer?: boolean;
|
||||
boxenOpts?: IBoxenOptions;
|
||||
}
|
||||
declare namespace UpdateNotifier {
|
||||
class UpdateNotifier {
|
||||
constructor(settings?: UpdateNotifier.Settings);
|
||||
|
||||
export interface IPackage {
|
||||
name: string;
|
||||
version: string;
|
||||
}
|
||||
update: UpdateNotifier.UpdateInfo;
|
||||
check(): void;
|
||||
checkNpm(): void;
|
||||
notify(customMessage?: UpdateNotifier.NotifyOptions): void;
|
||||
}
|
||||
|
||||
export interface IUpdateInfo {
|
||||
latest: string;
|
||||
current: string;
|
||||
type: string;
|
||||
name: string;
|
||||
}
|
||||
interface Settings {
|
||||
pkg?: Package;
|
||||
callback?: (update?: UpdateInfo) => any;
|
||||
packageName?: string;
|
||||
packageVersion?: string;
|
||||
updateCheckInterval?: number; // in milliseconds, default 1000 * 60 * 60 * 24 (1 day)
|
||||
}
|
||||
|
||||
export declare class UpdateNotifier {
|
||||
constructor(settings?: ISettings);
|
||||
|
||||
update: IUpdateInfo;
|
||||
check(): void;
|
||||
checkNpm(): void;
|
||||
notify(customMessage?: INotifyOptions): void;
|
||||
interface BoxenOptions {
|
||||
padding: number;
|
||||
margin: number;
|
||||
align: string;
|
||||
borderColor: string;
|
||||
borderStyle: string;
|
||||
}
|
||||
|
||||
interface NotifyOptions {
|
||||
message: string;
|
||||
defer?: boolean;
|
||||
boxenOpts?: BoxenOptions;
|
||||
}
|
||||
|
||||
interface Package {
|
||||
name: string;
|
||||
version: string;
|
||||
}
|
||||
|
||||
interface UpdateInfo {
|
||||
latest: string;
|
||||
current: string;
|
||||
type: string;
|
||||
name: string;
|
||||
}
|
||||
}
|
||||
|
||||
1
update-notifier/tslint.json
Normal file
1
update-notifier/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
@ -1,7 +1,6 @@
|
||||
import UpdateNotifier = require("update-notifier");
|
||||
|
||||
import { UpdateNotifier } from "update-notifier";
|
||||
|
||||
var notifier = new UpdateNotifier();
|
||||
var notifier = UpdateNotifier();
|
||||
|
||||
if (notifier.update) {
|
||||
notifier.notify();
|
||||
@ -9,7 +8,8 @@ if (notifier.update) {
|
||||
|
||||
console.log(notifier.update);
|
||||
|
||||
var notifier = new UpdateNotifier({
|
||||
// Also exposed as a class
|
||||
var notifier = new UpdateNotifier.UpdateNotifier({
|
||||
updateCheckInterval: 1000 * 60 * 60 * 24 * 7 // 1 week
|
||||
});
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user