Skip to content

Commit

Permalink
Merge branch 'master' into build-examples
Browse files Browse the repository at this point in the history
  • Loading branch information
pragmatrix committed Mar 9, 2023
2 parents 4e731f8 + b41a957 commit ee8b960
Show file tree
Hide file tree
Showing 15 changed files with 109 additions and 92 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-targets -- -D warnings
args: --all-targets

- name: Setup | Toolchain (rustfmt)
uses: actions-rs/toolchain@v1
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Subheadings to categorize changes are `added, changed, deprecated, removed, fixe
- Updated gloo-worker example to use gloo-worker crate v2.1.
- Our website (trunkrs.dev) now only updates on new releases.
- Additional attributes are now passed through script tags (fixes #429)
- Updated internal http stack to axum v0.6.0.
- Updated CLI argument parser to clap v0.4.
### fixed
- Nested WS proxies - if `backend=ws://localhost:8000/ws` is set, queries for `ws://localhost:8080/ws/entityX` will be linked with `ws://localhost:8000/ws/entityX`
- Updated all dependencies in both Trunk and its examples, to fix currently open security advisories for old dependencies.
Expand Down
54 changes: 32 additions & 22 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ panic = "abort"
[dependencies]
ansi_term = "0.12"
anyhow = "1"
axum = { version = "0.5", features = ["ws"] }
axum = { version = "0.6", features = ["ws"] }
bytes = "1"
cargo-lock = "8"
cargo_metadata = "0.15"
clap = { version = "3", features = ["derive", "env"] }
clap = { version = "4", features = ["derive", "env"] }
console = "0.15"
directories = "4"
dunce = "1"
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ use crate::config::{ConfigOpts, ConfigOptsBuild};

/// Build the Rust WASM app and all of its assets.
#[derive(Clone, Debug, Args)]
#[clap(name = "build")]
#[command(name = "build")]
pub struct Build {
#[clap(flatten)]
#[command(flatten)]
pub build: ConfigOptsBuild,
}

Expand Down
6 changes: 3 additions & 3 deletions src/cmd/clean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ use crate::tools::cache_dir;

/// Clean output artifacts.
#[derive(Args)]
#[clap(name = "clean")]
#[command(name = "clean")]
pub struct Clean {
#[clap(flatten)]
#[command(flatten)]
pub clean: ConfigOptsClean,
/// Optionally clean any cached tools used by Trunk
///
/// These tools are cached in a platform dependent "projects" dir. Removing them will cause
/// them to be downloaded by Trunk next time they are needed.
#[clap(short, long)]
#[arg(short, long)]
pub tools: bool,
}

Expand Down
4 changes: 2 additions & 2 deletions src/cmd/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ use crate::config::ConfigOpts;

/// Trunk config controls.
#[derive(Clone, Debug, Args)]
#[clap(name = "config")]
#[command(name = "config")]
pub struct Config {
#[clap(subcommand)]
#[command(subcommand)]
action: ConfigSubcommands,
}

Expand Down
8 changes: 4 additions & 4 deletions src/cmd/serve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ use crate::serve::ServeSystem;

/// Build, watch & serve the Rust WASM app and all of its assets.
#[derive(Args)]
#[clap(name = "serve")]
#[command(name = "serve")]
pub struct Serve {
#[clap(flatten)]
#[command(flatten)]
pub build: ConfigOptsBuild,
#[clap(flatten)]
#[command(flatten)]
pub watch: ConfigOptsWatch,
#[clap(flatten)]
#[command(flatten)]
pub serve: ConfigOptsServe,
}

Expand Down
6 changes: 3 additions & 3 deletions src/cmd/watch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ use crate::watch::WatchSystem;

/// Build & watch the Rust WASM app and all of its assets.
#[derive(Args)]
#[clap(name = "watch")]
#[command(name = "watch")]
pub struct Watch {
#[clap(flatten)]
#[command(flatten)]
pub build: ConfigOptsBuild,
#[clap(flatten)]
#[command(flatten)]
pub watch: ConfigOptsWatch,
}

Expand Down
5 changes: 3 additions & 2 deletions src/common.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//! Common functionality and types.

use std::convert::Infallible;
use std::ffi::OsStr;
use std::fmt::Debug;
use std::fs::Metadata;
Expand All @@ -22,10 +23,10 @@ static CWD: Lazy<PathBuf> =
Lazy::new(|| std::env::current_dir().expect("error getting current dir"));

/// Ensure the given value for `--public-url` is formatted correctly.
pub fn parse_public_url(val: &str) -> String {
pub fn parse_public_url(val: &str) -> Result<String, Infallible> {
let prefix = if !val.starts_with('/') { "/" } else { "" };
let suffix = if !val.ends_with('/') { "/" } else { "" };
format!("{}{}{}", prefix, val, suffix)
Ok(format!("{}{}{}", prefix, val, suffix))
}

/// A utility function to recursively copy a directory.
Expand Down
Loading

0 comments on commit ee8b960

Please sign in to comment.