Documentation
¶
Overview ¶
Package metadata defines a metadata struct for Javascript packages.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JavascriptPackageJSONMetadata ¶
type JavascriptPackageJSONMetadata struct {
Author *Person `json:"author"`
Maintainers []*Person `json:"maintainers"`
Contributors []*Person `json:"contributors"`
// FromNPMRepository field is annotated by the misc/from-npm annotator by parsing the lockfile
// of the root-level directory. This field is used to indicate whether this package's dependency
// was resolved from the official NPM registry during installation. If false, it means the package
// was either installed from a local path, a git repository, or another private registry.
// This is to identify name collisions between locally published packages and official NPM packages.
Source NPMPackageSource
}
JavascriptPackageJSONMetadata holds parsing information for a javascript package.json file.
func ToStruct ¶
func ToStruct(m *pb.JavascriptPackageJSONMetadata) *JavascriptPackageJSONMetadata
ToStruct converts the JavascriptPackageJSONMetadata proto to a Metadata struct.
func (*JavascriptPackageJSONMetadata) SetProto ¶
func (m *JavascriptPackageJSONMetadata) SetProto(p *pb.Package)
SetProto sets the JavascriptMetadata field in the Package proto.
type NPMPackageSource ¶ added in v0.3.6
type NPMPackageSource string
NPMPackageSource is the source of the NPM package.
const ( // Unknown is when the source of the NPM package is unknown because the lockfile was not found. Unknown NPMPackageSource = "UNKNOWN" // PublicRegistry is the public NPM registry. PublicRegistry NPMPackageSource = "PUBLIC_REGISTRY" // Other is any other remote or private source (e.g. Github). // This is used for packages that are not found in the public NPM registry. Other NPMPackageSource = "OTHER" // Local is the local filesystem that stores the package versions. // This is used for when the package is locally-developed or -installed. Local NPMPackageSource = "LOCAL" )
func (NPMPackageSource) ToProto ¶ added in v0.3.6
func (source NPMPackageSource) ToProto() pb.PackageSource
ToProto converts the NPMPackageSource to the proto enum.
type Person ¶
type Person struct {
Name string `json:"name"`
Email string `json:"email"`
URL string `json:"url"`
}
Person represents a person field in a javascript package.json file.
func PersonFromString ¶
PersonFromString parses a string of the form "name <email> (url)" into a Person struct.
func (*Person) PersonString ¶
PersonString produces a string format of Person struct in the format of "name <email> (url)"
func (*Person) UnmarshalJSON ¶
UnmarshalJSON parses a JSON object or string into a Person struct.