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

Function getExampleProject

packages/cli/src/createProject.fixtures.ts:52–69  ·  view source on GitHub ↗
(networkFamily: string, network: string)

Source from the content-addressed store, hash-verified

50};
51
52async function getExampleProject(networkFamily: string, network: string): Promise<ExampleProjectInterface> {
53 const res = await fetch('https://raw.githubusercontent.com/subquery/templates/main/dist/output.json');
54
55 if (!res.ok) {
56 throw new Error('Failed to get template');
57 }
58
59 const templates = (await res.json()) as {
60 code: string;
61 networks: {code: string; examples: ExampleProjectInterface[]}[];
62 }[];
63 const template = templates
64 .find((t) => t.code === networkFamily)
65 ?.networks.find((n) => n.code === network)
66 ?.examples.find((e) => e.remote === 'https://github.com/subquery/subql-starter');
67 assert(template, 'Failed to get template');
68 return template;
69}
70
71async function installAndBuild(projectDir: string): Promise<void> {
72 // Install dependencies

Callers 2

createTestProjectFunction · 0.85

Calls 1

findMethod · 0.65

Tested by

no test coverage detected