Skip to content

Commit 67b58e5

Browse files
committed
build: use non-esm version of execa
refactor: run prettier after autogen graphql refactor: update autogen graphql docs
1 parent dc60ef2 commit 67b58e5

File tree

17 files changed

+52
-108
lines changed

17 files changed

+52
-108
lines changed

bun.lock

Lines changed: 17 additions & 79 deletions
Large diffs are not rendered by default.

cli/commands/autogen/graphql.ts

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import fs from "node:fs";
22
import { join } from "node:path";
33
import { getSablierIndexerEnvio, type Indexer } from "@sablier/indexers";
44
import { Command } from "commander";
5-
import { $ } from "execa";
5+
import $ from "execa";
66
import * as yaml from "js-yaml";
77
import _ from "lodash";
88
import type { CliOptions } from "../../types";
@@ -66,6 +66,7 @@ export async function generateGraphQL(options: GraphQLOptions): Promise<void> {
6666
}
6767

6868
cleanupDocs(basePaths);
69+
await runPrettier(basePaths);
6970
}
7071

7172
/* -------------------------------------------------------------------------- */
@@ -114,27 +115,32 @@ function cleanupDocs(basePaths: string[]): void {
114115
}
115116

116117
async function generateEnvio(protocol: Indexer.Protocol): Promise<string> {
117-
const base = `./docs/api/${protocol}/graphql/envio`;
118+
const basePath = `./docs/api/${protocol}/graphql/envio`;
118119
const schemaURL = getSablierIndexerEnvio({ chainId: CHAIN_ID_SEPOLIA, protocol }).endpoint.url;
119120

120-
await runCommand(base, schemaURL);
121+
await runGenerator(basePath, schemaURL);
121122
console.log(`✔️ Generated GraphQL docs for Envio vendor and ${_.capitalize(protocol)} protocol\n`);
122-
return base;
123+
return basePath;
123124
}
124125

125126
async function generateGraph(protocol: Indexer.Protocol): Promise<string> {
126-
const base = `./docs/api/${protocol}/graphql/the-graph`;
127+
const basePath = `./docs/api/${protocol}/graphql/the-graph`;
127128
const schemaURL = `https://api.studio.thegraph.com/query/112500/sablier-${protocol}-experimental/version/latest`;
128129

129-
await runCommand(base, schemaURL);
130+
await runGenerator(basePath, schemaURL);
130131
console.log(`✔️ Generated GraphQL docs for The Graph vendor and ${_.capitalize(protocol)} protocol\n`);
131-
return base;
132+
return basePath;
132133
}
133134

134135
/**
135136
* @see https://graphql-markdown.dev/docs/settings#baseurl
136137
* @see {@link file://./../../../config/plugins.ts}
137138
*/
138-
async function runCommand(base: string, schema: string): Promise<void> {
139-
await $({ stdio: "inherit" })`bun docusaurus graphql-to-doc --base ${base} --schema ${schema}`;
139+
async function runGenerator(base: string, schema: string): Promise<void> {
140+
await $("bun", ["docusaurus", "graphql-to-doc", "--base", base, "--schema", schema], { stdio: "inherit" });
141+
}
142+
143+
async function runPrettier(targetPaths: string[]): Promise<void> {
144+
const patterns = targetPaths.map((path) => `${path}/**/*.{md,mdx,yml,yaml}`);
145+
await $("bun", ["prettier", "--write", ...patterns]);
140146
}

docs/api/flow/graphql/the-graph/objects/action.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ type Action {
8787

8888
#### [<code style={{ fontWeight: 'normal' }}>Action.<b>id</b></code>](#)<Bullet />[<code style={{ fontWeight: 'normal' }}><b>String!</b></code>](/docs/api/flow/graphql/the-graph/scalars/string.mdx) <Badge class="badge badge--secondary badge--non_null" text="non-null"/> <Badge class="badge badge--secondary " text="scalar"/>
8989

90-
Unique identifier: &#x007B;txHash&#x007D;-&#x007B;blockLogIndex&#x007D;
90+
Unique identifier: `{txHash}-{blockLogIndex}`
9191

9292
#### [<code style={{ fontWeight: 'normal' }}>Action.<b>subgraphId</b></code>](#)<Bullet />[<code style={{ fontWeight: 'normal' }}><b>BigInt!</b></code>](/docs/api/flow/graphql/the-graph/scalars/big-int.mdx) <Badge class="badge badge--secondary badge--non_null" text="non-null"/> <Badge class="badge badge--secondary " text="scalar"/>
9393

docs/api/flow/graphql/the-graph/objects/batch.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export const Details = ({ dataOpen, dataClose, children, startOpen = false }) =>
6262
};
6363

6464
Creating streams in bulk is possible using the SablierBatchLockup contract.
65-
See https://github.com/sablier-labs/lockup/blob/v2.0.1/src/SablierBatchLockup.sol
65+
See https://github.com/sablier-labs/lockup/blob/v2.0/src/SablierBatchLockup.sol
6666

6767
The entity can be immutable because a batch is only updated in the same block.
6868
See https://thegraph.com/docs/en/subgraphs/developing/creating/ql-schema/#defining-entities
@@ -88,7 +88,7 @@ type Batch {
8888

8989
#### [<code style={{ fontWeight: 'normal' }}>Batch.<b>id</b></code>](#)<Bullet />[<code style={{ fontWeight: 'normal' }}><b>String!</b></code>](/docs/api/flow/graphql/the-graph/scalars/string.mdx) <Badge class="badge badge--secondary badge--non_null" text="non-null"/> <Badge class="badge badge--secondary " text="scalar"/>
9090

91-
Unique identifier: &#x007B;chainId&#x007D;-&#x007B;txHash&#x007D;-&#x007B;batcher&#x007D;
91+
Unique identifier: `{chainId}-{txHash}-{batcher}`
9292

9393
#### [<code style={{ fontWeight: 'normal' }}>Batch.<b>hash</b></code>](#)<Bullet />[<code style={{ fontWeight: 'normal' }}><b>Bytes</b></code>](/docs/api/flow/graphql/the-graph/scalars/bytes.mdx) <Badge class="badge badge--secondary " text="scalar"/>
9494

docs/api/flow/graphql/the-graph/objects/batcher.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ type Batcher {
8181

8282
#### [<code style={{ fontWeight: 'normal' }}>Batcher.<b>id</b></code>](#)<Bullet />[<code style={{ fontWeight: 'normal' }}><b>String!</b></code>](/docs/api/flow/graphql/the-graph/scalars/string.mdx) <Badge class="badge badge--secondary badge--non_null" text="non-null"/> <Badge class="badge badge--secondary " text="scalar"/>
8383

84-
Unique identifier: &#x007B;chainId&#x007D;-&#x007B;sender&#x007D;
84+
Unique identifier: `{chainId}-{sender}`
8585

8686
#### [<code style={{ fontWeight: 'normal' }}>Batcher.<b>batchCounter</b></code>](#)<Bullet />[<code style={{ fontWeight: 'normal' }}><b>BigInt!</b></code>](/docs/api/flow/graphql/the-graph/scalars/big-int.mdx) <Badge class="badge badge--secondary badge--non_null" text="non-null"/> <Badge class="badge badge--secondary " text="scalar"/>
8787

docs/api/flow/graphql/the-graph/objects/stream.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,11 @@ type Stream {
114114

115115
#### [<code style={{ fontWeight: 'normal' }}>Stream.<b>id</b></code>](#)<Bullet />[<code style={{ fontWeight: 'normal' }}><b>String!</b></code>](/docs/api/flow/graphql/the-graph/scalars/string.mdx) <Badge class="badge badge--secondary badge--non_null" text="non-null"/> <Badge class="badge badge--secondary " text="scalar"/>
116116

117-
Unique identifier: &#x007B;contractAddress&#x007D;-&#x007B;chainId&#x007D;-&#x007B;tokenId&#x007D;
117+
Unique identifier: `{contractAddress}-{chainId}-{tokenId}`
118118

119119
#### [<code style={{ fontWeight: 'normal' }}>Stream.<b>alias</b></code>](#)<Bullet />[<code style={{ fontWeight: 'normal' }}><b>String!</b></code>](/docs/api/flow/graphql/the-graph/scalars/string.mdx) <Badge class="badge badge--secondary badge--non_null" text="non-null"/> <Badge class="badge badge--secondary " text="scalar"/>
120120

121-
Like the id: &#x007B;contractAlias&#x007D;-&#x007B;chainId&#x007D;-&#x007B;tokenId&#x007D;
121+
Like the id: `{contractAlias}-{chainId}-{tokenId}`
122122

123123
#### [<code style={{ fontWeight: 'normal' }}>Stream.<b>chainId</b></code>](#)<Bullet />[<code style={{ fontWeight: 'normal' }}><b>BigInt!</b></code>](/docs/api/flow/graphql/the-graph/scalars/big-int.mdx) <Badge class="badge badge--secondary badge--non_null" text="non-null"/> <Badge class="badge badge--secondary " text="scalar"/>
124124

docs/api/flow/graphql/the-graph/queries/batch.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ Set to `allow` to receive data even if the subgraph has skipped over errors whil
8888
#### [<code style={{ fontWeight: 'normal' }}><b>Batch</b></code>](/docs/api/flow/graphql/the-graph/objects/batch.mdx) <Badge class="badge badge--secondary " text="object"/>
8989

9090
Creating streams in bulk is possible using the SablierBatchLockup contract.
91-
See https://github.com/sablier-labs/lockup/blob/v2.0.1/src/SablierBatchLockup.sol
91+
See https://github.com/sablier-labs/lockup/blob/v2.0/src/SablierBatchLockup.sol
9292

9393
The entity can be immutable because a batch is only updated in the same block.
9494
See https://thegraph.com/docs/en/subgraphs/developing/creating/ql-schema/#defining-entities

docs/api/flow/graphql/the-graph/queries/batches.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ Set to `allow` to receive data even if the subgraph has skipped over errors whil
100100
#### [<code style={{ fontWeight: 'normal' }}><b>Batch</b></code>](/docs/api/flow/graphql/the-graph/objects/batch.mdx) <Badge class="badge badge--secondary " text="object"/>
101101

102102
Creating streams in bulk is possible using the SablierBatchLockup contract.
103-
See https://github.com/sablier-labs/lockup/blob/v2.0.1/src/SablierBatchLockup.sol
103+
See https://github.com/sablier-labs/lockup/blob/v2.0/src/SablierBatchLockup.sol
104104

105105
The entity can be immutable because a batch is only updated in the same block.
106106
See https://thegraph.com/docs/en/subgraphs/developing/creating/ql-schema/#defining-entities

docs/api/lockup/graphql/the-graph/objects/action.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ type Action {
8787

8888
#### [<code style={{ fontWeight: 'normal' }}>Action.<b>id</b></code>](#)<Bullet />[<code style={{ fontWeight: 'normal' }}><b>String!</b></code>](/docs/api/lockup/graphql/the-graph/scalars/string.mdx) <Badge class="badge badge--secondary badge--non_null" text="non-null"/> <Badge class="badge badge--secondary " text="scalar"/>
8989

90-
Unique identifier: &#x007B;txHash&#x007D;-&#x007B;blockLogIndex&#x007D;
90+
Unique identifier: `{txHash}-{blockLogIndex}`
9191

9292
#### [<code style={{ fontWeight: 'normal' }}>Action.<b>subgraphId</b></code>](#)<Bullet />[<code style={{ fontWeight: 'normal' }}><b>BigInt!</b></code>](/docs/api/lockup/graphql/the-graph/scalars/big-int.mdx) <Badge class="badge badge--secondary badge--non_null" text="non-null"/> <Badge class="badge badge--secondary " text="scalar"/>
9393

docs/api/lockup/graphql/the-graph/objects/batch.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export const Details = ({ dataOpen, dataClose, children, startOpen = false }) =>
6262
};
6363

6464
Creating streams in bulk is possible using the SablierBatchLockup contract.
65-
See https://github.com/sablier-labs/lockup/blob/v2.0.1/src/SablierBatchLockup.sol
65+
See https://github.com/sablier-labs/lockup/blob/v2.0/src/SablierBatchLockup.sol
6666

6767
The entity can be immutable because a batch is only updated in the same block.
6868
See https://thegraph.com/docs/en/subgraphs/developing/creating/ql-schema/#defining-entities
@@ -88,7 +88,7 @@ type Batch {
8888

8989
#### [<code style={{ fontWeight: 'normal' }}>Batch.<b>id</b></code>](#)<Bullet />[<code style={{ fontWeight: 'normal' }}><b>String!</b></code>](/docs/api/lockup/graphql/the-graph/scalars/string.mdx) <Badge class="badge badge--secondary badge--non_null" text="non-null"/> <Badge class="badge badge--secondary " text="scalar"/>
9090

91-
Unique identifier: &#x007B;chainId&#x007D;-&#x007B;txHash&#x007D;-&#x007B;batcher&#x007D;
91+
Unique identifier: `{chainId}-{txHash}-{batcher}`
9292

9393
#### [<code style={{ fontWeight: 'normal' }}>Batch.<b>hash</b></code>](#)<Bullet />[<code style={{ fontWeight: 'normal' }}><b>Bytes</b></code>](/docs/api/lockup/graphql/the-graph/scalars/bytes.mdx) <Badge class="badge badge--secondary " text="scalar"/>
9494

0 commit comments

Comments
 (0)