13
13
* to prevent `npm` from attempting to download unpublished packages.
14
14
*/
15
15
16
- const process = require ( 'process' ) ;
17
16
const path = require ( 'path' ) ;
18
17
const fs = require ( 'fs' ) ;
19
18
const os = require ( 'os' ) ;
@@ -24,27 +23,37 @@ const platform = os.platform();
24
23
25
24
/* eslint-disable no-console */
26
25
async 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' ) ;
31
27
const projectRoot = path . join ( __dirname , '..' ) ;
32
28
const cargoTOMLPath = path . join ( projectRoot , 'Cargo.toml' ) ;
33
29
const cargoTOML = await fs . promises . readFile ( cargoTOMLPath , 'utf-8' ) ;
34
30
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
+ ) ;
36
35
await fs . promises . writeFile ( cargoTOMLPath , cargoTOMLUpdated , 'utf-8' ) ;
37
36
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' ] , {
42
39
stdio : [ 'inherit' , 'inherit' , 'inherit' ] ,
43
40
windowsHide : true ,
44
41
encoding : 'utf-8' ,
45
42
shell : platform === 'win32' ? true : false ,
46
43
} ) ;
47
44
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
+
48
57
console . error (
49
58
'Updating the package.json with optional native dependencies and package-lock.json' ,
50
59
) ;
0 commit comments