-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cache documents, schema loading + os.cpus for concurrency limit + asy…
…nc fs (#5707) * Cache documents and schema loading * changelog * Use os.cpus to calculate concurrency limit * fs async * changes * revert config on cache (already introduced at codegen level) * refactor(cli): use native node fs/promises * fix(cli): imports issue * fix(changeset): remove useless changeset * fix(cli): remove duplicated code.. * fix(cli): remove useless async/await Co-authored-by: Charly POLY <[email protected]>
- Loading branch information
1 parent
a01a741
commit 35566a0
Showing
7 changed files
with
211 additions
and
198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@graphql-codegen/cli': minor | ||
--- | ||
|
||
Use os.cpus to calculate concurrency limit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@graphql-codegen/cli': minor | ||
--- | ||
|
||
Async File System |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,22 @@ | ||
import { writeFileSync, statSync, readFileSync, unlink } from 'fs'; | ||
import { unlink as fsUnlink, promises } from 'fs'; | ||
const { writeFile: fsWriteFile, readFile: fsReadFile, stat: fsStat } = promises; | ||
|
||
export function writeSync(filepath: string, content: string) { | ||
return writeFileSync(filepath, content); | ||
export function writeFile(filepath: string, content: string) { | ||
return fsWriteFile(filepath, content); | ||
} | ||
|
||
export function readSync(filepath: string) { | ||
return readFileSync(filepath, 'utf-8'); | ||
export function readFile(filepath: string) { | ||
return fsReadFile(filepath, 'utf-8'); | ||
} | ||
|
||
export function fileExists(filePath: string): boolean { | ||
export async function fileExists(filePath: string): Promise<boolean> { | ||
try { | ||
return statSync(filePath).isFile(); | ||
return (await fsStat(filePath)).isFile(); | ||
} catch (err) { | ||
return false; | ||
} | ||
} | ||
|
||
export function unlinkFile(filePath: string, cb?: (err?: Error) => any): void { | ||
unlink(filePath, cb); | ||
fsUnlink(filePath, cb); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
35566a0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs: