npm

package
v0.0.0-...-452f874 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2019 License: MIT Imports: 18 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NPM_ARCHIVE = regexp.MustCompile(`http(s|):\/\/([\w\.]+)\/(.*)`)
)

Functions

func ConfigureApp

func ConfigureApp(config *pkgmirror.Config, l *goapp.Lifecycle)

func ConfigureHttp

func ConfigureHttp(name string, conf *pkgmirror.NpmConfig, app *goapp.App)

func NewArchivePat

func NewArchivePat(code string) goji.Pattern

Types

type FullPackageDefinition

type FullPackageDefinition struct {
	ID          string                               `json:"_id,omitempty"`
	Rev         string                               `json:"_rev,omitempty"`
	Name        string                               `json:"name,omitempty"`
	Description *json.RawMessage                     `json:"description,omitempty"`
	DistTags    *json.RawMessage                     `json:"dist-tags"`
	Versions    map[string]*PackageVersionDefinition `json:"versions,omitempty"`
	//Readme         *json.RawMessage                     `json:"readme,omitempty"`
	//Maintainers    *json.RawMessage                     `json:"maintainers,omitempty"`
	Time       *json.RawMessage `json:"time,omitempty"`
	Author     *json.RawMessage `json:"author,omitempty"`
	Repository *json.RawMessage `json:"repository,omitempty"`
	//Users          *json.RawMessage                     `json:"users,omitempty"`
	//ReadmeFilename *json.RawMessage                     `json:"readmeFilename,omitempty"`
	//Homepage       *json.RawMessage                     `json:"homepage,omitempty"`
	//Bugs           *json.RawMessage                     `json:"bugs,omitempty"`
	License     *json.RawMessage `json:"license,omitempty"`
	Attachments *json.RawMessage `json:"_attachments,omitempty"`
}

type NpmConfig

type NpmConfig struct {
	SourceServer    string
	PublicServer    string
	FallbackServers []string
	Path            string
	Code            []byte
}

type NpmService

type NpmService struct {
	DB        *bolt.DB
	Config    *NpmConfig
	Logger    *log.Entry
	GitConfig *git.GitConfig
	Vault     *vault.Vault

	StateChan     chan pkgmirror.State
	BoltCompacter *pkgmirror.BoltCompacter
	// contains filtered or unexported fields
}

func NewNpmService

func NewNpmService() *NpmService

func (*NpmService) Get

func (ns *NpmService) Get(key string) ([]byte, error)

func (*NpmService) Init

func (ns *NpmService) Init(app *goapp.App) (err error)

func (*NpmService) Serve

func (ns *NpmService) Serve(state *goapp.GoroutineState) error

func (*NpmService) SyncPackages

func (ns *NpmService) SyncPackages() error

func (*NpmService) UpdatePackage

func (ns *NpmService) UpdatePackage(key string) error

func (*NpmService) WriteArchive

func (ns *NpmService) WriteArchive(w io.Writer, pkg, version string) error

type PackagePat

type PackagePat struct {
	Pattern *regexp.Regexp
}

func (*PackagePat) Match

func (pp *PackagePat) Match(ctx context.Context, r *http.Request) context.Context

type PackageVersionDefinition

type PackageVersionDefinition struct {
	Name        string           `json:"name,omitempty"`
	Description *json.RawMessage `json:"description,omitempty"`
	Version     string           `json:"version,omitempty"`
	Homepage    *json.RawMessage `json:"homepage,omitempty"`
	Repository  *json.RawMessage `json:"repository,omitempty"`
	//Contributors         *json.RawMessage `json:"contributors,omitempty"`
	Main                 *json.RawMessage `json:"main,omitempty"`
	Licences             *json.RawMessage `json:"licenses,omitempty"`
	Author               *json.RawMessage `json:"author,omitempty"`
	Tags                 *json.RawMessage `json:"tags,omitempty"`
	Files                *json.RawMessage `json:"files,omitempty"`
	Bin                  *json.RawMessage `json:"bin,omitempty"`
	Man                  *json.RawMessage `json:"man,omitempty"`
	Dependencies         *json.RawMessage `json:"dependencies,omitempty"`
	DevDependencies      *json.RawMessage `json:"devDependencies,omitempty"`
	PeerDependencies     *json.RawMessage `json:"peerDependencies,omitempty"`
	OptionalDependencies *json.RawMessage `json:"optionalDependencies,omitempty"`
	EngineStrict         *json.RawMessage `json:"engineStrict,omitempty"`
	Scripts              *json.RawMessage `json:"scripts,omitempty"`
	Engines              *json.RawMessage `json:"engines,omitempty"`
	Gypfile              *json.RawMessage `json:"gypfile,omitempty"`
	License              *json.RawMessage `json:"license,omitempty"`
	GitHead              *json.RawMessage `json:"gitHead,omitempty"`
	//Bugs                 *json.RawMessage `json:"bugs,omitempty"`
	Binary             *json.RawMessage `json:"binary,omitempty"`
	Os                 *json.RawMessage `json:"os,omitempty"`
	Cpu                *json.RawMessage `json:"cpu,omitempty"`
	PreferGlobal       *json.RawMessage `json:"preferGlobal,omitempty"`
	PublishConfig      *json.RawMessage `json:"publishConfig,omitempty"`
	BundleDependencies *json.RawMessage `json:"bundleDependencies,omitempty"`
	Keywords           *json.RawMessage `json:"keywords,omitempty"`
	//ID                   *json.RawMessage `json:"_id,omitempty"`
	//Shasum               *json.RawMessage `json:"_shasum,omitempty"`
	//From                 *json.RawMessage `json:"_from,omitempty"`
	//NpmVersion           *json.RawMessage `json:"_npmVersion,omitempty"`
	//NodeVersion          *json.RawMessage `json:"_nodeVersion,omitempty"`
	//NpmUser              *json.RawMessage `json:"_npmUser,omitempty"`
	//Maintainers          *json.RawMessage `json:"maintainers,omitempty"`
	Dist struct {
		Shasum  string `json:"shasum,omitempty"`
		Tarball string `json:"tarball,omitempty"`
	} `json:"dist,omitempty"`
	//NpmOperationalInternal *json.RawMessage `json:"_npmOperationalInternal,omitempty"`
	Directories *json.RawMessage `json:"directories,omitempty"`
}

type ShortPackageDefinition

type ShortPackageDefinition struct {
	ID                string `json:"_id,omitempty"`
	Rev               string `json:"_rev,omitempty"`
	Name              string `json:"name,omitempty"`
	ReleasesAvailable int    `json:"releases_available,omitempty"`
}

Jump to

Keyboard shortcuts

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