git-flush
Version:
Commits and pushes if repository is dirty. Does nothing otherwise.
25 lines • 983 B
TypeScript
/** @module git-flush
*/
declare module "git-flush" {
/**
* @typedef {Object} Options
* @prop {string} directory Path to the git repository
* @prop {boolean} push If `true`, pushes after committing
* @prop {boolean} pull If `true`, pulls before committing
*/
export type Options = {
directory: string;
push: boolean;
pull: boolean;
};
/**
* If repository is dirty, the changes will be stashed, committed and optionally pushed. If repository is clean, does nothing.
* @param {string} [message = Commit from script]
* @param {Options} [options = {}]
* @returns {Promise<null|number>} `null` if directory is not a git repository, `number` of commit changes if directory is a git repository
* @example
* import gitFlush from "git-flush"
* const result = await gitFlush("Commit message")
*/
export default function(message?: string, options?: Options): Promise<null | number>;
}