feat: 完善一波代码 & 支持win(待测试验证)

This commit is contained in:
volare
2022-12-04 17:53:43 +08:00
parent 93a79f482f
commit 84d749a54d
10 changed files with 164 additions and 30 deletions

8
bin/helpers/rust.ts vendored
View File

@@ -1,12 +1,16 @@
import { IS_WIN } from '@/utils/platform.js';
import ora from 'ora';
import shelljs from 'shelljs';
import { shellExec } from '../utils/shell.js';
const InstallRustScript = "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y";
const RustInstallScriptFocMac =
"curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y";
const RustInstallScriptForWin = 'winget install --id Rustlang.Rustup';
export async function installRust() {
const spinner = ora('Downloading Rust').start();
try {
await shellExec(InstallRustScript);
await shellExec(IS_WIN ? RustInstallScriptForWin : RustInstallScriptFocMac);
spinner.succeed();
} catch (error) {
console.error('install rust return code', error.message);