UNPKG

vag_tools

Version:

api and cli for managing sub-git-repositories

94 lines (92 loc) 4.79 kB
/** The interface `tListC` is used to construct the property `listC`. */ interface tListC { [p: string]: { url: string; version: string; }; } /** * A class that contains a list of configured repositories, a list of discovered repositories and methods that use those two lists. */ declare class Vag { /** The top directory from where to search repositories. */ discoverDir: string; /** When a repository is encountered, should it be inspected for searching sub-repositories? */ deepSearch: boolean; /** The path to the yaml-file that provides the repositories to be cloned. */ importYaml: string; /** The base directory where the directories listed in the yaml-file should be cloned. */ importDir: string; /** The list of the path of the discovered repositories. It is populated by the `init()` method. */ listD: string[]; /** An object with the content of the yaml-file. It is populated by the `init()` method. */ listC: tListC; /** * The constructor of the `Vag` class. * `listD` is initialized to an empty list. * `listC` is initialized to an empty object. */ constructor(discoverDir?: string, deepSearch?: boolean, importYaml?: string, importDir?: string); discover_repos(discoverDir?: string, deepSearch?: boolean): Promise<number>; import_yaml(importYaml?: string, importDir?: string): Promise<number>; /** * The `init` method populate populate `listD` and `listC`. * It must be called just after instanciating `Vag`. * The configuration properties `discoverDir`, `deepSearch`, `importYaml` and `importDir` can be reassinged by `init`. */ init(discoverDir?: string, deepSearch?: boolean, importYaml?: string, importDir?: string): Promise<number>; /** List the discovered repositories. */ d_list(): string[]; /** List the wished repositories (a.k.a. configured repositories). */ c_list(): string[]; /** List the git-repos which are in the D-list and in the C-list. I.e. Intersection of D and C. */ cd_list(): string[]; /** List the git-repos which are in the D-list but not in the C-list. I.e. D not C. */ dnc_list(): string[]; /** List the git-repos which are in the C-list but not in the D-list. I.e. C not D. */ cnd_list(): string[]; /** Clone the repositories of `listC`. */ c_clone(): Promise<number>; /** Checkout the repositories listed in `listC` and `listD`. */ cd_checkout(): Promise<number>; /** For the repositories listed in `listC` and `listD`, verify if they fit with the configuration of Yaml-file. */ cd_verify(): Promise<number>; /** Run a custom git-command on the discoverd repositories (`listD`). */ d_custom(git_command: string, only_configured_repo?: boolean): Promise<number>; /** Git-fetch on the discoverd repositories (`listD`). */ d_fetch(only_configured_repo?: boolean): Promise<number>; /** Git-pull on the discoverd repositories (`listD`). */ d_pull(only_configured_repo?: boolean): Promise<number>; /** Git-push on the discoverd repositories (`listD`). */ d_push(only_configured_repo?: boolean): Promise<number>; /** Show the current branch of the discoverd repositories (`listD`). */ d_branch(only_configured_repo?: boolean): Promise<number>; /** Git-status on the discoverd repositories (`listD`). */ d_status(only_configured_repo?: boolean): Promise<number>; /** Git-diff on the discoverd repositories (`listD`). */ d_diff(only_configured_repo?: boolean): Promise<number>; /** `Git-log -n 3` on the discoverd repositories (`listD`). */ d_log(only_configured_repo?: boolean): Promise<number>; /** `Git-remote -vv` on the discoverd repositories (`listD`). */ d_remote(only_configured_repo?: boolean): Promise<number>; /** `Git-stash list` on the discoverd repositories (`listD`). */ d_stash_list(only_configured_repo?: boolean): Promise<number>; /** `Git-clean -dxf` on the discoverd repositories (`listD`). */ d_clean(only_configured_repo?: boolean): Promise<number>; /** Export in a Yaml-file the list of discoverd repositories (`listD`). */ d_export_yaml(yamlPath: string, commit_version?: boolean): Promise<number>; /** * Validate a yaml-file that could be imported later on. * * @param yamlPath the path to the yaml-file to be checked/validated. * @returns an integer-code. 0 if the validation is successful, negative otherwise. */ validate_yaml(yamlPath: string): Promise<number>; /** * Return a string with the three numbers (major, minor, patch) written in the package.json. * * @returns the string Major.Minor.Patch */ static version_short(): string; } export { Vag, type tListC };