From 292565b6474761129a5099b299ab93f897a563c3 Mon Sep 17 00:00:00 2001 From: daimond113 Date: Sun, 9 Mar 2025 16:16:44 +0100 Subject: [PATCH] feat: add @generated to lockfiles Adds the @generated marker to lockfiles to make them easily recognizable as auto-generated. --- CHANGELOG.md | 1 + src/lib.rs | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9021a04..109a84b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Binary linkers are now done in Rust to simplify their implementation and cross-runtime portability by @daimond113 - Show available targets in add and install commands if the specifier hasn't matched any by @daimond113 +- Add [@generated](https://generated.at/) marker to lockfiles by @daimond113 ## [0.6.0] - 2025-02-22 ### Added diff --git a/src/lib.rs b/src/lib.rs index 8c8ae08..c34b708 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -251,8 +251,14 @@ impl Project { &self, lockfile: &Lockfile, ) -> Result<(), errors::LockfileWriteError> { - let string = toml::to_string(lockfile)?; - fs::write(self.package_dir().join(LOCKFILE_FILE_NAME), string).await?; + let lockfile = toml::to_string(lockfile)?; + let lockfile = format!( + r"# This file is automatically @generated by pesde. +# It is not intended for manual editing. +{lockfile}" + ); + + fs::write(self.package_dir().join(LOCKFILE_FILE_NAME), lockfile).await?; Ok(()) }