Documentation ¶
Index ¶
- Constants
- Variables
- func Dependencies(name string) (map[string]string, error)
- func DownloadMod(name string, preferPacked bool) (bytes.Buffer, string, error)
- func MergePkgInfo(info *pkg.Info) error
- func PkgInfo(name string) (pkg.Info, error)
- func PkgInfos() ([]pkg.Info, error)
- type NodeOSPlatform
- type PackageDB
- type PackageDBHash
- type PackageDBInstallationMethod
- type PackageDBInstallationMethodCCMod
- type PackageDBInstallationMethodCommon
- type PackageDBInstallationMethodModZip
- type PackageDBInstallationMethodType
- type PackageDBMetadataPage
- type PackageDBPackage
- type PackageDBPackageMetadata
- type PackageDBPackageType
- type Semver
- type SemverConstraint
Constants ¶
const ( NodeOSPlatformAix NodeOSPlatform = "aix" NodeOSPlatformDarwin = "darwin" NodeOSPlatformFreeBSD = "freebsd" NodeOSPlatformLinux = "linux" NodeOSPlatformOpenBSD = "openbsd" NodeOSPlatformSunos = "sunos" NodeOSPlatformWindows = "win32" NodeOSPlatformAndroid = "android" )
Possible values for NodeOSPlatform
const ( PackageDBPackageTypeMod PackageDBPackageType = "mod" PackageDBPackageTypeTool = "tool" PackageDBPackageTypeBase = "base" )
Possible values for PackageDBPackageType
const ( PackageDBInstallationMethodTypeModZip = "modZip" PackageDBInstallationMethodTypeModCCMod = "ccmod" )
Possible values for PackageDBInstallationMethodType
Variables ¶
var ( //ErrNoInstallMethods is returned when a mod has no known or valid installation methods ErrNoInstallMethods = errors.New("moddb: No installation method available") )
var ErrWrongInstallationMethod = errors.New("moddb: Wrong installation method")
ErrWrongInstallationMethod is returned when wrong PackageDBInstallationMethod type is parsed.
Functions ¶
func Dependencies ¶
Dependencies of a package.
func DownloadMod ¶
DownloadMod as io.ReadCloser.
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 ¶
type PackageDBInstallationMethod struct { PackageDBInstallationMethodCommon PackageDBInstallationMethodModZip PackageDBInstallationMethodCCMod }
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.)