diff --git a/types/gh-pages/gh-pages-tests.ts b/types/gh-pages/gh-pages-tests.ts index 83f1de8721..e0237b1bcb 100644 --- a/types/gh-pages/gh-pages-tests.ts +++ b/types/gh-pages/gh-pages-tests.ts @@ -1,15 +1,25 @@ -import ghPages = require("gh-pages"); +/// +import ghpages = require('gh-pages'); -const dir = "./"; +const dir = './'; const emptyOptions = {}; -const callback = (err: any) => { }; +const callback = (err: any) => {}; -ghPages.publish(dir, callback); -ghPages.publish(dir, emptyOptions, callback); - -ghPages.publish("dist", { - user: { - name: "Daniel", - email: "daniel@example.com" - } -}, callback); +ghpages.publish(dir, callback); +ghpages.publish(dir, emptyOptions, callback); +ghpages.publish('dist', { history: false }, callback); +ghpages.publish( + 'dist', + { + remove: '*.json', + repo: `https://${process.env.GH_TOKEN}@github.com/user/private-repo.git`, + silent: true, + git: '/path/to/git', + user: { + name: 'Daniel', + email: 'daniel@example.com', + }, + history: true, + }, + callback, +); diff --git a/types/gh-pages/index.d.ts b/types/gh-pages/index.d.ts index 59a62fc25f..1bb0dba35a 100644 --- a/types/gh-pages/index.d.ts +++ b/types/gh-pages/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for gh-pages 2.0 +// Type definitions for gh-pages 2.2 // Project: https://github.com/tschaub/gh-pages // Definitions by: Daniel Rosenwasser +// Piotr Błażejewicz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export interface PublishOptions { @@ -9,26 +10,32 @@ export interface PublishOptions { dest?: string; dotfiles?: boolean; git?: string; + /** + * Push force new commit without parent history + * @default true + */ + history?: boolean; message?: string; only?: string; push?: boolean; remote?: string; + /** + * Removes files that match the given pattern (Ignored if used together with --add). + * By default, gh-pages removes everything inside the target branch auto-generated directory before copying the new files from dir. + * @default '.' + */ + remove?: string; repo?: string; silent?: boolean; src?: string | string[]; tag?: string; user?: null | { name: string; - email: string + email: string; }; } -export function publish( - basePath: string, - callback: (err: any) => void): void; -export function publish( - basePath: string, - config: PublishOptions, - callback?: (err: any) => void): void; +export function publish(basePath: string, callback: (err: any) => void): void; +export function publish(basePath: string, config: PublishOptions, callback?: (err: any) => void): void; export function clean(): void;