(cwd: string)
| 100 | * Verifies that the resolved working directory exists and is a directory. |
| 101 | */ |
| 102 | export async function assertValidCwd(cwd: string) { |
| 103 | try { |
| 104 | if (!(await stat(cwd)).isDirectory()) { |
| 105 | throw new Error('not a directory'); |
| 106 | } |
| 107 | } catch { |
| 108 | throw new VercelCliError({ |
| 109 | code: 'VERCEL_CLI_INVALID_CWD', |
| 110 | message: `Working directory ${JSON.stringify(cwd)} does not exist or is not a directory.`, |
| 111 | }); |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | /** |
| 116 | * Converts errors from `execa` into stable `VercelCliError` instances. |
no test coverage detected