Class Package

Represents a package and provides methods to download and install it.

Template: Package

Hierarchy

Constructors

  • Constructs a new instance of the class.

    Parameters

    • pkgConfig: WPMMconfigPkg

      the configuration object

    • packageType: string

      the type of package

    • paths: WPMMpaths

      the object containing the paths

    Returns Package

Properties

destFolder: string

the destination folder

packageType: string

the package type

pkgInfo: WPMMconfigPkg

the package info

tempDir: string

the temporary directory

Methods

  • Asynchronously clones a repository from a given URL to a specified directory.

    Parameters

    • packageUrl: string

      The URL of the repository to clone.

    Returns Promise<unknown>

    A promise that resolves to the path of the cloned package on success, or rejects with an error on failure.

  • Downloads a package from a given URL and saves it to the target directory.

    Parameters

    • packageUrl: string

      The URL of the package to download.

    Returns Promise<void>

    A promise that resolves when the package is successfully downloaded and saved, or rejects with an error.

  • Downloads a file from a given URL and extracts it to a specified destination.

    Parameters

    • filename: string

      The name of the file to be downloaded.

    • downloadUrl: string

      The URL from which the file will be downloaded.

    Returns Promise<string>

    A promise that resolves when the file is downloaded and extracted successfully.

  • Gets the destination folder based on the package type.

    Parameters

    • paths: WPMMpaths

      An array of paths.

    • packageType: string

      The type of package ('plugin' or 'theme').

    Returns string

    The destination folder path.

  • This is a method that retrieves the version of the current package.

    No parameters are needed for this method.

    Returns {
        version: undefined | string;
    }

    Returns an object with the version of the current package.

    • version: undefined | string
  • Installs a package with the given name, version, and type.

    Returns Promise<void>

    • A promise that resolves once the package is downloaded and installed.

Generated using TypeDoc