MCPcopy Create free account
hub / github.com/Snapchat/Valdi / parseProjectSyncJSON

Function parseProjectSyncJSON

npm_modules/cli/src/commands/projectsync.ts:92–108  ·  view source on GitHub ↗
(jsonFilePath: string)

Source from the content-addressed store, hash-verified

90}
91
92async function parseProjectSyncJSON(jsonFilePath: string): Promise<ProjectSyncOutput> {
93 const jsonFilePathContent = await fs.readFile(jsonFilePath);
94 const json = JSON.parse(jsonFilePathContent.toString('utf8')) as ProjectSyncOutputJSON;
95 let tsGeneratedDir: string | undefined;
96
97 if (json.ts_generated_dir) {
98 const dir = path.dirname(jsonFilePath);
99
100 tsGeneratedDir = path.resolve(dir, json.ts_generated_dir);
101 }
102
103 return {
104 target: BazelLabel.fromString(json.target),
105 dependencies: json.dependencies.map(d => BazelLabel.fromString(d)),
106 tsGeneratedDir,
107 };
108}
109
110function isExternalLabel(workspaceInfo: BazelWorkspaceInfo, label: BazelLabel): boolean {
111 return !!label.repo && label.repo !== workspaceInfo.workspaceName;

Callers 1

buildProjectSyncsFunction · 0.85

Calls 6

readFileMethod · 0.65
toStringMethod · 0.65
resolveMethod · 0.65
parseMethod · 0.45
fromStringMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected