version

package
v0.0.0-...-334b3f1 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultSource     = "https://registry.npmmirror.com/-/binary/node/"
	DefaultSourceType = Taobao
)

Variables

View Source
var (
	ParserNotFoundErr = errors.New("parser not found")
	NilVersionErr     = errors.New("version is nil")
	NilSHASUMSErr     = errors.New("SHASUM256.txt file not found")
)

Functions

func GetSortByVersion

func GetSortByVersion(v string) (sort int)

func IsVersionDir

func IsVersionDir(dir string) (bool, error)

IsVersionDir verify name of a dir entry the version dir name should be vX.X.X or vX.X such as v1.17.1 or v1.17

func RegisterParser

func RegisterParser(st SourceType, parser Parser)

Types

type Package

type Package struct {
	Filename    string
	ShaSums     string
	DownloadUrl string
}

type Parser

type Parser interface {
	GerVersions(source string) ([]*Version, error)
	GetPackages(v *Version, os, arch string) ([]*Package, error)
	GetShaSumsMap(url string) (map[string]string, error)
}

func LoadParser

func LoadParser(st SourceType) Parser

type SourceType

type SourceType string

SourceType source type of nodejs download url

const (
	Unknown SourceType = ""
	// Standard e.g. https://nodejs.org/dist/
	Standard SourceType = "standard"
	// Taobao e.g. https://registry.npmmirror.com/-/binary/node/
	Taobao SourceType = "taobao"
)

type StandardParser

type StandardParser struct {
}

func (*StandardParser) GerVersions

func (p *StandardParser) GerVersions(source string) ([]*Version, error)

func (*StandardParser) GetPackages

func (p *StandardParser) GetPackages(v *Version, os, arch string) ([]*Package, error)

func (*StandardParser) GetShaSumsMap

func (p *StandardParser) GetShaSumsMap(url string) (map[string]string, error)

type TaobaoParser

type TaobaoParser struct {
}

func (*TaobaoParser) GerVersions

func (p *TaobaoParser) GerVersions(source string) ([]*Version, error)

func (*TaobaoParser) GetPackages

func (p *TaobaoParser) GetPackages(v *Version, os, arch string) ([]*Package, error)

func (*TaobaoParser) GetShaSumsMap

func (p *TaobaoParser) GetShaSumsMap(sumsUrl string) (map[string]string, error)

type TbVersion

type TbVersion struct {
	Id       string
	Category string
	Name     string
	Date     string
	Type     string
	Url      string
	Modified string
}

type Version

type Version struct {
	Name     string
	Url      string
	Sort     int
	Packages []*Package
}

Jump to

Keyboard shortcuts

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