common

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

nvm-common has common methods for use in both nvm and nvm-shim

Index

Constants

View Source
const CONFIG_NAME = "config.json"

config filename

View Source
const CONFIG_PERM = 0644

config file permissions

View Source
const NVM_DIR string = ".nevermind"

user-relative path to app directory

View Source
const NVM_SHIM = "nvm-shim"

basename of binary in NVM_DIR

Variables

View Source
var DEBUG = os.Getenv("DEBUG")

Enables debugger with DEBUG=1

If you want node logs too, set DEBUG=*

Functions

func CreateSymlinks(version Version) (err error)

create symlinks of bins

func Debugger

func Debugger()

sets up logger if DEBUG=1

logging is disabled by default, but you could also pass DEBUG=0 if that's something you think you need to do

func GetConfig

func GetConfig() (cfg config, err error)

func GetNVMDir

func GetNVMDir(path ...string) (string, error)

get a path relative to common.NVM_DIR returns directory string, and error

func GetNodeBin

func GetNodeBin(version Version, bin string) (string, error)

bin should likely be "node", "npm", "npx"; or any other node bin installed globally (e.g. yarn, typescript) returns directory string, and error

func SetConfig

func SetConfig(cfg config) error

Types

type Version

type Version string

a semver string without the leading "v" returned by common.GetVersion

func GetVersion

func GetVersion(v string) (Version, error)

case-insensitive, leading v, major.minor.patch

func (Version) IsSpecific added in v0.1.5

func (v Version) IsSpecific() bool

has all major.minor.patch

func (Version) Major added in v0.1.6

func (v Version) Major() int

func (Version) Minor added in v0.1.6

func (v Version) Minor() int

func (Version) Patch added in v0.1.6

func (v Version) Patch() int

type VersionError added in v0.1.6

type VersionError struct {
	// contains filtered or unexported fields
}

func (VersionError) Error added in v0.1.6

func (ve VersionError) Error() string

Jump to

Keyboard shortcuts

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