@powerhousedao/codegen 0.39.0 → 0.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,26 +3,22 @@ to: "<%= rootDir %>/<%= h.changeCase.param(name) %>/index.ts"
3
3
  force: true
4
4
  ---
5
5
  import { Subgraph } from "@powerhousedao/reactor-api";
6
- import { gql } from "graphql-tag";
7
6
  <% if (loadFromFile) { %>
8
- import { readFileSync } from "fs";
9
- import path from "path";
7
+ import schema from "./schema.graphql";
10
8
  import { getResolvers } from "./resolvers";
11
-
12
- // TODO: find a better way to import the graphql schema
13
- const gqlFile = path.join(path.resolve(path.dirname('')), './subgraphs/<%= h.changeCase.param(name) %>/schema.graphql');
14
- const gqlCode = readFileSync(gqlFile).toString();
9
+ <% } else { %>
10
+ import { gql } from "graphql-tag";
15
11
  <% } %>
16
12
 
17
13
  export class <%= pascalName %>Subgraph extends Subgraph {
18
14
  name = "<%= h.changeCase.param(name) %>";
19
15
  <% if (loadFromFile) { %>
20
- typeDefs = gql`${gqlCode}`;
21
-
16
+ typeDefs = schema;
22
17
  resolvers = getResolvers(this);
23
18
  additionalContextFields = {};
24
19
  async onSetup() {}
25
20
  async onDisconnect() {}
21
+
26
22
  <% } else { %>
27
23
 
28
24
  resolvers = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerhousedao/codegen",
3
- "version": "0.39.0",
3
+ "version": "0.40.0",
4
4
  "license": "AGPL-3.0-only",
5
5
  "private": false,
6
6
  "type": "module",