feat(gh-pages): update to version 2.2 (#43157)

- new `history` option
- missing `remove` option
- tests refreshed

https://github.com/tschaub/gh-pages/compare/v2.0.0...v2.2.0

Thanks!
This commit is contained in:
Piotr Błażejewicz (Peter Blazejewicz) 2020-03-25 01:30:43 +01:00 committed by GitHub
parent b2d4d29f9f
commit d57a578cdc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 21 deletions

View File

@ -1,15 +1,25 @@
import ghPages = require("gh-pages");
/// <reference types="node" />
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,
);

View File

@ -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 <https://github.com/DanielRosenwasser>
// Piotr Błażejewicz <https://github.com/peterblazejewicz>
// 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;