mirror of
https://github.com/zen-browser/surfer.git
synced 2025-07-10 18:25:31 +02:00
⚡️ Remove unneded delays
This commit is contained in:
parent
f558a98c7b
commit
baaddb12af
2 changed files with 24 additions and 40 deletions
|
@ -1,6 +1,6 @@
|
|||
import { writeFileSync } from 'fs'
|
||||
import { sync } from 'glob'
|
||||
import path, { resolve } from 'path'
|
||||
import { resolve } from 'path'
|
||||
import { config, log } from '..'
|
||||
import { SRC_DIR } from '../constants'
|
||||
import {
|
||||
|
@ -11,14 +11,13 @@ import {
|
|||
} from '../controllers/patch'
|
||||
import manualPatches from '../manual-patches'
|
||||
import { patchCountFile } from '../middleware/patch-check'
|
||||
import { delay, walkDirectory } from '../utils'
|
||||
import { walkDirectory } from '../utils'
|
||||
|
||||
const importManual = async (minimal?: boolean, noIgnore?: boolean) => {
|
||||
log.info(`Applying ${manualPatches.length} manual patches...`)
|
||||
|
||||
if (!minimal) console.log()
|
||||
|
||||
return new Promise(async (res, rej) => {
|
||||
const total = 0
|
||||
|
||||
let i = 0
|
||||
|
@ -34,8 +33,6 @@ const importManual = async (minimal?: boolean, noIgnore?: boolean) => {
|
|||
src
|
||||
)
|
||||
|
||||
await delay(10)
|
||||
|
||||
await patch.apply()
|
||||
}
|
||||
|
||||
|
@ -49,8 +46,7 @@ const importManual = async (minimal?: boolean, noIgnore?: boolean) => {
|
|||
|
||||
writeFileSync(patchCountFile, fileCount.toString())
|
||||
|
||||
res(total)
|
||||
})
|
||||
return total
|
||||
}
|
||||
|
||||
const importPatchFiles = async (minimal?: boolean, noIgnore?: boolean) => {
|
||||
|
@ -67,8 +63,6 @@ const importPatchFiles = async (minimal?: boolean, noIgnore?: boolean) => {
|
|||
|
||||
if (!minimal) console.log()
|
||||
|
||||
await delay(100)
|
||||
|
||||
let i = 0
|
||||
|
||||
for await (const patchName of patches) {
|
||||
|
@ -81,8 +75,6 @@ const importPatchFiles = async (minimal?: boolean, noIgnore?: boolean) => {
|
|||
resolve(SRC_DIR, patchName)
|
||||
)
|
||||
|
||||
await delay(10)
|
||||
|
||||
await patch.apply()
|
||||
}
|
||||
|
||||
|
@ -108,15 +100,11 @@ const importMelonPatches = async (minimal?: boolean, noIgnore?: boolean) => {
|
|||
|
||||
if (!minimal) console.log()
|
||||
|
||||
await delay(100)
|
||||
|
||||
let i = 0
|
||||
|
||||
for await (const patch of patches) {
|
||||
++i
|
||||
|
||||
await delay(10)
|
||||
|
||||
await patch.applyWithStatus([i, patches.length])
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ import { log } from '..'
|
|||
import {
|
||||
Config,
|
||||
configPath,
|
||||
delay,
|
||||
getLatestFF,
|
||||
projectDir,
|
||||
SupportedProducts,
|
||||
|
@ -21,7 +22,7 @@ export async function setupProject(): Promise<void> {
|
|||
try {
|
||||
if (existsSync(configPath)) {
|
||||
log.warning('There is already a config file. This will overwrite it!')
|
||||
await sleep(1000)
|
||||
await delay(1000)
|
||||
}
|
||||
|
||||
if (configPath.includes('.optional')) {
|
||||
|
@ -194,8 +195,3 @@ async function copyRequired() {
|
|||
})
|
||||
)
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// Utility functions
|
||||
|
||||
const sleep = (time: number) => new Promise<void>((r) => setTimeout(r, time))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue