-
Notifications
You must be signed in to change notification settings - Fork 48
/
service.go
42 lines (38 loc) · 1.26 KB
/
service.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package npm
import (
"github.com/alin-io/pkgstore/services"
"github.com/alin-io/pkgstore/storage"
)
type Service struct {
services.BasePackageService
}
type PackageMetadata struct {
Id string `json:"_id"`
Description string `json:"description"`
Readme string `json:"readme"`
Name string `json:"name"`
Version string `json:"version"`
NodeVersion string `json:"_nodeVersion"`
NpmVersion string `json:"_npmVersion"`
Author map[string]string `json:"author"`
Dist struct {
Integrity string `json:"integrity"`
Shasum string `json:"shasum"`
Tarball string `json:"tarball"`
} `json:"dist"`
PublishConfig map[string]string `json:"publishConfig"`
Scripts map[string]string `json:"scripts"`
Keywords []string `json:"keywords"`
License string `json:"license"`
Main string `json:"main"`
}
func NewService(storage storage.BaseStorageBackend) *Service {
return &Service{
BasePackageService: services.BasePackageService{
Prefix: "npm",
Storage: storage,
PublicRegistryPathPrefix: "/",
PublicRegistryUrl: "https://registry.npmjs.org",
},
}
}