diff --git a/src/cli/components/status.tsx b/src/cli/components/status.tsx index 990f4df74..6bb8c0cfa 100644 --- a/src/cli/components/status.tsx +++ b/src/cli/components/status.tsx @@ -15,7 +15,6 @@ export const Status: React.FC = (props) => { ? props.results.some((result) => result.result === 'error') : props.results.result === 'error'; const results = Array.isArray(props.results) ? props.results : [props.results]; - console.log(results, hasError); return ( {hasError ? Error! : Success!} diff --git a/src/server/helpers/file-operations.ts b/src/server/helpers/file-operations.ts index 7f4fcf028..5091a20ad 100644 --- a/src/server/helpers/file-operations.ts +++ b/src/server/helpers/file-operations.ts @@ -19,13 +19,13 @@ export const replaceInFileByLine = async (filePath: string, search: string | Reg if (replace == null) { if (search instanceof RegExp ? line.match(search) : line.includes(search)) { continue; - } else { - writeStream.write(line + EOL); } + writeStream.write(line + EOL); continue; } writeStream.write(line.replace(search, replace) + EOL); } + rl.close(); await new Promise((resolve, reject) => { writeStream.close((err) => { if (err) { @@ -59,10 +59,10 @@ export const searchFileByLine = async (filePath: string, search: string | RegExp let result: number | false = false; let lineNumber = 0; for await (const line of rl) { + if (result) continue; lineNumber++; if (search instanceof RegExp ? line.match(search) : line.includes(search)) { result = lineNumber; - break; } } await new Promise((resolve, reject) => {