Skip to content

Commit a814c89

Browse files
committed
fix: cargo.lock is now updated as well
* Related #28
1 parent ff4c225 commit a814c89

File tree

2 files changed

+21
-12
lines changed

2 files changed

+21
-12
lines changed

benches/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ import fs from 'fs';
44
import path from 'path';
55
import si from 'systeminformation';
66
import Stream1KB from './stream_1KB';
7-
// import Dummy from './dummy';
7+
// Import Dummy from './dummy';
88

99
async function main(): Promise<void> {
1010
await fs.promises.mkdir(path.join(__dirname, 'results'), { recursive: true });
1111
// Running benches
1212
await Stream1KB();
13-
// await Dummy();
13+
// Await Dummy();
1414
const resultFilenames = await fs.promises.readdir(
1515
path.join(__dirname, 'results'),
1616
);

scripts/version.js

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
* to prevent `npm` from attempting to download unpublished packages.
1414
*/
1515

16-
const process = require('process');
1716
const path = require('path');
1817
const fs = require('fs');
1918
const os = require('os');
@@ -24,27 +23,37 @@ const platform = os.platform();
2423

2524
/* eslint-disable no-console */
2625
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');
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(/version\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

Comments
 (0)