Skip to content

Commit 25785c2

Browse files
authored
fix: use cot's version instead of cli's when creating a new project (#213)
cot and cot-cli crates' version do not necessarily have to be in sync (strictly speaking, cot-cli's version can be higher than cot's) so we need to make sure we put the latest cot crate version in user's Cargo.toml. Otherwise, build failures might happen because of invalid dependencies.
1 parent bd86a0e commit 25785c2

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

cot-cli/src/new_project.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ impl CotSource<'_> {
4545
path.display().to_string().replace('\\', "\\\\")
4646
)
4747
}
48-
CotSource::PublishedCrate => format!("version = \"{}\"", env!("CARGO_PKG_VERSION")),
48+
CotSource::PublishedCrate => format!("version = \"{}\"", cot::__private::COT_VERSION),
4949
}
5050
}
5151
}

cot/src/private.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,9 @@ pub use tokio;
1717
// used in the CLI
1818
#[cfg(feature = "db")]
1919
pub use crate::utils::graph::apply_permutation;
20+
21+
/// The version of the crate.
22+
///
23+
/// This is used in the CLI to specify the version of the crate to use in the
24+
/// `Cargo.toml` file when creating a new Cot project.
25+
pub const COT_VERSION: &str = env!("CARGO_PKG_VERSION");

0 commit comments

Comments
 (0)