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

31 lines
581 B
Go

package godependabotcore
import (
"errors"
"io/fs"
"sirherobrine23.org/Sirherobrine23/go-dependabot-core/dependabot"
"sirherobrine23.org/Sirherobrine23/go-dependabot-core/npm"
)
var (
ErrInvalidPackageEco error = errors.New("invalid package ecossystem")
)
type Updater interface {
// Check update avaible
Check() bool
// Run updates and return diff
Update() error
}
func GetUpdater(reg dependabot.Registry, rootDir fs.FS) (Updater, error) {
switch reg.Package {
case "npm":
return &npm.NPM{
RootFolder: rootDir,
}, nil
}
return nil, ErrInvalidPackageEco
}