1.0.0 • Published 3 years ago

hubtag v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

hubtag

Emit events on Docker Hub image tag changes (currently limited to handle push events).

Example Usage

import { TagWatcher } from 'hubtag';

new TagWatcher({ image: 'debian', tag: '10' })
	.on('push', (date) => console.log('image tag was updated', date))
	.on('error', (e) => console.error(e))
	.start();

Configuration

interface TagWatcherOptions {
	/**
	 * Image name (e.g. `debian` or `containrrr/watchtower`)
	 */
	image: string;
	/**
	 * Tag name (e.g. `10` or `c0mm17h45h`)
	 */
	tag: string;
	/**
	 * Interval in ms, defaults to 60 seconds
	 */
	interval?: number;
}

Events

error -> (e: Error) => void

Emits fetcher errors.

push -> (date: Date) => void

Emits push events, the date parameter is the last pushed timestamp.

fetch -> (result: any) => void

Emits successful fetches, the result parameter contains the parsed JSON response.

TagWatcher interface

interface ITagWatcher {
	isWatching: boolean;
	on<T extends keyof TagWatcherEvents>(evt: T, cb: TagWatcherEvents[T]): TagWatcher;
	off<T extends keyof TagWatcherEvents>(evt: T, cb: TagWatcherEvents[T]): TagWatcher;
	offAll<T extends keyof TagWatcherEvents>(evt?: T): TagWatcher;
	start(): TagWatcher;
	stop(): TagWatcher;
}
1.0.0

3 years ago