Skip to content

Commit

Permalink
Bump version 0.14.0 (#1155)
Browse files Browse the repository at this point in the history
* Bump version 0.14.0
  • Loading branch information
kaplanelad authored Jan 9, 2025
1 parent f72a6bd commit abe016e
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ license = "Apache-2.0"

[package]
name = "loco-rs"
version = "0.13.2"
version = "0.14.0"
description = "The one-person framework for Rust"
homepage = "https://loco.rs/"
documentation = "https://docs.rs/loco-rs"
Expand Down Expand Up @@ -49,7 +49,7 @@ bg_sqlt = ["dep:sqlx", "dep:ulid"]
integration_test = []

[dependencies]
loco-gen = { version = "0.13.2", path = "./loco-gen" }
loco-gen = { version = "0.14.0", path = "./loco-gen" }
backtrace_printer = { version = "1.3.0" }

# cli
Expand Down
88 changes: 88 additions & 0 deletions docs-site/content/docs/extras/upgrades.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,91 @@ These are the major ones:
* [SeaORM](https://www.sea-ql.org/SeaORM), [CHANGELOG](https://github.com/SeaQL/sea-orm/blob/master/CHANGELOG.md)
* [Axum](https://github.com/tokio-rs/axum), [CHANGELOG](https://github.com/tokio-rs/axum/blob/main/axum/CHANGELOG.md)


## Upgrade from 0.13.x to 0.14.x

### Upgrading from Axum 0.7 to 0.8

PR: [#1130](https://github.com/loco-rs/loco/pull/1130)
The upgrade to Axum 0.8 introduces a breaking change. For more details, refer to the [announcement](https://tokio.rs/blog/2025-01-01-announcing-axum-0-8-0).
#### Steps to Upgrade
* In your `Cargo.toml`, update the Axum version from `0.7.5` to `0.8.1`.
* Replace use `axum::async_trait`; with use `async_trait::async_trait;`. For more information, see [here](https://tokio.rs/blog/2025-01-01-announcing-axum-0-8-0#async_trait-removal).
* The URL parameter syntax has changed. Refer to [this section](https://tokio.rs/blog/2025-01-01-announcing-axum-0-8-0#path-parameter-syntax-changes) for the updated syntax. The new path parameter format is:
The path parameter syntax has changed from `/:single` and `/*many` to `/{single}` and `/{*many}`.


### Extending the `boot` Function Hook
PR: [#1143](https://github.com/loco-rs/loco/pull/1143)

The `boot` hook function now accepts an additional Config parameter. The function signature has changed from:

From
```rust
async fn boot(mode: StartMode, environment: &Environment) -> Result<BootResult> {
create_app::<Self, Migrator>(mode, environment).await
}
```
To:
```rust
async fn boot(mode: StartMode, environment: &Environment, config: Config) -> Result<BootResult> {
create_app::<Self, Migrator>(mode, environment, config).await
}
```
Make sure to import the `Config` type as needed.

### Upgrade validator crate
PR: [#993](https://github.com/loco-rs/loco/pull/993)

Update the `validator` crate version in your `Cargo.toml`:

From
```
validator = { version = "0.18" }
```
To
```
validator = { version = "0.19" }
```

### Extend truncate and seed hooks
PR: [#1158](https://github.com/loco-rs/loco/pull/1158)

The `truncate` and `seed` functions now receive `AppContext` instead of `DatabaseConnection` as their argument.

From
```rust
async fn truncate(db: &DatabaseConnection) -> Result<()> {}
async fn seed(db: &DatabaseConnection, base: &Path) -> Result<()> {}
```
To
```rust
async fn truncate(ctx: &AppContext) -> Result<()> {}
async fn seed(_ctx: &AppContext, base: &Path) -> Result<()> {}
```

Impact on Testing:

Testing code involving the seed function must also be updated accordingly.

from:
```rust
async fn load_page() {
request::<App, _, _>(|request, ctx| async move {
seed::<App>(&ctx.db).await.unwrap();
...
})
.await;
}
```

to
```rust
async fn load_page() {
request::<App, _, _>(|request, ctx| async move {
seed::<App>(&ctx).await.unwrap();
...
})
.await;
}
```
2 changes: 1 addition & 1 deletion loco-gen/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "loco-gen"
version = "0.13.2"
version = "0.14.0"
description = "Loco generators"
license.workspace = true
edition.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion loco-new/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[package]
name = "loco"
version = "0.13.3"
version = "0.14.0"
edition = "2021"
description = "Loco new app generator"
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion loco-new/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub mod wizard;
pub type Result<T> = std::result::Result<T, Error>;

/// Matching minimal Loco version.
pub const LOCO_VERSION: &str = "0.13.2";
pub const LOCO_VERSION: &str = "0.14.0";

#[derive(thiserror::Error, Debug)]
pub enum Error {
Expand Down

0 comments on commit abe016e

Please sign in to comment.