moddb

package
v0.0.0-...-6f03ccd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NodeOSPlatformAix     NodeOSPlatform = "aix"
	NodeOSPlatformDarwin                 = "darwin"
	NodeOSPlatformFreeBSD                = "freebsd"
	NodeOSPlatformLinux                  = "linux"
	NodeOSPlatformOpenBSD                = "openbsd"
	NodeOSPlatformSunos                  = "sunos"
	NodeOSPlatformWindows                = "win32"
	NodeOSPlatformAndroid                = "android"
)

Possible values for NodeOSPlatform

View Source
const (
	PackageDBPackageTypeMod  PackageDBPackageType = "mod"
	PackageDBPackageTypeTool                      = "tool"
	PackageDBPackageTypeBase                      = "base"
)

Possible values for PackageDBPackageType

View Source
const (
	PackageDBInstallationMethodTypeModZip   = "modZip"
	PackageDBInstallationMethodTypeModCCMod = "ccmod"
)

Possible values for PackageDBInstallationMethodType

Variables

View Source
var (
	//ErrNoInstallMethods is returned when a mod has no known or valid installation methods
	ErrNoInstallMethods = errors.New("moddb: No installation method available")
)
View Source
var ErrWrongInstallationMethod = errors.New("moddb: Wrong installation method")

ErrWrongInstallationMethod is returned when wrong PackageDBInstallationMethod type is parsed.

Functions

func Dependencies

func Dependencies(name string) (map[string]string, error)

Dependencies of a package.

func DownloadMod

func DownloadMod(name string, preferPacked bool) (bytes.Buffer, string, error)

DownloadMod as io.ReadCloser.

func MergePkgInfo

func MergePkgInfo(info *pkg.Info) error

MergePkgInfo with old one.

func PkgInfo

func PkgInfo(name string) (pkg.Info, error)

PkgInfo reads a given pkg.Info from the moddb.

func PkgInfos

func PkgInfos() ([]pkg.Info, error)

PkgInfos reads all pkg.Infos from the moddb.

Types

type NodeOSPlatform

type NodeOSPlatform string

NodeOSPlatform identifys the operating system platform

type PackageDB

type PackageDB map[string]PackageDBPackage

PackageDB represents the database. Keys in this Record MUST match their respective `value.metadata.name`

type PackageDBHash

type PackageDBHash struct {
	//Lowercase hexadecimal-encoded SHA-256 hash of the data.
	Sha256 string `json:"sha256"`
}

PackageDBHash represents some set of hashes for something.

type PackageDBInstallationMethod

PackageDBInstallationMethod represents a method of installing the package.

type PackageDBInstallationMethodCCMod

type PackageDBInstallationMethodCCMod struct {
	PackageDBInstallationMethodCommon

	URL  string        `json:"url"`
	Hash PackageDBHash `json:"hash"`
}

PackageDBInstallationMethodCCMod contains the data required for packed mod installation

type PackageDBInstallationMethodCommon

type PackageDBInstallationMethodCommon struct {
	Type     PackageDBInstallationMethodType `json:"type"`
	Platform NodeOSPlatform                  `json:"platform"`
}

PackageDBInstallationMethodCommon contains common fields between all PackageDBInstallationMethods.

type PackageDBInstallationMethodModZip

type PackageDBInstallationMethodModZip struct {
	PackageDBInstallationMethodCCMod
	Source string `json:"source"`
}

PackageDBInstallationMethodModZip contains the data required for modzip installation

type PackageDBInstallationMethodType

type PackageDBInstallationMethodType string

PackageDBInstallationMethodType represents the possible types of a PackageDBInstallationMethod

type PackageDBMetadataPage

type PackageDBMetadataPage struct {
	//The name of the page. For the canonical GitHub or GitLab page, this must be "GitHub" / "GitLab".
	Name string `json:"name"`
	URL  string `json:"url"`
}

PackageDBMetadataPage is a page relating to the mod.

type PackageDBPackage

type PackageDBPackage struct {
	//Metadata for the package.
	Metadata PackageDBPackageMetadata `json:"metadata"`
	//Installation methods (try in order)
	Installation []PackageDBInstallationMethod `json:"installation"`
}

PackageDBPackage represents a package in the database.

type PackageDBPackageMetadata

type PackageDBPackageMetadata struct {
	Name              string                      `json:"name"`
	CCModType         PackageDBPackageType        `json:"ccmodType"`
	Version           Semver                      `json:"version"`
	CCModDependencies map[string]SemverConstraint `json:"ccmodDependencies"`
	CCModHumanName    string                      `json:"ccmodHumanName"`
	Description       string                      `json:"description"`
	Licence           string                      `json:"licence"`
	Homepage          string                      `json:"homepage"`
	Hidden            bool                        `json:"hidden"`
}

PackageDBPackageMetadata is related to the supported package metadata for mods, on purpose. Note, however, that the 'dependencies' key is NOT supported. Also note the care to try not to reinvent NPM fields, but also to avoid them when inappropriate. Some mods will use NPM packages, have NPM build commands (See: TypeScript mods), etc. So it's very important to keep the package metadata format safe for NPM to read, and that means ensuring all package metadata is either avoided by NPM or understood by it.

type PackageDBPackageType

type PackageDBPackageType string

PackageDBPackageType represents a kind of package. Please be aware that "base" is reserved for packages that absolutely require special-case local detection, and special-case UI to be user-friendly, such as CCLoader and NWJS upgrades. (In particular, CrossCode, CCLoader and NWJS upgrades require custom detection methods for their local copies.)

type Semver

type Semver string

Semver as used in nodejs

type SemverConstraint

type SemverConstraint string

SemverConstraint as used in nodejs

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL