Module Build

Module Build 

Source
Expand description

§Dynamic Build Orchestrator

This binary serves as a powerful, configurable pre-build step for a Tauri application. It is designed to be called from a shell script and dynamically modifies project configuration files (Cargo.toml, tauri.conf.json) based on environment variables and command-line arguments.

Its primary responsibilities include:

  • Generating a unique productName and identifier for different build “flavours” (e.g., for different dependencies, environments, or feature sets).

  • Dynamically selecting a sidecar binary (like a specific Node.js version),

    staging it in a temporary location, and configuring Tauri to bundle it.

  • Temporarily modifying configuration files, executing the final build command (e.g., pnpm tauri build), and then restoring the original files using a Guard pattern.

Structs§

Argument
Represents parsed command-line arguments and environment variables that control the build.
Guard
Manages the backup and restoration of a single file using the RAII pattern. Ensures that an original file is restored to its initial state when this struct goes out of scope.
Manifest
Represents the package section of a Cargo.toml manifest.
Meta
Represents metadata within the package section of Cargo.toml.

Enums§

Error
Represents all possible errors that can occur during the build script’s execution.

Constants§

BackupSuffix
Suffix used for backup files created by the Guard.
BrowserEnv
Environment variable for the “Browser” build flag.
BundleEnv
Environment variable for the “Bundle” build flag.
CargoFile
Cargo configuration filename.
CleanEnv
Environment variable for the “Clean” build flag.
CompileEnv
Environment variable for the “Compile” build flag.
DependencyEnv
Environment variable for specifying a dependency flavour.
DirEnv
Environment variable for the project directory.
DirectoryDefault
Default project directory relative to the workspace root.
IdDelimiter
Delimiter for parts of the generated bundle identifier.
JsonFile
Tauri JSON configuration filename.
JsonfiveFile
Tauri JSON5 configuration filename.
LogEnv
Environment variable for setting the log level.
NameDefault
Default project base name, used as a suffix for generated names.
NameDelimiter
Delimiter for parts of the generated productName.
NameEnv
Environment variable for the original base name of the project.
NodeEnv
Environment variable for the Node.js environment (development or production).
NodeVersionEnv
Environment variable for selecting the Node.js sidecar version.
PrefixDefault
Default bundle identifier prefix.
PrefixEnv
Environment variable for the bundle identifier prefix.

Functions§

Fn
The main entry point of the binary.
JsonEdit
Dynamically modifies fields in a tauri.conf.json or tauri.conf.json5 file, including the sidecar path.
Logger
Sets up the global logger for the application.
Pascalize
Converts a kebab-case or snake_case string to PascalCase.
Process
Main orchestration logic for preparing and executing the build.
TomlEdit
Dynamically modifies specific name fields within a Cargo.toml file. This includes package.name, package.default-run, and bin.name.
VerifyEnv
Verifies if all required environment variables are set.