chore(repo): update post install script to manually check for rust version less than 1.70 (#19739)
This commit is contained in:
parent
ef4ffe9bc8
commit
93e1e1b67e
@ -2,7 +2,7 @@
|
|||||||
This pre-install script will check that the necessary dependencies are installed
|
This pre-install script will check that the necessary dependencies are installed
|
||||||
Checks for:
|
Checks for:
|
||||||
* Node 18+
|
* Node 18+
|
||||||
* Cargo
|
* Rust
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (process.env.CI) {
|
if (process.env.CI) {
|
||||||
@ -10,22 +10,29 @@ if (process.env.CI) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const childProcess = require('child_process');
|
const childProcess = require('child_process');
|
||||||
|
const semverLessThan = require('semver/functions/lt');
|
||||||
|
|
||||||
// Check node version
|
// Check node version
|
||||||
const nodeVersion = process.version.slice(1).split('.');
|
if (semverLessThan(process.version, '18.0.0')) {
|
||||||
if (+nodeVersion[0] < 18) {
|
|
||||||
console.error(
|
console.error(
|
||||||
'Please make sure that your installed Node version is greater than v18'
|
'Please make sure that your installed Node version is greater than v18'
|
||||||
);
|
);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for cargo
|
// Check for rust
|
||||||
try {
|
try {
|
||||||
childProcess.execSync('cargo --version');
|
let rustVersion = childProcess.execSync('rustc --version');
|
||||||
} catch {
|
if (semverLessThan(rustVersion.toString().split(' ')[1], '1.70.0')) {
|
||||||
|
console.log(`Found ${rustVersion}`);
|
||||||
console.error(
|
console.error(
|
||||||
'Could not find Cargo. Please make sure that Cargo and Rust is installed with https://rustup.rs'
|
'Please make sure that your installed Rust version is greater than v1.70. You can update your installed Rust version with `rustup update`'
|
||||||
|
);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
console.error(
|
||||||
|
'Could not find the Rust compiler on this system. Please make sure that it is installed with https://rustup.rs'
|
||||||
);
|
);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user