go-dependabot-core/npm/npm.go
Matheus Sampaio Queiroga b9ed0828a0
init structs
Signed-off-by: Matheus Sampaio Queiroga <srherobrine20@gmail.com>
2024-07-12 19:55:30 -03:00

44 lines
839 B
Go

package npm
import (
"io/fs"
"os"
"github.com/vaughan0/go-ini"
)
type NPM struct {
RootFolder fs.FS
NpmRC ini.File
}
type Package struct {
Name string `json:"name"` // Package name
Dependencies map[string]string `json:"dependencies"`
DevDependencies map[string]string `json:"devDependencies"`
PeerDependencies map[string]string `json:"peerDependencies"`
OptionalDependencies map[string]string `json:"optionalDependencies"`
}
func (npm *NPM) Config() error {
file, err := npm.RootFolder.Open(".npmrc")
if err != nil {
if os.IsNotExist(err) {
return nil
}
return err
}
defer file.Close()
if npm.NpmRC, err = ini.Load(file); err != nil {
return err
}
return nil
}
func (npm *NPM) Check() bool {
return false
}
func (npm *NPM) Update() error {
return nil
}