setup-cpp
Version:
Install all the tools required for building and testing C++/C projects.
57 lines (56 loc) • 1.68 kB
TypeScript
import { type AddAptKeyOptions } from "./apt-key.js";
/**
* The information about an installation result
*/
export type InstallationInfo = {
/** The install dir of the package (Defaults to `undefined`) */
installDir?: string;
/** The bin dir of the package (Defaults to `/usr/bin`) */
binDir: string;
/** The bin path of the package (Defaults to `undefined`) */
bin?: string;
};
/**
* The information about an apt package
*/
export type AptPackage = {
/** The name of the package */
name: string;
/** The version of the package (optional) */
version?: string;
/** The repository to add before installing the package (optional) */
repository?: string;
/** The key to add before installing the package (optional) */
key?: AddAptKeyOptions;
/**
* If the given version is not available, fall back to the latest version
* @default false
*/
fallBackToLatest?: boolean;
};
/**
* Install a package using apt
*
* @param packages The packages to install (name, and optional info like version and repositories)
* @param update Whether to update the package list before installing (Defaults to `false`)
*
* @returns The installation information
*
* @example
* ```ts
* await installAptPack([{ name: "ca-certificates" }, { name: "gnupg" }])
* ```
*
* @example
* ```ts
await installAptPack([
{
name: "gcc",
version,
repository: "ppa:ubuntu-toolchain-r/test",
key: { key: "1E9377A2BA9EF27F", fileName: "ubuntu-toolchain-r-test.gpg" },
},
])
* ```
*/
export declare function installAptPack(packages: AptPackage[], update?: boolean): Promise<InstallationInfo>;