2020-12-05 17:10:10 +01:00
|
|
|
## Compiling Executables
|
|
|
|
|
2021-01-04 23:15:52 +00:00
|
|
|
`deno compile [--output <OUT>] <SRC>` will compile the script into a
|
|
|
|
self-contained executable.
|
2020-12-05 17:10:10 +01:00
|
|
|
|
|
|
|
```
|
2021-04-27 12:44:36 +02:00
|
|
|
> deno compile https://deno.land/std/examples/welcome.ts
|
2020-12-05 17:10:10 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
If you omit the `OUT` parameter, the name of the executable file will be
|
|
|
|
inferred.
|
|
|
|
|
2021-01-04 23:15:52 +00: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 12:44:36 +02:00
|
|
|
> deno compile --allow-read --allow-net https://deno.land/std/http/file_server.ts
|
2021-01-04 23:15:52 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
[Script arguments](../getting_started/command_line_interface.md#script-arguments)
|
|
|
|
can be partially embedded.
|
|
|
|
|
|
|
|
```
|
2021-04-27 12:44:36 +02:00
|
|
|
> deno compile --allow-read --allow-net https://deno.land/std/http/file_server.ts -p 8080
|
2021-01-04 23:15:52 +00:00
|
|
|
> ./file_server --help
|
|
|
|
```
|
|
|
|
|
2020-12-05 17:10:10 +01:00
|
|
|
### Cross Compilation
|
|
|
|
|
2021-04-28 09:03:27 -07: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.
|