1313 * to prevent `npm` from attempting to download unpublished packages.
1414 */
1515
16- const process = require ( 'process' ) ;
1716const path = require ( 'path' ) ;
1817const fs = require ( 'fs' ) ;
1918const os = require ( 'os' ) ;
@@ -24,27 +23,37 @@ const platform = os.platform();
2423
2524/* eslint-disable no-console */
2625async function main ( ) {
27-
28- console . error (
29- 'Updating the cargo.toml version to match new version' ,
30- ) ;
26+ console . error ( 'Updating the cargo.toml version to match new version' ) ;
3127 const projectRoot = path . join ( __dirname , '..' ) ;
3228 const cargoTOMLPath = path . join ( projectRoot , 'Cargo.toml' ) ;
3329 const cargoTOML = await fs . promises . readFile ( cargoTOMLPath , 'utf-8' ) ;
3430 const cargoTOMLMatch = cargoTOML . match ( / v e r s i o n \s * = \s * " ( .* ) " / ) ;
35- const cargoTOMLUpdated = cargoTOML . replace ( cargoTOMLMatch [ 0 ] , `version = "${ packageJSON . version } "` ) ;
31+ const cargoTOMLUpdated = cargoTOML . replace (
32+ cargoTOMLMatch [ 0 ] ,
33+ `version = "${ packageJSON . version } "` ,
34+ ) ;
3635 await fs . promises . writeFile ( cargoTOMLPath , cargoTOMLUpdated , 'utf-8' ) ;
3736
38- console . error (
39- 'Staging changes in git' ,
40- ) ;
41- childProcess . execFileSync ( 'git' , [ 'add' , cargoTOMLPath ] , {
37+ console . error ( 'updating cargo lock file with change' ) ;
38+ childProcess . execFileSync ( 'cargo' , [ 'update' , '--package' , 'quic' ] , {
4239 stdio : [ 'inherit' , 'inherit' , 'inherit' ] ,
4340 windowsHide : true ,
4441 encoding : 'utf-8' ,
4542 shell : platform === 'win32' ? true : false ,
4643 } ) ;
4744
45+ console . error ( 'Staging changes in git' ) ;
46+ childProcess . execFileSync (
47+ 'git' ,
48+ [ 'add' , cargoTOMLPath , path . join ( projectRoot , 'Cargo.lock' ) ] ,
49+ {
50+ stdio : [ 'inherit' , 'inherit' , 'inherit' ] ,
51+ windowsHide : true ,
52+ encoding : 'utf-8' ,
53+ shell : platform === 'win32' ? true : false ,
54+ } ,
55+ ) ;
56+
4857 console . error (
4958 'Updating the package.json with optional native dependencies and package-lock.json' ,
5059 ) ;
0 commit comments