* Attempts to intelligently determine the directory to export to. * @param dir - The directory to export the input to. * @returns
( dir?: string )
| 79 | * @returns |
| 80 | */ |
| 81 | async function requireOutputDir( |
| 82 | dir?: string |
| 83 | ): Promise<[string, string]> | never { |
| 84 | if (dir && isAbsolute(dir)) { |
| 85 | return [dir, relative(process.cwd(), dir)] |
| 86 | } else if (dir) { |
| 87 | const abs = resolve(process.cwd(), dir) |
| 88 | return [abs, relative(process.cwd(), abs)] |
| 89 | } |
| 90 | const rel = await prompts({ |
| 91 | type: 'text', |
| 92 | name: 'dir', |
| 93 | message: |
| 94 | 'Where should the input be exported to (relative to the current directory)?', |
| 95 | initial: guessDir(), |
| 96 | }).then((res) => res.dir) |
| 97 | const abs = resolve(process.cwd(), rel) |
| 98 | return [abs, rel] |
| 99 | } |
| 100 | |
| 101 | function guessDir() { |
| 102 | const srcDir = resolve(process.cwd(), 'src') |
no test coverage detected