@@ -10,6 +10,32 @@ function updateCargoVersion(filePath: string, version: string): void {
1010 fs . writeFileSync ( filePath , content ) ;
1111}
1212
13+ const IGNORED_DIRS = new Set ( [ "node_modules" , "target" , ".git" , "dist" ] ) ;
14+
15+ function findCargoTomls ( dir : string , results : string [ ] = [ ] ) : string [ ] {
16+ for ( const entry of fs . readdirSync ( dir , { withFileTypes : true } ) ) {
17+ if ( entry . isDirectory ( ) ) {
18+ if ( ! IGNORED_DIRS . has ( entry . name ) ) {
19+ findCargoTomls ( `${ dir } /${ entry . name } ` , results ) ;
20+ }
21+ continue ;
22+ }
23+ if ( entry . name === "Cargo.toml" ) {
24+ results . push ( `${ dir } /${ entry . name } ` ) ;
25+ }
26+ }
27+ return results ;
28+ }
29+
30+ function updateAllCargoVersions ( version : string ) : void {
31+ for ( const cargoToml of findCargoTomls ( "." ) ) {
32+ const content = fs . readFileSync ( cargoToml , "utf-8" ) ;
33+ if ( / ^ v e r s i o n \s * = \s * " .* " / m. test ( content ) ) {
34+ updateCargoVersion ( cargoToml , version ) ;
35+ }
36+ }
37+ }
38+
1339function updateJsonVersion ( filePath : string , version : string ) : void {
1440 const json = JSON . parse ( fs . readFileSync ( filePath , "utf-8" ) ) ;
1541 json . version = version ;
@@ -47,15 +73,14 @@ function createGitTag(tag: string): void {
4773}
4874
4975function updateAllVersions ( version : string , skipLockfiles = false ) : void {
50- // Update library versions
51- console . log ( "Updating library versions..." ) ;
52- updateCargoVersion ( "./libs/core/Cargo.toml" , version ) ;
76+ // Update all crate versions (workspace root + every member Cargo.toml)
77+ console . log ( "Updating Cargo.toml versions..." ) ;
78+ updateAllCargoVersions ( version ) ;
5379 updateJsonVersion ( "./libs/core/deno.json" , version ) ;
54- console . log ( "✓ Library versions updated" ) ;
80+ console . log ( "✓ Cargo.toml versions updated" ) ;
5581
5682 // Update app versions
5783 console . log ( "Updating app versions..." ) ;
58- updateCargoVersion ( "./src/Cargo.toml" , version ) ;
5984 const packageJson = JSON . parse ( fs . readFileSync ( "./package.json" , "utf-8" ) ) ;
6085 packageJson . version = version ;
6186 fs . writeFileSync ( "./package.json" , JSON . stringify ( packageJson , null , 2 ) + "\n" ) ;
0 commit comments