mirror of https://github.com/aminya/setup-cpp
docs: add examples for setup-apt functions
This commit is contained in:
parent
19bf09e888
commit
2032957802
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -100,6 +100,23 @@ Install a package using apt
|
|||
|
||||
**returns:** Promise<InstallationInfo>
|
||||
|
||||
```ts
|
||||
await installAptPack([{ name: "ca-certificates" }, { name: "gnupg" }])
|
||||
```
|
||||
|
||||
```ts
|
||||
await installAptPack([
|
||||
{
|
||||
name: "gcc",
|
||||
version,
|
||||
repositories: ["ppa:ubuntu-toolchain-r/test"],
|
||||
addAptKey: [
|
||||
{ keys: ["1E9377A2BA9EF27F"], fileName: "ubuntu-toolchain-r-test.gpg" },
|
||||
],
|
||||
},
|
||||
])
|
||||
```
|
||||
|
||||
### `hasNala` (function)
|
||||
|
||||
Check if nala is installed
|
||||
|
@ -123,26 +140,58 @@ Get the environment variables to use for the apt command
|
|||
|
||||
**returns:** ProcessEnv
|
||||
|
||||
### `AddAptKeyOptions` (type)
|
||||
|
||||
### `addAptKey` (function)
|
||||
|
||||
Add an apt key
|
||||
|
||||
**Parameters:**
|
||||
|
||||
- options (`AddAptKeyOptions`) - The options for adding the key
|
||||
|
||||
**returns:** Promise<string>
|
||||
|
||||
```ts
|
||||
await addAptKey({
|
||||
keys: ["3B4FE6ACC0B21F32", "40976EAF437D05B5"],
|
||||
fileName: "bazel-archive-keyring.gpg",
|
||||
})
|
||||
```
|
||||
|
||||
```ts
|
||||
await addAptKey({
|
||||
keyUrl: "https://bazel.build/bazel-release.pub.gpg",
|
||||
fileName: "bazel-archive-keyring.gpg",
|
||||
})
|
||||
```
|
||||
|
||||
### `defaultKeyStorePath` (variable)
|
||||
|
||||
### `KeyServerOptions` (type)
|
||||
|
||||
### `defaultKeyServer` (variable)
|
||||
|
||||
### `addAptKeyViaServer` (function)
|
||||
|
||||
Add an apt key via a keyserver
|
||||
|
||||
**Parameters:**
|
||||
|
||||
- keys (`string[]`) - The keys to add
|
||||
- name (`string`) - The name of the key
|
||||
- server (`string`) - The keyserver to use (Defaults to `keyserver.ubuntu.com`)
|
||||
- { keys, keyServer = defaultKeyServer, fileName, keyStorePath = defaultKeyServer } (`KeyServerOptions`)
|
||||
|
||||
**returns:** Promise<string>
|
||||
|
||||
### `KeyUrl` (type)
|
||||
|
||||
### `addAptKeyViaURL` (function)
|
||||
|
||||
Add an apt key via a download
|
||||
|
||||
**Parameters:**
|
||||
|
||||
- name (`string`) - The name of the key
|
||||
- url (`string`) - The URL of the key
|
||||
- options - The options for adding the key
|
||||
- { keyUrl, fileName, keyStorePath = defaultKeyStorePath } (`KeyUrl`)
|
||||
|
||||
**returns:** Promise<string>
|
||||
|
||||
|
|
|
@ -55,6 +55,25 @@ const retryErrors = [
|
|||
*
|
||||
* @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,
|
||||
repositories: ["ppa:ubuntu-toolchain-r/test"],
|
||||
addAptKey: [{ keys: ["1E9377A2BA9EF27F"], fileName: "ubuntu-toolchain-r-test.gpg" }],
|
||||
},
|
||||
])
|
||||
* ```
|
||||
*/
|
||||
export async function installAptPack(packages: AptPackage[], update = false): Promise<InstallationInfo> {
|
||||
const apt: string = getApt()
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<h1 align="center">setup-brew</h1>
|
||||
<p>
|
||||
<img alt="Version" src="https://img.shields.io/badge/version-1.0.0-blue.svg?cacheSeconds=2592000" />
|
||||
<a href="https://www.npmjs.com/package/setup-brew" target="_blank">
|
||||
<img alt="Version" src="https://img.shields.io/npm/v/setup-brew.svg">
|
||||
</a>
|
||||
<img src="https://img.shields.io/badge/node-%3E%3D12-blue.svg" />
|
||||
<a href="#" target="_blank">
|
||||
<img alt="License: Apache--2.0" src="https://img.shields.io/badge/License-Apache--2.0-yellow.svg" />
|
||||
|
@ -47,8 +49,9 @@ A function that installs a package using brew
|
|||
|
||||
**Parameters:**
|
||||
|
||||
- name (`string`)
|
||||
- version (`string`)
|
||||
- name (`string`) - The name of the package
|
||||
- version (`string`) - The version of the package (optional)
|
||||
- options - The options for installing the package
|
||||
- givenOptions (`BrewPackOptions`)
|
||||
|
||||
**returns:** Promise<InstallationInfo>
|
||||
|
|
|
@ -17,7 +17,14 @@ export type BrewPackOptions = {
|
|||
args?: string[]
|
||||
}
|
||||
|
||||
/** A function that installs a package using brew */
|
||||
/** A function that installs a package using brew
|
||||
*
|
||||
* @param name The name of the package
|
||||
* @param version The version of the package (optional)
|
||||
* @param options The options for installing the package
|
||||
*
|
||||
* @returns The installation information
|
||||
*/
|
||||
export async function installBrewPack(
|
||||
name: string,
|
||||
version?: string,
|
||||
|
|
Loading…
Reference in New Issue