Deno 打包程序命令行

使用Deno做了一个项目,需要将它打包方便分发,那么就需要了解打包方面的知识

看完官方文档,不得不说支持面挺全
Deno supports cross compiling to all targets regardless of the host platform.

OS Architecture Target
Windows x86_64 x86_64-pc-windows-msvc
macOS x86_64 x86_64-apple-darwin
macOS ARM64 aarch64-apple-darwin
Linux x86_64 x86_64-unknown-linux-gnu
Linux ARM64 aarch64-unknown-linux-gnu

下面是我用到的命令

Windows

deno compile --target x86_64-pc-windows-msvc --allow-net --allow-env --allow-read --unstable-kv --unstable-broadcast-channel --no-check --output QBin --icon static\img\apple-icon-152.png index.ts

Linux

deno compile --allow-net --allow-env --allow-read --unstable-kv --unstable-broadcast-channel --no-check --output QBin index.ts

MacOS (Intel)

deno compile --target x86_64-apple-darwin --allow-net --allow-env --allow-read --unstable-kv --unstable-broadcast-channel --no-check --output app_macos index.ts

MacOS (Apple Silicon)

deno compile --target aarch64-apple-darwin --allow-net --allow-env --allow-read --unstable-kv --unstable-broadcast-channel --no-check --output app_macos_arm64 index.ts

在windows平台使用--no-terminal会导致程序直接终止,也没有找到合适的最小化托盘方法,等官方完善

文档链接:https://docs.deno.com/runtime/reference/cli/compile

posted @ 2025-04-15 18:33  Naihe\  阅读(49)  评论(0)    收藏  举报
// 音乐播放器