MCPcopy Create free account
hub / github.com/formkit/formkit / requireOutputDir

Function requireOutputDir

packages/cli/src/exportInput.ts:81–99  ·  view source on GitHub ↗

* Attempts to intelligently determine the directory to export to. * @param dir - The directory to export the input to. * @returns

(
  dir?: string
)

Source from the content-addressed store, hash-verified

79 * @returns
80 */
81async 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
101function guessDir() {
102 const srcDir = resolve(process.cwd(), 'src')

Callers 1

exportInputFunction · 0.85

Calls 1

guessDirFunction · 0.85

Tested by

no test coverage detected