Skip to content

Commit

Permalink
refactor(cli): add --no-bundle flag, skip bundling on invalid forma…
Browse files Browse the repository at this point in the history
…ts (#8990)

* refactor(cli): add `--no-bundle` flag, skip bundling on invalid formats

* enhance bundle format parsing

* lint [skip ci]

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
  • Loading branch information
amrbashir and lucasfernog committed Feb 29, 2024
1 parent 4f78941 commit c68218b
Show file tree
Hide file tree
Showing 9 changed files with 254 additions and 196 deletions.
6 changes: 6 additions & 0 deletions .changes/cli-build-no-bundle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'tauri-cli': 'patch:enhance'
'@tauri-apps/cli': 'patch:enhance'
---

Add `--no-bundle` flag for `tauri build` command to skip bundling. Previously `none` was used to skip bundling, it will now be treated as invalid format and a warning will be emitted instead.
5 changes: 5 additions & 0 deletions .changes/utils-bundle-target-all.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'tauri-utils': 'patch:bug'
---

Fix `BundleTarget::to_vec` returning an empty vec for `BundleTarget::All` variant.
5 changes: 5 additions & 0 deletions .changes/utils-bundle-type-all.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'tauri-utils': 'patch:bug'
---

Add `BundleType::all` method to return all possible `BundleType` variants.
18 changes: 17 additions & 1 deletion core/tauri-utils/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,22 @@ pub enum BundleType {
Updater,
}

impl BundleType {
/// All bundle types.
fn all() -> &'static [Self] {
&[
BundleType::Deb,
BundleType::Rpm,
BundleType::AppImage,
BundleType::Msi,
BundleType::Nsis,
BundleType::App,
BundleType::Dmg,
BundleType::Updater,
]
}
}

impl Display for BundleType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
Expand Down Expand Up @@ -274,7 +290,7 @@ impl BundleTarget {
#[allow(dead_code)]
pub fn to_vec(&self) -> Vec<BundleType> {
match self {
Self::All => vec![],
Self::All => BundleType::all().to_vec(),
Self::List(list) => list.clone(),
Self::One(i) => vec![i.clone()],
}
Expand Down
16 changes: 8 additions & 8 deletions examples/api/src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c68218b

Please sign in to comment.