Expand description
Executable packager, bundler and updater. A cli tool and library to generate installers or app bundles for your executables. It also comes with useful addons:
- an updater
- a resource resolver
§Supported packages
- macOS
- DMG (.dmg)
- Bundle (.app)
- Linux
- Debian package (.deb)
- AppImage (.AppImage)
- Pacman (.tar.gz and PKGBUILD)
- Windows
- NSIS (.exe)
- MSI using WiX Toolset (.msi)
§CLI
This crate is a cargo subcommand so you can install using:
cargo install cargo-packager --lockedYou then need to configure your app so the cli can recognize it. Configuration can be done in Packager.toml or packager.json in your project or modify Cargo.toml and include this snippet:
[package.metadata.packager]
before-packaging-command = "cargo build --release"Once, you are done configuring your app, run:
cargo packager --release§Configuration
By default, the packager reads its configuration from Packager.toml or packager.json if it exists, and from package.metadata.packager table in Cargo.toml.
You can also specify a custom configuration using the -c/--config cli argument.
For a full list of configuration options, see Config.
You could also use the schema file from GitHub to validate your configuration or have auto completions in your IDE.
§Building your application before packaging
By default, the packager doesn’t build your application, so if your app requires a compilation step, the packager has an option to specify a shell command to be executed before packaing your app, beforePackagingCommand.
§Cargo profiles
By default, the packager looks for binaries built using the debug profile, if your beforePackagingCommand builds your app using cargo build --release, you will also need to
run the packager in release mode cargo packager --release, otherwise, if you have a custom cargo profile, you will need to specify it using --profile cli arg cargo packager --profile custom-release-profile.
§Library
This crate is also published to crates.io as a library that you can integrate into your tooling, just make sure to disable the default-feature flags.
cargo add cargo-packager --no-default-features§Feature flags
cli: Enables the cli specifc features and dependencies. Enabled by default.tracing: Enablestracingcrate integration.
Re-exports§
pub use config::Config;pub use sign::SigningConfig;
Modules§
- cli
cli - The cli entry point
- config
- Configuration type and associated utilities.
- sign
- File singing and signing keys creation and decoding.
Structs§
- Package
Output - Generated Package metadata.
Enums§
- Error
- Errors returned by cargo-packager.
- Package
Format - Types of supported packages by
cargo-packager.
Functions§
- init_
tracing_ subscriber cli - Inits the tracing subscriber.
- package
- Package an app using the specified config.
- package_
and_ sign - Package an app using the specified config. Then signs the generated packages.
- sign_
outputs - Sign the specified packages and return the signatures paths.
Type Aliases§
- Result
- Convenient type alias of Result type for cargo-packager.
