dsherret / dax

Cross-platform shell tools for Deno and Node.js inspired by zx.
MIT License
965 stars 33 forks source link

`deno compile` into executable with `dax` #275

Open dolbyzerr opened 3 weeks ago

dolbyzerr commented 3 weeks ago

I am trying to use dax to build an internal cli.

Minimal example is

import $ from "@david/dax"

const output = await $`echo "hello world"`.text() 
console.log(output)
deno compile --allow-all dax_test.ts && ./dax_test

It compiles just fine but when I try to execute ./dax_test it just hangs without any error.

Is it something that I am doing wrong?

dolbyzerr commented 1 week ago

Interestingly enough it's working with deno bundle -> deno compile

deno bundle main.ts
deno compile --allow-env --allow-read --allow-write --allow-net --output bin/main-bundled main.js
./bin/main-bundled # hello world

I've created a simple repo to demonstrate https://github.com/dolbyzerr/deno-dax-compile-test

I suspect that it's related to wasm module but not really sure.

NfNitLoop commented 3 days ago

FWIW, this is working for me:

> deno --version
deno 1.44.2 (release, aarch64-apple-darwin)
v8 12.6.228.9
typescript 5.4.5
> bin/main-bundled
hello world
> bin/main
hello world