Skip to content

Commit

Permalink
feat: allow infinite loop to select file
Browse files Browse the repository at this point in the history
  • Loading branch information
ShenQingchuan committed Sep 7, 2022
1 parent 9c2c237 commit 49c0f9c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/unit-test.yml
Expand Up @@ -50,5 +50,6 @@ jobs:
- name: Build
run: nr build

- name: Test
run: nr test
# Todo: add unit test
# - name: Test
# run: nr test
24 changes: 16 additions & 8 deletions src/index.ts
Expand Up @@ -265,6 +265,11 @@ _____ _____ ____ _
}
const rawAllErrsMap = await getRawErrsMap(baseRootAndTarget)
let selectedPath = rootAbsPath
console.log(
`\n💡 ${chalk.yellow(
"Tips: If you changed these 'error-files' while reading errors count below, the data may be not correct."
)}\n`
)
do {
selectedPath = await selectFile({
root: rootAbsPath,
Expand All @@ -274,14 +279,17 @@ _____ _____ ____ _
if (!selectedPath) {
throw new Error('failed to select file!')
}
} while (!isFilePath(selectedPath))

// show selected file's pretty tsc errors information
showFileErrs({
selectedPath,
rootAbsPath,
rawAllErrsMap,
})
if (isFilePath(selectedPath)) {
// show selected file's pretty tsc errors information
showFileErrs({
selectedPath,
rootAbsPath,
rawAllErrsMap,
})
selectedPath = rootAbsPath
}
// eslint-disable-next-line no-constant-condition
} while (true)
} catch (err) {
console.log(chalk.red(`\n${err}`))
}

0 comments on commit 49c0f9c

Please sign in to comment.