Options
All
  • Public
  • Public/Protected
  • All
Menu

@metaplex-foundation/rustbin

Index

Type aliases

ConfirmInstall: (args: ConfirmInstallArgs) => Promise<boolean>

Type declaration

    • Function that can be passed to rustbinMatch to confirm the install step.

      Return true if it should be installed and false if not.

      This can also be used to print information about the install about to happen.

      Parameters

      Returns Promise<boolean>

ConfirmInstallArgs: { binVersion?: string; binaryName: string; fullPathToBinary: string; libName: string; libVersion: string }

The args passed to ConfirmInstall

Type declaration

  • Optional binVersion?: string
  • binaryName: string
  • fullPathToBinary: string
  • libName: string
  • libVersion: string
RustbinCheckReturn: { binVersion?: string; libVersion: string; satisfies: boolean }

Returned by rustbinCheck

property

satisfies - true if the binary version satisfies the library version range

property

libVersion - the library version range

property

binVersion - the binary version (if it is not defined then the binary was either not found or the version output could not be parsed)

Type declaration

  • Optional binVersion?: string
  • libVersion: string
  • satisfies: boolean
RustbinConfig: { binaryCrateName?: string; binaryName: string; binaryVersionFlag?: string; binaryVersionRx?: RegExp; cargoToml: string; dryRun?: boolean; libName: string; locked?: boolean; rootDir: string; versionRangeFallback?: string }

Configures how rustbin checks/matches the installed binary with the installed library.

property

rootDir - the directory where cargo install will place the install metadata files and the binary below ./bin

property

binaryName - the name of the binary executable to check/install

property

binaryCrateName - the name of the binary on crates.io

property

binaryVersionFlag - the flag to pass to the binary to have it print the version string

property

binaryVersionRx - a regex to extract the version from the binary version output string

property

libName - the name of the matching installed library

property

cargoToml - the path to the Cargo.toml file in which the version of the library is defined

property

versionRangeFallback - the binary version/range to use if the one matching the lib version is not installable. This should be used with care as this could result in an incompatible version to be installed.

property

locked - if true a --locked flag is passed to cargo install

property

dryRun - if true, the binary will not be installed even if it is necessary

Type declaration

  • Optional binaryCrateName?: string
  • binaryName: string
  • Optional binaryVersionFlag?: string
  • Optional binaryVersionRx?: RegExp
  • cargoToml: string
  • Optional dryRun?: boolean
  • libName: string
  • Optional locked?: boolean
  • rootDir: string
  • Optional versionRangeFallback?: string
RustbinMatchReturn: { binVersion?: string; cmd?: string; fullPathToBinary: string; libVersion: string }

Returned by rustbinMatch

property

cmd - the command to install the binary (empty if no install is needed)

property

libVersion - the library version range

property

binVersion - the binary version (if it is not defined then the binary was either not found or the version output could not be parsed)

property

fullPathToBinary - the full path to the installed binary

Type declaration

  • Optional binVersion?: string
  • Optional cmd?: string
  • fullPathToBinary: string
  • libVersion: string

Functions

  • Prints information about the install about to happen to the console and confirms it.

    Parameters

    Returns Promise<boolean>

  • Checks if the installed binary matches the installed library.

    Parameters

    Returns Promise<RustbinCheckReturn>

    result of check including if the binary version satisfies the library version range

  • Checks if the installed binary matches the installed library. If not it attempts to install the latest binary matching the library version range via cargo install.

    Parameters

    Returns Promise<RustbinMatchReturn>

    result including the cmd used to install the binary (if it was necessary), the full path to said binary and the installed version of it

  • rustbinVersion(fullPathToBinary: string, binaryVersionFlag?: string, binaryVersionRx?: RegExp): Promise<undefined | string>
  • Queries version of the installed binary.

    Parameters

    • fullPathToBinary: string
    • binaryVersionFlag: string = DEFAULT_BINARY_VERSION_FLAG
    • binaryVersionRx: RegExp = versionRx

    Returns Promise<undefined | string>

    version of the installed binary or undefined if the binary was not found or the version string could not be parsed

Generated using TypeDoc