Skip to content

Commit a3da5e6

Browse files
committed
Add graph init command for subgraph composition
1 parent b45cf73 commit a3da5e6

File tree

12 files changed

+253
-97
lines changed

12 files changed

+253
-97
lines changed

packages/cli/src/codegen/schema.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const formatTS = async (code: string) =>
1010
await prettier.format(code, { parser: 'typescript', semi: false });
1111

1212
const createSchemaCodeGen = (schema: string) =>
13-
new SchemaCodeGenerator(new Schema('', schema, graphql.parse(schema)));
13+
new SchemaCodeGenerator(new Schema(schema, graphql.parse(schema), ''));
1414

1515
const testEntity = async (generatedTypes: any[], expectedEntity: any) => {
1616
const entity = generatedTypes.find(type => type.name === expectedEntity.name);

packages/cli/src/command-helpers/scaffold.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,25 +55,27 @@ export const generateScaffold = async (
5555
{
5656
protocolInstance,
5757
abi,
58-
contract,
58+
source,
5959
network,
6060
subgraphName,
6161
indexEvents,
6262
contractName = 'Contract',
6363
startBlock,
6464
node,
6565
spkgPath,
66+
entities,
6667
}: {
6768
protocolInstance: Protocol;
6869
abi: ABI;
69-
contract: string;
70+
source: string;
7071
network: string;
7172
subgraphName: string;
7273
indexEvents: boolean;
7374
contractName?: string;
7475
startBlock?: string;
7576
node?: string;
7677
spkgPath?: string;
78+
entities?: string[];
7779
},
7880
spinner: Spinner,
7981
) => {
@@ -83,13 +85,14 @@ export const generateScaffold = async (
8385
protocol: protocolInstance,
8486
abi,
8587
indexEvents,
86-
contract,
88+
contract: source,
8789
network,
8890
contractName,
8991
startBlock,
9092
subgraphName,
9193
node,
9294
spkgPath,
95+
entities,
9396
});
9497

9598
return await scaffold.generate();

0 commit comments

Comments
 (0)