2020-09-17 07:43:45 -07:00
|
|
|
package main
|
|
|
|
|
2020-10-01 11:57:02 -07:00
|
|
|
type node struct {
|
2020-09-17 07:43:45 -07:00
|
|
|
props *properties
|
|
|
|
env environmentInfo
|
|
|
|
nodeVersion string
|
|
|
|
}
|
|
|
|
|
2020-10-01 11:57:02 -07:00
|
|
|
func (n *node) string() string {
|
2020-09-17 07:43:45 -07:00
|
|
|
return n.nodeVersion
|
|
|
|
}
|
|
|
|
|
2020-10-01 11:57:02 -07:00
|
|
|
func (n *node) init(props *properties, env environmentInfo) {
|
2020-09-17 07:43:45 -07:00
|
|
|
n.props = props
|
|
|
|
n.env = env
|
|
|
|
}
|
|
|
|
|
2020-10-01 11:57:02 -07:00
|
|
|
func (n *node) enabled() bool {
|
|
|
|
if !n.env.hasFiles("*.js") && !n.env.hasFiles("*.ts") {
|
|
|
|
return false
|
|
|
|
}
|
2020-09-17 07:43:45 -07:00
|
|
|
if !n.env.hasCommand("node") {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
n.nodeVersion = n.env.runCommand("node", "--version")
|
|
|
|
return true
|
|
|
|
}
|