/** * Represents a package in the project. */ interface Package { /** The root directory of the project. */ root: string; /** The name of the project. */ name: string; } /** * Namespace containing types related to release options. */ declare namespace Release { /** * Type representing possible release options. * */ type Option = ('--verbose' | '--version' | '--v' | '--access' | '--origin' | '--o' | '--npm' | '--build'); /** * Interface representing release accepted options. * */ interface Options { /** * The version to release. * * Retrieved from `--version` process option or package.json if omitted. * */ version?: string; /** * A custom build command that will build your project before publish. * * Retrieved from `--build` process option or fallback to `build` if omitted. * * @default 'build' */ build?: string; /** * Enables detailed logging. * * Retrieved from `--verbose` process option or fallback to `false` if omitted. * * @default false */ verbose?: boolean; /** * The Git origin name used for pushing version tags. * * Retrieved from `--origin` or `--o` process option or fallback to `origin` if omitted. * * @default 'origin' */ origin?: string; /** * Indicates whether to publish the package to npm. * * Retrieved from `--npm` process option or fallback to `false` if omitted. * * @default false */ npm?: boolean; /** * Sets npm package access level. * * Retrieved from `--access` process option or fallback to `public` if omitted. * * @default 'public' */ access?: 'public' | 'restricted'; } } /** * Namespace for NodeJS related types. */ declare namespace NodeJS { /** * Namespace for Process related types. */ namespace Process { /** * Type representing a value in the process arguments. * * @template T - The type of the argument value, defaults to `string`. * @type T | 'true' - The argument value can be of type `T` or `'true'`. */ type ArgvValue = T | 'true'; type DefaultOption = '--executable' | '--scriptPath'; type OptionName = T | NodeJS.Process.DefaultOption; type OptionsMap = { [x in NodeJS.Process.OptionName]: NodeJS.Process.ArgvValue; }; } interface GlobalPackage { version?: string; overridden: boolean; problems?: string[]; } interface LocalPackage extends GlobalPackage { resolved: string; extraneous?: boolean; } namespace Deps { interface Global { name?: string; dependencies?: Record; } interface Local extends Global, Omit { dependencies?: Record; } } } /** * Namespace containing Git-related types. */ declare namespace Git { /** * Namespace containing types and interfaces related to remote operations. */ namespace Remote { /** * Type representing the kind of remote url type. * - 'fetch': Represents a fetch operation. * - 'push': Represents a push operation. */ type Type = 'fetch' | 'push'; /** * Type representing a map of url types to their corresponding URLs. */ type Urls = globalThis.Map; /** * Union type representing the possible keys for the Git.Remote.Map. * - 'name': Represents the name key. * - 'urls': Represents the URLs key. */ type MapKey = 'name' | 'urls'; /** * Conditional type that maps a Remote.MapKey to its corresponding value type. * - If T is 'urls', the value type is Remote.Urls. * - If T is 'name', the value type is string. * - Otherwise, the value type is never. */ type MapValue = (T extends 'urls' ? Remote.Urls : T extends 'name' ? string : never); /** * Interface representing a map with keys of type Remote.MapKey and values of type Remote.MapValue. * Extends the global Map interface. * * @template K - The type of the keys in the map. Defaults to Remote.MapKey. */ interface Map extends globalThis.Map> { /** * Executes a provided function once per each key/value pair in the Map, in insertion order. */ forEach(callbackfn: (value: Remote.MapValue, key: K, map: globalThis.Map>) => void, thisArg?: any): void; /** * Returns a specified element from the Map object. If the value that is associated to the provided key is an object, then you will get a reference to that object and any change made to that object will effectively modify it inside the Map. * @returns Returns the element associated with the specified key. If no element is associated with the specified key, undefined is returned. */ get(key: K): Remote.MapValue | undefined; /** * Adds a new element with a specified key and value to the Map. If an element with the same key already exists, the element will be updated. */ set(key: K, value: Remote.MapValue): this; } } /** * Represents a Git stash. */ interface Stash { /** * The index of the stash. */ index: number; /** * The branch associated with the stash. */ branch: string; /** * The name of the stash, or null if not named. */ name: string | null; } /** * Options for retrieving a stash by either index or name. */ type GetStashByOptions = ({ /** * The index of the stash to retrieve. */ index: NonNullable; } | { /** * The name of the stash to retrieve. */ name: NonNullable; }); namespace Diff { type Option = ('--file' | '--cached' | '--staged' | '--verbose'); interface Options { file?: true | string; cached?: boolean; staged?: boolean; verbose?: boolean; } } } export { Git, NodeJS, type Package, Release };