-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1d2a39f
commit f7f8693
Showing
5 changed files
with
499 additions
and
504 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,14 @@ | ||
import fs from "fs" | ||
|
||
const fileName = "src/api/search/generated.ts" | ||
let fileContents = fs.readFileSync(fileName, "utf8") | ||
|
||
fileContents = fileContents.replaceAll(/export type (Maybe|InputMaybe|Exact|Make|Incremental).*$/gm, "") | ||
fileContents = fileContents.replaceAll(/InputMaybe<(.+)>;$/gm, "$1") | ||
fileContents = fileContents.replaceAll(/Maybe<(.+)>;$/gm, "$1") | ||
fileContents = fileContents.replaceAll(/Scalars\['(ID|String)'\]\['\w+'\]/gm, "string") | ||
fileContents = fileContents.replaceAll(/Scalars\['Boolean'\]\['\w+'\]/gm, "boolean") | ||
fileContents = fileContents.replaceAll(/Scalars\['(Int|Float)'\]\['\w+'\]/gm, "number") | ||
fileContents = fileContents.replaceAll(/Scalars\['Json'\]\['\w+'\]/gm, "unknown") | ||
fileContents = fileContents.replaceAll(/Array<(\w+)>/gm, "$1[]") | ||
fs.writeFileSync(fileName, fileContents.trim()) |
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.