(manifestDir: string, fileName?: string)
| 21 | } |
| 22 | |
| 23 | export function getManifestPath(manifestDir: string, fileName?: string): string { |
| 24 | let manifestPath = manifestDir; |
| 25 | if (fs.existsSync(manifestDir) && fs.lstatSync(manifestDir).isDirectory()) { |
| 26 | const tsFilePath = path.join(manifestDir, fileName ?? DEFAULT_TS_MANIFEST); |
| 27 | const yamlFilePath = path.join(manifestDir, fileName ?? DEFAULT_MANIFEST); |
| 28 | const jsonFilePath = path.join(manifestDir, fileName ?? 'project.json'); |
| 29 | if (fs.existsSync(tsFilePath)) { |
| 30 | manifestPath = tsFilePath; |
| 31 | } else if (fs.existsSync(yamlFilePath)) { |
| 32 | manifestPath = yamlFilePath; |
| 33 | } else if (fs.existsSync(jsonFilePath)) { |
| 34 | manifestPath = jsonFilePath; |
| 35 | } else { |
| 36 | throw new Error(`Could not find project manifest under dir ${manifestDir}`); |
| 37 | } |
| 38 | } |
| 39 | return manifestPath; |
| 40 | } |
| 41 | |
| 42 | export function getSchemaPath(manifestDir: string, fileName?: string): string { |
| 43 | const rawProject = loadFromJsonOrYaml(getManifestPath(manifestDir, fileName)); |
no outgoing calls