2020-12-05 11:10:10 -05:00
|
|
|
## Compiling Executables
|
|
|
|
|
2021-01-04 18:15:52 -05:00
|
|
|
`deno compile [--output <OUT>] <SRC>` will compile the script into a
|
|
|
|
self-contained executable.
|
2020-12-05 11:10:10 -05:00
|
|
|
|
|
|
|
```
|
2021-04-27 06:44:36 -04:00
|
|
|
> deno compile https://deno.land/std/examples/welcome.ts
|
2020-12-05 11:10:10 -05:00
|
|
|
```
|
|
|
|
|
|
|
|
If you omit the `OUT` parameter, the name of the executable file will be
|
|
|
|
inferred.
|
|
|
|
|
2021-01-04 18:15:52 -05:00
|
|
|
### Flags
|
|
|
|
|
|
|
|
As with [`deno install`](./script_installer.md), the runtime flags used to
|
|
|
|
execute the script must be specified at compilation time. This includes
|
|
|
|
permission flags.
|
|
|
|
|
|
|
|
```
|
2021-04-27 06:44:36 -04:00
|
|
|
> deno compile --allow-read --allow-net https://deno.land/std/http/file_server.ts
|
2021-01-04 18:15:52 -05:00
|
|
|
```
|
|
|
|
|
|
|
|
[Script arguments](../getting_started/command_line_interface.md#script-arguments)
|
|
|
|
can be partially embedded.
|
|
|
|
|
|
|
|
```
|
2021-04-27 06:44:36 -04:00
|
|
|
> deno compile --allow-read --allow-net https://deno.land/std/http/file_server.ts -p 8080
|
2021-01-04 18:15:52 -05:00
|
|
|
> ./file_server --help
|
|
|
|
```
|
|
|
|
|
2020-12-05 11:10:10 -05:00
|
|
|
### Cross Compilation
|
|
|
|
|
2021-04-28 12:03:27 -04:00
|
|
|
You can compile binaries for other platforms by adding the `--target` CLI flag.
|
|
|
|
Deno currently supports compiling to Windows x64, macOS x64, macOS ARM and Linux
|
|
|
|
x64. Use `deno compile --help` to list the full values for each compilation
|
|
|
|
target.
|