MCPcopy
hub / github.com/subquery/subql / getManifestPath

Function getManifestPath

packages/common/src/project/load.ts:23–40  ·  view source on GitHub ↗
(manifestDir: string, fileName?: string)

Source from the content-addressed store, hash-verified

21}
22
23export 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
42export function getSchemaPath(manifestDir: string, fileName?: string): string {
43 const rawProject = loadFromJsonOrYaml(getManifestPath(manifestDir, fileName));

Callers 4

codegenFunction · 0.90
generateAdapterFunction · 0.90
getSchemaPathFunction · 0.85

Calls

no outgoing calls

Tested by 1