feat: 脚手架基本ok
This commit is contained in:
21
bin/helpers/rust.ts
Normal file
21
bin/helpers/rust.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
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";
|
||||
export async function installRust() {
|
||||
const spinner = ora('Downloading Rust').start();
|
||||
try {
|
||||
await shellExec(InstallRustScript);
|
||||
spinner.succeed();
|
||||
} catch (error) {
|
||||
console.error('install rust return code', error.message);
|
||||
spinner.fail();
|
||||
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
export function checkRustInstalled() {
|
||||
return shelljs.exec('rustc --version', { silent: true }).code === 0;
|
||||
}
|
||||
8
bin/helpers/tauriConfig.ts
Normal file
8
bin/helpers/tauriConfig.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import crypto from 'crypto';
|
||||
|
||||
export function getIdentifier(name: string, url: string) {
|
||||
const hash = crypto.createHash('md5');
|
||||
hash.update(url);
|
||||
const postFixHash = hash.digest('hex').substring(0, 6);
|
||||
return `pake-${postFixHash}`;
|
||||
}
|
||||
Reference in New Issue
Block a user