Documentation
¶
Overview ¶
Package gode runs a sandboxed node installation to run node code and install npm packages.
Index ¶
- Constants
- func ClearCache() error
- func DebugScript(script string) *exec.Cmd
- func InstallPackages(packages ...string) error
- func IsSetup() (bool, error)
- func NeedsUpdate() (bool, error)
- func OutdatedPackages(names ...string) (map[string]string, error)
- func RemovePackages(packages ...string) error
- func RunScript(script string) *exec.Cmd
- func SetRootPath(root string)
- func Setup() error
- type Package
- type Target
Examples ¶
Constants ¶
View Source
const NpmVersion = "3.3.10"
NpmVersion is the requested npm version
View Source
const Version = "5.7.1"
Version is the requested node version
Variables ¶
This section is empty.
Functions ¶
func DebugScript ¶
DebugScript is the same as RunScript except it launches with node-inspector
func InstallPackages ¶
InstallPackages installs a npm packages.
func NeedsUpdate ¶
NeedsUpdate returns true if it is using a node that isn't the latest version
func OutdatedPackages ¶
OutdatedPackages returns a map of packages and their latest version
func RemovePackages ¶
RemovePackages removes a npm packages.
func RunScript ¶
RunScript runs a given script in node Returns an *os/exec.Cmd instance
Example ¶
SetRootPath(os.TempDir()) err := Setup() if err != nil { panic(err) } cmd := RunScript(`console.log("hello world!")`) output, err := cmd.CombinedOutput() if err != nil { panic(err) } fmt.Println(string(output))
Output: hello world!
Types ¶
Click to show internal directories.
Click to hide internal directories.