Module ammcore.pkg.package

Data about available packages and their versions.

Index

Class

PackageVersion

Represents a single package version.

Class

class ammcore.pkg.package.PackageVersion : ammcore.class.Base

Represents a single package version.

New(self: <T: ammcore.pkg.package.PackageVersion>, name: string, version: ammcore.pkg.version.Version) <T: ammcore.pkg.package.PackageVersion>
Parameters:
name: string

Name of the package.

version: ammcore.pkg.version.Version

Version of the package.

isInstalled: boolean

True if this package is already installed.

isDevMode: boolean

Indicates that this version is installed in dev mode.

isBroken: boolean

Indicates that this is a broken version, and should not be considered for installation.

Resolver marks versions as broken if they throw errors from getRequirements().

getMetadata(self: ammcore.pkg.package.PackageVersion) package: ammcore.pkg.packageJson.PackageJson

Get or fetch package metadata.

Returns:

package (ammcore.pkg.packageJson.PackageJson) – metadata.

getRequirements(self: ammcore.pkg.package.PackageVersion) requirements: table<string, ammcore.pkg.version.VersionSpec>

Get or fetch requirements for this version.

Returns:

requirements (table<string, ammcore.pkg.version.VersionSpec>) – production requirements for this version.

getDevRequirements(self: ammcore.pkg.package.PackageVersion) devRequirements: table<string, ammcore.pkg.version.VersionSpec>

Get or fetch dev requirements for this version.

Returns:

devRequirements (table<string, ammcore.pkg.version.VersionSpec>) – development requirements for this version.

getAllRequirements(self: ammcore.pkg.package.PackageVersion) allRequirements: table<string, ammcore.pkg.version.VersionSpec>

Get or fetch requirements for this version. Add dev requirements if this is a dev package.

This function caches its results to avoid re-fetching requirements.

Returns:

allRequirements (table<string, ammcore.pkg.version.VersionSpec>) – all requirements for this version.

build(self: ammcore.pkg.package.PackageVersion) archive: string

Download this package and return the package archive.

You can use results of this operation with package builder to unpack the archive.

Returns:

archive (string) – package archive, see ammcore.pkg.builder.PackageArchiver for more info.

install(self: ammcore.pkg.package.PackageVersion, packageRoot: string)

Download and install this package to the given directory.

Parameters:

packageRoot (string) – package installation directory, see ammcore.pkg.builder.PackageArchiver:unpack() for more info.