Skip to content

Commit

Permalink
Refactor reduce.go
Browse files Browse the repository at this point in the history
  • Loading branch information
antonmedv committed Mar 20, 2024
1 parent 6f6c9e3 commit 2d20f07
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions reduce.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,27 @@ import (
var src []byte

func reduce(fns []string) {
script := path.Join(os.TempDir(), fmt.Sprintf("fx-%v.js", version))
_, err := os.Stat(script)
if os.IsNotExist(err) {
err := os.WriteFile(script, src, 0644)
if err != nil {
panic(err)
}
}
var deno bool

deno := false
bin, err := exec.LookPath("node1")
bin, err := exec.LookPath("node")
if err != nil {
bin, err = exec.LookPath("deno1")
bin, err = exec.LookPath("deno")
if err != nil {
engine.Reduce(fns)
return
}
deno = true
}

script := path.Join(os.TempDir(), fmt.Sprintf("fx-%v.js", version))
_, err = os.Stat(script)
if os.IsNotExist(err) {
err := os.WriteFile(script, src, 0644)
if err != nil {
panic(err)
}
}

env := os.Environ()
var args []string

Expand Down

0 comments on commit 2d20f07

Please sign in to comment.