Skip to content

Commit

Permalink
fix: failed version checking when cross compiling (#634)
Browse files Browse the repository at this point in the history
  • Loading branch information
Myriad-Dreamin authored Oct 6, 2024
1 parent 5789281 commit 8eaa654
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions editors/vscode/scripts/check-version.mjs
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@

import { execSync } from 'child_process';
import { resolve } from 'path';
import { readFileSync } from 'fs';

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

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

const output = execSync(`${tinymistExecutable} -V`).toString().trim();

if (output !== expected) {
throw new Error(`Version mismatch: ${output} !== ${expected} (in package.json)`);
if (cargoVersion !== pkgVersion) {
throw new Error(`Version mismatch: ${cargoVersion} (in Cargo.toml) !== ${pkgVersion} (in package.json)`);
}
}

Expand Down

0 comments on commit 8eaa654

Please sign in to comment.