Documentation ¶
Index ¶
- Variables
- func SplitName(packagename string) (string, string)
- type Dist
- type DistTags
- type MockRegistryClient
- func (r *MockRegistryClient) GetPackageLatestVersion(_ context.Context, name string) (*PackageVersion, error)
- func (r *MockRegistryClient) GetPackageList(_ context.Context, name string) (*PackageList, error)
- func (r *MockRegistryClient) GetPackageVersion(_ context.Context, name, _ string) (*PackageVersion, error)
- type NoOpRegistryClient
- func (c *NoOpRegistryClient) GetPackageLatestVersion(_ context.Context, _ string) (*PackageVersion, error)
- func (c *NoOpRegistryClient) GetPackageList(_ context.Context, _ string) (*PackageList, error)
- func (c *NoOpRegistryClient) GetPackageVersion(_ context.Context, _, _ string) (*PackageVersion, error)
- type PackageJSON
- type PackageList
- type PackageMaintainer
- type PackageMaintainers
- type PackageVersion
- type Registry
- type RegistryClient
- func (c *RegistryClient) GetPackageLatestVersion(parent context.Context, name string) (*PackageVersion, error)
- func (c *RegistryClient) GetPackageList(parent context.Context, name string) (*PackageList, error)
- func (c *RegistryClient) GetPackageVersion(parent context.Context, name, version string) (*PackageVersion, error)
- type RegistryClientConfig
- type ServiceError
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrPackageNotFound = errors.New("package not found") ErrVersionNotFound = errors.New("version not found") ErrLatestVersionNotFound = errors.New("latest version not found") ErrCouldNotDecodeResponse = errors.New("could not decode registry response") ErrCouldNotDoRequest = errors.New("could not start request to the registry") ErrCouldNotCreateRequest = errors.New("could not create request to the registry") )
Functions ¶
Types ¶
type MockRegistryClient ¶
type MockRegistryClient struct {
// contains filtered or unexported fields
}
func NewMockRegistryClient ¶
func NewMockRegistryClient(listFilename, versionFilename string) (*MockRegistryClient, error)
func (*MockRegistryClient) GetPackageLatestVersion ¶
func (r *MockRegistryClient) GetPackageLatestVersion(_ context.Context, name string) (*PackageVersion, error)
func (*MockRegistryClient) GetPackageList ¶
func (r *MockRegistryClient) GetPackageList(_ context.Context, name string) (*PackageList, error)
func (*MockRegistryClient) GetPackageVersion ¶
func (r *MockRegistryClient) GetPackageVersion(_ context.Context, name, _ string) (*PackageVersion, error)
type NoOpRegistryClient ¶
type NoOpRegistryClient struct{}
func (*NoOpRegistryClient) GetPackageLatestVersion ¶
func (c *NoOpRegistryClient) GetPackageLatestVersion(_ context.Context, _ string) (*PackageVersion, error)
func (*NoOpRegistryClient) GetPackageList ¶
func (c *NoOpRegistryClient) GetPackageList(_ context.Context, _ string) (*PackageList, error)
func (*NoOpRegistryClient) GetPackageVersion ¶
func (c *NoOpRegistryClient) GetPackageVersion(_ context.Context, _, _ string) (*PackageVersion, error)
type PackageJSON ¶
type PackageJSON struct { Name string `json:"name"` Scripts map[string]string `json:"scripts"` Dependencies map[string]string `json:"dependencies"` DevDependencies map[string]string `json:"devDependencies"` PeerDependencies map[string]string `json:"peerDependencies"` BundleDependencies []string `json:"bundleDependencies"` OptionalDependencies map[string]string `json:"optionalDependencies"` }
func NewPackageJSONFromDir ¶
func NewPackageJSONFromDir(dir string) (*PackageJSON, error)
func NewPackageJSONFromReader ¶
func NewPackageJSONFromReader(reader io.Reader) (*PackageJSON, error)
type PackageList ¶
type PackageList struct { Name string `json:"name"` Versions map[string]PackageVersion `json:"versions"` DistTags DistTags `json:"dist-tags"` Time map[string]time.Time `json:"time"` }
func (*PackageList) LatestVersionTime ¶
func (l *PackageList) LatestVersionTime() (*time.Time, error)
func (*PackageList) MaintainersByVersion ¶
func (l *PackageList) MaintainersByVersion(version string) (PackageMaintainers, error)
type PackageMaintainer ¶
type PackageMaintainers ¶
type PackageMaintainers []PackageMaintainer
func (PackageMaintainers) Emails ¶
func (pm PackageMaintainers) Emails() []string
type PackageVersion ¶
type PackageVersion struct { Name string `json:"name"` Description string `json:"description"` Version string `json:"version"` Dist Dist `json:"dist"` Maintainers PackageMaintainers `json:"maintainers"` Scripts map[string]string `json:"scripts"` Dependencies map[string]string `json:"dependencies"` DevDependencies map[string]string `json:"devDependencies"` }
PackageVersion represents the NPM registry response for the route <package_name>/<version>.
type Registry ¶
type Registry interface { GetPackageList(ctx context.Context, name string) (*PackageList, error) GetPackageVersion(ctx context.Context, name, version string) (*PackageVersion, error) GetPackageLatestVersion(ctx context.Context, name string) (*PackageVersion, error) }
func NewNoOpRegistryClient ¶
func NewNoOpRegistryClient() Registry
func NewRegistryClient ¶
func NewRegistryClient(config RegistryClientConfig) (Registry, error)
type RegistryClient ¶
type RegistryClient struct {
// contains filtered or unexported fields
}
func (*RegistryClient) GetPackageLatestVersion ¶
func (c *RegistryClient) GetPackageLatestVersion(parent context.Context, name string) (*PackageVersion, error)
func (*RegistryClient) GetPackageList ¶
func (c *RegistryClient) GetPackageList(parent context.Context, name string) (*PackageList, error)
func (*RegistryClient) GetPackageVersion ¶
func (c *RegistryClient) GetPackageVersion(parent context.Context, name, version string) (*PackageVersion, error)
type RegistryClientConfig ¶
type ServiceError ¶
func (*ServiceError) Error ¶
func (e *ServiceError) Error() string
Click to show internal directories.
Click to hide internal directories.