(dirname: string)
| 52 | } |
| 53 | |
| 54 | export const ensureDir = async (dirname: string): Promise<void> => { |
| 55 | try { |
| 56 | const fileInfo = await stat(dirname) |
| 57 | if (!fileInfo.isDirectory()) { |
| 58 | throw Error(`${dirname} already exists but is not a directory`) |
| 59 | } |
| 60 | } catch (error) { |
| 61 | if (error.code === 'ENOENT') { |
| 62 | await mkdir(dirname, { recursive: true }) |
| 63 | } else { |
| 64 | throw error |
| 65 | } |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | export type YAMLFileData = { |
| 70 | [key: string]: string | object | number | undefined |
no outgoing calls
no test coverage detected