Skip to content

Commit

Permalink
add configuration option to increase timeout for initial generation (#26
Browse files Browse the repository at this point in the history
)

Co-authored-by: Martin Kirkholt Melhus <[email protected]>
  • Loading branch information
martme and Martin Kirkholt Melhus authored Oct 5, 2023
1 parent f3ab204 commit 72442f4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/unlucky-bags-relate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"rollup-plugin-typed-gql": minor
---

Add new optional configuration parameter to allow longer timeout for initial schema generation
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,5 +99,9 @@ typedGql({
* Base directory to search for files.
*/
baseDir: process.cwd(),
/**
* Time to complete initial generation
*/
startupTimeout: 2000,
});
```
4 changes: 3 additions & 1 deletion src/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import { loadSchema, noop, promiseWithTimeout } from "./helpers.js";
* @property {string} [baseDir]
* Base directory to search for files. Defaults to the current working
* directory (`process.cwd()`).
* @property {number} [startupTimeout]
* Time to complete initial generation. Default 2000 (ms)
*/

/**
Expand Down Expand Up @@ -82,7 +84,7 @@ export default function typedGql(options) {
try {
await promiseWithTimeout(
initialGeneration,
2000,
options.startupTimeout ?? 2000,
"Timed out while generating type declarations for GraphQL queries."
);
} catch (err) {
Expand Down

0 comments on commit 72442f4

Please sign in to comment.