rsms / estrella

Lightweight and versatile build tool based on the esbuild compiler

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Only execute "run" command after onEnd is done

Utsav2 opened this issue · comments

Currently, estrella runs the "run" command before "onEnd" is complete. Sometimes, onEnd can perform actions like moving directories which is useful to execute before the run command is executed. Perhaps this behavior could be configurable.

Oh, good idea

$ ./build.js
Wrote out/main.js (390B, 7.43ms)
user onEnd begin
user onEnd done
Hello from a running program /Users/rsms/src/estrella/examples/run/out/main.js
env["ESTRELLA_PATH"] = /Users/rsms/src/estrella/dist/estrella.js
env["ESTRELLA_VERSION"] = 1.4.0
Hello...
Hello on stderr
...world!

// The following demonstrates that the onEnd function is run before the
// program or command is executed. This allows you to do things like move
// files around before running a program.
async onEnd() {
console.log("user onEnd begin")
await new Promise(r => setTimeout(r, 200))
console.log("user onEnd done")
},

Shipped in v1.4.1

Thank you!