FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
ghcommit/src/github/codegen.ts at main · changesets/ghcommit · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
changesets
/
ghcommit
Public
Uh oh!
There was an error while loading.
Please reload this page
.
Notifications
You must be signed in to change notification settings
Fork
10
Star
25
Code
Issues
0
Pull requests
2
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
ghcommit
/
src
/
github
/
codegen.ts
Copy path
More file actions
More file actions
Latest commit
History
History
History
60 lines (55 loc) · 1.5 KB
Breadcrumbs
ghcommit
/
src
/
github
/
codegen.ts
Copy path
File metadata and controls
60 lines (55 loc) · 1.5 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import
fs
from
"node:fs"
;
import
path
from
"node:path"
;
import
type
{
CodegenConfig
}
from
"@graphql-codegen/cli"
;
const
schemaPath
=
"node_modules/.cache/github-graphql-schema.graphql"
;
if
(
process
.
env
.
CI
||
!
fs
.
existsSync
(
schemaPath
)
)
{
const
result
=
await
fetch
(
"https://docs.github.com/public/fpt/schema.docs.graphql"
,
)
;
if
(
!
result
.
ok
)
{
throw
new
Error
(
`Failed to fetch GitHub GraphQL schema:
${
result
.
status
}
${
result
.
statusText
}
`
,
)
;
}
fs
.
mkdirSync
(
path
.
dirname
(
schemaPath
)
,
{
recursive
:
true
}
)
;
fs
.
writeFileSync
(
schemaPath
,
await
result
.
text
(
)
)
;
}
const
scalars
=
{
Base64String
:
"string"
,
BigInt
:
"string"
,
CustomPropertyValue
:
"string"
,
Date
:
"string"
,
DateTime
:
"string"
,
GitObjectID
:
"string"
,
GitRefname
:
"string"
,
GitSSHRemote
:
"string"
,
GitTimestamp
:
"string"
,
HTML
:
"string"
,
PreciseDateTime
:
"string"
,
URI
:
"string"
,
X509Certificate
:
"string"
,
}
;
const
config
:
CodegenConfig
=
{
schema
:
schemaPath
,
documents
:
[
"src/github/graphql/queries.ts"
]
,
generates
:
{
"src/github/graphql/generated/types.ts"
:
{
plugins
:
[
"typescript"
]
,
config
:
{
scalars
,
strictScalars
:
true
,
enumsAsTypes
:
true
,
}
,
}
,
"src/github/graphql/generated/operations.ts"
:
{
plugins
:
[
"typescript-operations"
]
,
config
:
{
scalars
,
strictScalars
:
true
,
importSchemaTypesFrom
:
"src/github/graphql/generated/types.ts"
,
importExtension
:
".ts"
,
}
,
}
,
}
,
}
;
export
default
config
;
Back
|
FazBrowse Home
|
New Git URL