From 220aefb3704874c270fa991494ea5f370bc8454a Mon Sep 17 00:00:00 2001 From: GitHub Date: Wed, 17 Apr 2024 09:17:42 +0000 Subject: [PATCH] format --- cache.ts | 19 ++++++++++--------- check.ts | 19 ++++++++++--------- retry.ts | 2 +- xmake.ts | 17 +++++++++-------- 4 files changed, 30 insertions(+), 27 deletions(-) diff --git a/cache.ts b/cache.ts index 659a5b16..e6162a41 100644 --- a/cache.ts +++ b/cache.ts @@ -22,7 +22,7 @@ if (import.meta.main) { async function parallel_cache( entry_iter: AsyncIterableIterator, - limiter: AsyncCurrentLimiter, + limiter: AsyncCurrentLimiter ) { const files: string[] = []; @@ -37,20 +37,21 @@ async function parallel_cache( limiter.run( function (stack: string[]) { return runDenocache(stack); - }.bind(null, stack), + }.bind(null, stack) ) - ), + ) ); } async function start() { const limiter = new AsyncLimiterClass(1); const args = parse(Deno.args); console.log(args); - const skip = typeof args.skip === "string" - ? new RegExp(String(args.skip)) - : Array.isArray(args.skip) - ? args.skip.map((s: string | RegExp) => new RegExp(s)) - : undefined; + const skip = + typeof args.skip === "string" + ? new RegExp(String(args.skip)) + : Array.isArray(args.skip) + ? args.skip.map((s: string | RegExp) => new RegExp(s)) + : undefined; const entry_iter = searchFilesNames({ skip }); await parallel_cache(entry_iter, limiter); } @@ -72,7 +73,7 @@ async function runDenocache(stack: string[]) { if (!success) { throw new Error( "type cache failed:" + - JSON.stringify({ code, success, stdout: out, stderr: err }), + JSON.stringify({ code, success, stdout: out, stderr: err }) ); } } diff --git a/check.ts b/check.ts index a6802abb..925992fd 100644 --- a/check.ts +++ b/check.ts @@ -22,7 +22,7 @@ if (import.meta.main) { async function parallel_check( entry_iter: AsyncIterableIterator, - limiter: AsyncCurrentLimiter, + limiter: AsyncCurrentLimiter ) { const files: string[] = []; @@ -37,20 +37,21 @@ async function parallel_check( limiter.run( function (stack: string[]) { return runDenoCheck(stack); - }.bind(null, stack), + }.bind(null, stack) ) - ), + ) ); } async function start() { const limiter = new AsyncLimiterClass(navigator.hardwareConcurrency); const args = parse(Deno.args); console.log(args); - const skip = typeof args.skip === "string" - ? new RegExp(String(args.skip)) - : Array.isArray(args.skip) - ? args.skip.map((s: string | RegExp) => new RegExp(s)) - : undefined; + const skip = + typeof args.skip === "string" + ? new RegExp(String(args.skip)) + : Array.isArray(args.skip) + ? args.skip.map((s: string | RegExp) => new RegExp(s)) + : undefined; const entry_iter = searchFilesNames({ skip }); await parallel_check(entry_iter, limiter); } @@ -72,7 +73,7 @@ async function runDenoCheck(stack: string[]) { if (!success) { throw new Error( "type cache failed:" + - JSON.stringify({ code, success, stdout: out, stderr: err }), + JSON.stringify({ code, success, stdout: out, stderr: err }) ); } } diff --git a/retry.ts b/retry.ts index e6a07b62..4c6d1989 100644 --- a/retry.ts +++ b/retry.ts @@ -15,7 +15,7 @@ export async function retry( retryOnError?: | ((error: any) => Promise) | ((error: any) => boolean); - }, + } ) { const retryOnError = opts?.retryOnError ?? (() => true); const options: Required = { diff --git a/xmake.ts b/xmake.ts index 4bc63d2a..e3f6ddd4 100644 --- a/xmake.ts +++ b/xmake.ts @@ -6,7 +6,7 @@ import { retry } from "./retry.ts"; async function* findFilesRecursive( path: string, - name: string, + name: string ): AsyncGenerator { for await (const entry of Deno.readDir(path)) { const fullPath = resolve(join(path, entry.name)); @@ -37,7 +37,7 @@ async function RunXmake( sdk: string, executable: string, group: string, - mode: string, + mode: string ) { await RunXmakeConfig(file, toolchain, sdk, executable, mode); await retry(RunXmakeBuild.bind(null, file, executable, group), { @@ -50,11 +50,11 @@ async function RunXmake( const cwd = path.dirname(file); const dirtobecreate = path.join( cwd, - path.dirname(filepathmatched), + path.dirname(filepathmatched) ); console.log( - "Ensures that the directory exists:" + dirtobecreate, + "Ensures that the directory exists:" + dirtobecreate ); await ensureDir(dirtobecreate); return true; @@ -69,7 +69,7 @@ async function RunXmakeConfig( toolchain: string, sdk: string, executable: string, - mode: string, + mode: string ) { console.log({ file }); const cwd = path.dirname(file); @@ -88,9 +88,10 @@ export async function RunCommandShell(others: string[], cwd?: string) { const cmd = os === "windows" ? "powershell.exe" : "bash"; - const args = os === "windows" - ? ["-command", others.join(" \n ")] - : ["-c", others.join(" && ")]; + const args = + os === "windows" + ? ["-command", others.join(" \n ")] + : ["-c", others.join(" && ")]; console.log(JSON.stringify({ cmd, cwd, args })); const command = new Deno.Command(cmd, { cwd: cwd, args });