MCPcopy Index your code
hub / github.com/code-pushup/cli / normalizedCreateNodesV2Context

Function normalizedCreateNodesV2Context

packages/nx-plugin/src/plugin/utils.ts:11–35  ·  view source on GitHub ↗
(
  context: CreateNodesContextV2,
  projectConfigurationFile: string,
  createOptions: CreateNodesOptions = {},
)

Source from the content-addressed store, hash-verified

9} from './types.js';
10
11export async function normalizedCreateNodesV2Context(
12 context: CreateNodesContextV2,
13 projectConfigurationFile: string,
14 createOptions: CreateNodesOptions = {},
15): Promise<NormalizedCreateNodesV2Context> {
16 const projectRoot = path.dirname(projectConfigurationFile);
17
18 try {
19 const projectJson = JSON.parse(
20 (await readFile(projectConfigurationFile)).toString(),
21 ) as ProjectConfigurationWithName;
22
23 const { targetName = CP_TARGET_NAME } = createOptions;
24 return {
25 ...context,
26 projectJson,
27 projectRoot,
28 createOptions: { ...createOptions, targetName },
29 };
30 } catch {
31 throw new Error(
32 `Error parsing project.json file ${projectConfigurationFile}.`,
33 );
34 }
35}

Callers 3

plugin.tsFile · 0.85
utils.unit.test.tsFile · 0.85
utils.unit.test.tsFile · 0.85

Calls 2

readFileFunction · 0.85
toStringMethod · 0.80

Tested by

no test coverage detected