-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmagefile.go
51 lines (42 loc) · 995 Bytes
/
magefile.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//go:build mage
// This is a magefile, and is a "makefile for go".
// See https://magefile.org/
package main
import (
"get.porter.sh/magefiles/git"
"github.com/carolynvs/magex/mgx"
"github.com/carolynvs/magex/pkg"
"github.com/carolynvs/magex/shx"
"github.com/magefile/mage/mg"
"github.com/magefile/mage/target"
)
var must = shx.CommandBuilder{StopOnError: true}
func ensureVSCE() {
ok, err := pkg.IsCommandAvailable("vsce", "--version", "")
mgx.Must(err)
if !ok {
must.RunV("npm", "install", "-g", "vsce")
}
}
func npmInstall() {
needsNpmInstall, err := target.Dir("node_modules", "package.json")
mgx.Must(err)
if needsNpmInstall {
must.RunV("npm", "install")
}
}
func Compile() error {
mg.Deps(npmInstall)
return must.RunV("npm", "run", "compile")
}
func Test() error {
mg.Deps(npmInstall)
return must.RunV("npm", "run", "test")
}
func Package() error {
mg.Deps(ensureVSCE)
return must.RunV("vsce", "package")
}
func SetupDCO() error {
return git.SetupDCO()
}