(files: string[])
| 577 | } |
| 578 | |
| 579 | private validateAppDir(files: string[]) { |
| 580 | if (files.length > 1) { |
| 581 | fatalMessage( |
| 582 | `Error: only one directory should be provided for the cra-to-next transform, received ${files.join( |
| 583 | ', ' |
| 584 | )}` |
| 585 | ) |
| 586 | } |
| 587 | const appDir = path.join(process.cwd(), files[0]) |
| 588 | let isValidDirectory = false |
| 589 | |
| 590 | try { |
| 591 | isValidDirectory = fs.lstatSync(appDir).isDirectory() |
| 592 | } catch (err) { |
| 593 | // not a valid directory |
| 594 | } |
| 595 | |
| 596 | if (!isValidDirectory) { |
| 597 | fatalMessage( |
| 598 | `Error: invalid directory provided for the cra-to-next transform, received ${appDir}` |
| 599 | ) |
| 600 | } |
| 601 | return appDir |
| 602 | } |
| 603 | } |
| 604 | |
| 605 | export default async function transformer(files, flags) { |
no test coverage detected