glendam/install

This module provides basic browser installation functionality, allowing you to install a local version of Google Chrome for Testing in the current directory on macOS and Linux.

Usage

You may run browser installation directly with

gleam run -m glendam/install

When running directly, you can configure the browser version to install by setting the GLENDAM_TARGET_VERSION environment variable, it will default to latest. You may also set the directory to install under, with GLENDAM_TARGET_PATH.

The browser will be installed into a directory called chrome under the target directory. There is no support for managing multiple browser installations, if an installation is already present for the same version, the script will overwrite it.

To uninstall browsers installed by this tool just remove the chrome directory created by it, or delete an individual browser installation from inside it.

Caveats

This module attempts to rudimentarily mimic the functionality of the puppeteer install script, the only goal is to have a quick and convenient way to install browsers locally, for more advanced management of browser installations, please seek out other tools.

Supported platforms are limited by what the Google Chrome for Testing distribution supports, which is currently:

Notably, this distribution unfortunately does not support ARM64 on Linux.

Linux Dependencies

The tool does not install dependencies on Linux, you must install them yourself.

On debian / ubuntu based systems you may install dependencies with the following command:

sudo apt-get update && sudo apt-get install -y \
ca-certificates \
fonts-liberation \
libasound2 \
libatk-bridge2.0-0 \
libatk1.0-0 \
libc6 \
libcairo2 \
libcups2 \
libdbus-1-3 \
libexpat1 \
libfontconfig1 \
libgbm1 \
libgcc1 \
libglib2.0-0 \
libgtk-3-0 \
libnspr4 \
libnss3 \
libpango-1.0-0 \
libpangocairo-1.0-0 \
libstdc++6 \
libx11-6 \
libx11-xcb1 \
libxcb1 \
libxcomposite1 \
libxcursor1 \
libxdamage1 \
libxext6 \
libxfixes3 \
libxi6 \
libxrandr2 \
libxrender1 \
libxss1 \
libxtst6 \
lsb-release \
wget \
xdg-utils

Types

Describes a Chrome for Testing installation failure.

pub type InstallationError {
  UnsupportedPlatform(
    operating_system: String,
    architecture: String,
  )
  VersionListRequestCouldNotBeBuilt(url: String)
  VersionListCouldNotBeFetched(
    url: String,
    reason: httpc.HttpError,
  )
  VersionListReturnedUnexpectedStatus(url: String, status: Int)
  VersionListWasNotJson(
    url: String,
    content_type: option.Option(String),
  )
  VersionListCouldNotBeDecoded(reason: json.DecodeError)
  RequestedVersionWasNotFound(requested_version: String)
  PlatformDownloadWasNotFound(version: String, platform: String)
  DownloadRequestCouldNotBeBuilt(url: String)
  DownloadCouldNotBeFetched(url: String, reason: httpc.HttpError)
  DownloadReturnedUnexpectedStatus(url: String, status: Int)
  InstallationDirectoryCouldNotBeCreated(
    path: String,
    reason: simplifile.FileError,
  )
  DownloadCouldNotBeWritten(
    path: String,
    reason: simplifile.FileError,
  )
  ArchiveCouldNotBeExtracted(path: String, reason: String)
  InstallationDirectoryCouldNotBeRead(
    path: String,
    reason: simplifile.FileError,
  )
  InstallationEntryCouldNotBeInspected(
    path: String,
    reason: simplifile.FileError,
  )
  ExecutablePermissionCouldNotBeSet(path: String, reason: String)
  DownloadArchiveCouldNotBeDeleted(
    path: String,
    reason: simplifile.FileError,
  )
  ExecutableWasNotFound(installation_directory: String)
}

Constructors

  • UnsupportedPlatform(
      operating_system: String,
      architecture: String,
    )

    No Chrome build is published for the current operating system and architecture.

  • VersionListRequestCouldNotBeBuilt(url: String)

    The version-list request URL could not be converted into an HTTP request.

  • VersionListCouldNotBeFetched(
      url: String,
      reason: httpc.HttpError,
    )

    The version-list endpoint could not be reached.

  • VersionListReturnedUnexpectedStatus(url: String, status: Int)

    The version-list endpoint returned an unsuccessful status.

  • VersionListWasNotJson(
      url: String,
      content_type: option.Option(String),
    )

    The version-list endpoint did not identify its response as JSON.

  • VersionListCouldNotBeDecoded(reason: json.DecodeError)

    The version-list response did not match the expected schema.

  • RequestedVersionWasNotFound(requested_version: String)

    No published Chrome build matched the requested version.

  • PlatformDownloadWasNotFound(version: String, platform: String)

    The selected Chrome version has no download for the current platform.

  • DownloadRequestCouldNotBeBuilt(url: String)

    The selected download URL could not be converted into an HTTP request.

  • DownloadCouldNotBeFetched(url: String, reason: httpc.HttpError)

    The selected Chrome archive could not be downloaded.

  • DownloadReturnedUnexpectedStatus(url: String, status: Int)

    The Chrome archive endpoint returned an unsuccessful status.

  • InstallationDirectoryCouldNotBeCreated(
      path: String,
      reason: simplifile.FileError,
    )

    An installation directory could not be created.

  • DownloadCouldNotBeWritten(
      path: String,
      reason: simplifile.FileError,
    )

    The downloaded archive could not be written to disk.

  • ArchiveCouldNotBeExtracted(path: String, reason: String)

    The downloaded archive could not be extracted.

  • InstallationDirectoryCouldNotBeRead(
      path: String,
      reason: simplifile.FileError,
    )

    The installation directory could not be inspected.

  • InstallationEntryCouldNotBeInspected(
      path: String,
      reason: simplifile.FileError,
    )

    An extracted installation entry could not be inspected.

  • ExecutablePermissionCouldNotBeSet(path: String, reason: String)

    An extracted executable could not have its permission bits updated.

  • DownloadArchiveCouldNotBeDeleted(
      path: String,
      reason: simplifile.FileError,
    )

    The downloaded archive could not be removed after extraction.

  • ExecutableWasNotFound(installation_directory: String)

    No Chrome executable was present in the extracted archive.

Values

pub fn install() -> Result(String, InstallationError)

Install a local version of Google Chrome for Testing. This function is meant to be called in a script, it will log errors and warnings to the console. and return a generic error if installation fails.

pub fn install_with_config(
  to target_path: String,
  version target_version: String,
) -> Result(String, InstallationError)

Install a specific local version of Google Chrome for Testing to a specific directory. This function is meant to be called in a script, it will log errors and warnings to the console. and return a generic error if installation fails.

pub fn main() -> Result(String, InstallationError)

Runs this module’s command-line entrypoint.

Search Document