()
| 69 | } |
| 70 | |
| 71 | export function getUserConfig(): Constants.UserConfig { |
| 72 | let resolvedPath: string | undefined; |
| 73 | |
| 74 | for (const filePath of Constants.VALDI_CONFIG_PATHS) { |
| 75 | const unrolledPath = resolveFilePath(filePath); |
| 76 | if (fs.existsSync(unrolledPath)) { |
| 77 | resolvedPath = unrolledPath; |
| 78 | break; |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | if (resolvedPath === undefined) { |
| 83 | throw new CliError( |
| 84 | `Please create a Valdi config file in ${Constants.VALDI_CONFIG_PATHS[0] ?? ''} (Running 'valdi bootstrap' takes care of that for you)`, |
| 85 | ); |
| 86 | } |
| 87 | |
| 88 | const configContents = fs.readFileSync(resolvedPath, 'utf8'); |
| 89 | const parsedYaml = yaml.parse(configContents) as Constants.UserConfig; |
| 90 | |
| 91 | return parsedYaml; |
| 92 | } |
| 93 | |
| 94 | export function getAllFilePaths(directoryPath: string): string[] { |
| 95 | directoryPath = resolveFilePath(directoryPath); |
nothing calls this directly
no test coverage detected