|
| 1 | +# `snforge` 0.47.0 Migration Guide |
| 2 | + |
| 3 | +Starting from version 0.47.0, `snforge` will by default support Scarb versions 2.12 or newer. |
| 4 | +This is due to the migration to the Scarb V2 version of procedural macros, which are used to handle arguments like `#[test]` |
| 5 | +in `snforge`. |
| 6 | +Thanks to this migration, tools like the Cairo plugin for VSCode will start showing better, more descriptive |
| 7 | +errors. |
| 8 | + |
| 9 | +To continue using `snforge` you will need to perform different actions depending on your Scarb version. |
| 10 | + |
| 11 | +## Scarb Versions >= 2.12.0 |
| 12 | + |
| 13 | +For Scarb versions >= 2.12.0, we recommend upgrading your `snforge_std` dependency to the one matching your `snforge` |
| 14 | +installation (0.47.0 at the time of writing of this doc). |
| 15 | + |
| 16 | +In your `Scarb.toml` file, update the dependency. |
| 17 | + |
| 18 | +```toml |
| 19 | +[dev-dependencies] |
| 20 | +snforge_std = "0.47.0" |
| 21 | +``` |
| 22 | + |
| 23 | +No further action is required. |
| 24 | + |
| 25 | +## Scarb Versions < 2.12.0 |
| 26 | + |
| 27 | +> 📝 **Note** |
| 28 | +> |
| 29 | +> We recommend upgrading to at least Scarb 2.12.0, as steps outlined below will stop being supported soon. |
| 30 | +
|
| 31 | +For Scarb versions < 2.12.0 it is still possible to continue using the latest `snforge`. |
| 32 | +We now publish a new package `snforge_std_compatibility`, supporting versions < 2.12.0. |
| 33 | + |
| 34 | +> 📝 **Note** |
| 35 | +> |
| 36 | +> `snforge_std_compatibility` may not provide full functionality in comparison to `snforge_std`. |
| 37 | +
|
| 38 | +First, in your `Scarb.toml`, remove the `snforge_std` dependency and add `snforge_std_compatibility`. |
| 39 | + |
| 40 | +```diff |
| 41 | +[dev-dependencies] |
| 42 | +- snforge_std = "0.46.0" |
| 43 | ++ snforge_std_compatibility = "0.47.0" |
| 44 | +``` |
| 45 | + |
| 46 | +Next, replace all kinds of imports in your code from `snforge_std` to `snforge_std_compatibility` |
| 47 | + |
| 48 | +```diff |
| 49 | +// Replace use statements |
| 50 | +- use snforge_std::{ContractClassTrait, start_cheat_caller_address}; |
| 51 | ++ use snforge_std_compatibility::{ContractClassTrait, start_cheat_caller_address}; |
| 52 | + |
| 53 | +// Replace full path usages |
| 54 | +- let result = snforge_std::declare("MyContract").unwrap(); |
| 55 | ++ let result = snforge_std_compatibility::declare("MyContract").unwrap(); |
| 56 | +``` |
0 commit comments