Documentation ¶
Index ¶
- func CalculateDependenciesList(executablePath, srcPath, moduleId string, npmArgs []string, log utils.Log) (dependenciesList []entities.Dependency, err error)
- func CalculateDependenciesMap(executablePath, srcPath, moduleId string, npmArgs []string, log utils.Log) (map[string]*dependencyInfo, error)
- func GetNpmConfigCache(srcPath, executablePath string, npmArgs []string, log utils.Log) (string, error)
- func GetNpmVersion(executablePath string, log utils.Log) (*version.Version, error)
- func GetNpmVersionAndExecPath(log utils.Log) (*version.Version, string, error)
- func NewNpmCacache(cachePath string) *cacache
- func RunNpmCmd(executablePath, srcPath string, npmCmd NpmCmd, npmArgs []string, log utils.Log) (stdResult, errResult []byte, err error)
- func TraverseDependencies(dependenciesMap map[string]*entities.Dependency, ...) (dependenciesList []entities.Dependency, err error)
- type NpmCmd
- type PackageInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateDependenciesList ¶
func CalculateDependenciesList(executablePath, srcPath, moduleId string, npmArgs []string, log utils.Log) (dependenciesList []entities.Dependency, err error)
CalculateDependenciesList gets an npm project's dependencies.
func CalculateDependenciesMap ¶
func CalculateDependenciesMap(executablePath, srcPath, moduleId string, npmArgs []string, log utils.Log) (map[string]*dependencyInfo, error)
Run 'npm list ...' command and parse the returned result to create a dependencies map of. The dependencies map looks like name:version -> entities.Dependency
func GetNpmConfigCache ¶
func GetNpmConfigCache(srcPath, executablePath string, npmArgs []string, log utils.Log) (string, error)
Return the npm cache path. Default: Windows: %LocalAppData%\npm-cache, Posix: ~/.npm
func GetNpmVersion ¶
func NewNpmCacache ¶
func NewNpmCacache(cachePath string) *cacache
func TraverseDependencies ¶
func TraverseDependencies(dependenciesMap map[string]*entities.Dependency, traverseDependenciesFunc func(dependency *entities.Dependency) (bool, error), threads int) (dependenciesList []entities.Dependency, err error)
Executes traverseDependenciesFunc on all dependencies in dependenciesMap. Each dependency that gets true in return, is added to dependenciesList.
Types ¶
type PackageInfo ¶
type PackageInfo struct { Name string `json:"name,omitempty"` Version string `json:"version,omitempty"` Scope string }
func ReadPackageInfo ¶
func ReadPackageInfo(data []byte, npmVersion *version.Version) (*PackageInfo, error)
func ReadPackageInfoFromPackageJson ¶
func ReadPackageInfoFromPackageJson(packageJsonDirectory string, npmVersion *version.Version) (*PackageInfo, error)
func (*PackageInfo) BuildInfoModuleId ¶
func (pi *PackageInfo) BuildInfoModuleId() string
func (*PackageInfo) FullName ¶
func (pi *PackageInfo) FullName() string
func (*PackageInfo) GetDeployPath ¶
func (pi *PackageInfo) GetDeployPath() string
Click to show internal directories.
Click to hide internal directories.