-
Notifications
You must be signed in to change notification settings - Fork 0
/
main_retro.go
61 lines (49 loc) · 1.12 KB
/
main_retro.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
52
53
54
55
56
57
58
59
60
61
package main
import (
_ "embed"
"encoding/json"
"os"
"strings"
"github.com/zaydek/retro/go/cmd/retro"
)
var (
//go:embed package.json
pkg string
//go:embed version.txt
RETRO_V_VERSION string // v0.0.0
//go:embed version.txt
RETRO_VERSION string // ^0.0.0
)
func must(err error) {
if err == nil {
return
}
panic(err)
}
func init() {
RETRO_V_VERSION = strings.TrimRight(RETRO_VERSION, "\n")
RETRO_VERSION = strings.Replace(strings.TrimRight(RETRO_VERSION, "\n"), "v", "^", 1)
}
func main() {
var deps struct {
DevDependencies struct {
Esbuild string `json:"esbuild"`
React string `json:"react"`
ReactDOM string `json:"react-dom"`
Retro string
} `json:"devDependencies"`
}
err := json.Unmarshal([]byte(pkg), &deps)
must(err)
err = os.Setenv("ESBUILD_VERSION", deps.DevDependencies.Esbuild)
must(err)
err = os.Setenv("REACT_VERSION", deps.DevDependencies.React)
must(err)
err = os.Setenv("REACTDOM_VERSION", deps.DevDependencies.ReactDOM)
must(err)
err = os.Setenv("RETRO_V_VERSION", RETRO_V_VERSION)
must(err)
err = os.Setenv("RETRO_VERSION", RETRO_VERSION)
must(err)
retro.Run()
}