Skip to content

Commit 8eaa654

Browse files
fix: failed version checking when cross compiling (#634)
1 parent 5789281 commit 8eaa654

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

editors/vscode/scripts/check-version.mjs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11

2-
import { execSync } from 'child_process';
3-
import { resolve } from 'path';
42
import { readFileSync } from 'fs';
53

6-
const tinymistExecutable = resolve('out/tinymist' + (process.platform === 'win32' ? '.exe' : ''));
74

85
function check() {
9-
const version = JSON.parse(readFileSync('package.json', 'utf8')).version;
10-
const expected = `tinymist ${version}`;
6+
const cargoToml = readFileSync('../../Cargo.toml', 'utf8');
7+
const cargoVersion = cargoToml.match(/version = "(.*?)"/)[1];
8+
const pkgVersion = JSON.parse(readFileSync('package.json', 'utf8')).version;
119

12-
const output = execSync(`${tinymistExecutable} -V`).toString().trim();
13-
14-
if (output !== expected) {
15-
throw new Error(`Version mismatch: ${output} !== ${expected} (in package.json)`);
10+
if (cargoVersion !== pkgVersion) {
11+
throw new Error(`Version mismatch: ${cargoVersion} (in Cargo.toml) !== ${pkgVersion} (in package.json)`);
1612
}
1713
}
1814

0 commit comments

Comments
 (0)