Documentation ¶
Overview ¶
Package gode runs a sandboxed node installation to run node code and install npm packages.
Index ¶
- Constants
- func DebugScript(script string) *exec.Cmd
- func InstallPackage(packages ...string) error
- func IsSetup() (bool, error)
- func NeedsUpdate() (bool, error)
- func RemovePackage(name string) error
- func RunScript(script string) *exec.Cmd
- func SetRootPath(root string)
- func Setup() error
- func UpdatePackage(name string) (string, error)
- func UpdatePackages() (string, 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.0.0"
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 InstallPackage ¶
InstallPackage installs an npm package.
func NeedsUpdate ¶
NeedsUpdate returns true if it is using a node that isn't the latest version
func RunScript ¶
RunScript runs a given script in node Returns an *os/exec.Cmd instance
Example ¶
SetRootPath("tmp") err := Setup() if err != nil { panic(err) } output, err := RunScript(`console.log("hello world!")`).CombinedOutput() if err != nil { panic(err) } fmt.Println(string(output))
Output: hello world!
func UpdatePackage ¶
UpdatePackage updates a package.
Types ¶
Click to show internal directories.
Click to hide internal directories.