truongminh / gonpm

An npm cache proxy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gonpm

A modularized npm cache proxy written in Go

Development

  • Go version >= 1.10
  • Start server: cd cmd; PORT=8999 NPM_CACHE=mem go run .
  • Test npm install: cd cmd/test; sh install.sh

Use as a library

import "github.com/truongminh/gonpm"
import "github.com/truongminh/gonpm/storage"

func main() {
    port := 8080
    cacheURI := "fs:///tmp?limit=256GB"
    store, err := storage.Open(cacheURI)
    if err != nil {
        panic(err)
    }
    s := gonpm.NewProxy(port, store)
    err := s.Listen(ctx)
    if err != nil {
        panic(err)
    }
}

Deployment

make && make pushdev|pushstage|pushprod

About

An npm cache proxy


Languages

Language:Go 91.8%Language:Makefile 4.9%Language:Shell 1.8%Language:Dockerfile 1.4%Language:JavaScript 0.2%