(networkFamily: string, network: string)
| 50 | }; |
| 51 | |
| 52 | async 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 | |
| 71 | async function installAndBuild(projectDir: string): Promise<void> { |
| 72 | // Install dependencies |
no test coverage detected