-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cli): create graphql schema using gql.tada
- Loading branch information
1 parent
604f60a
commit 2daeea9
Showing
5 changed files
with
47 additions
and
62 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
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const { generateSchema, generateTadaTypes } = require('@gql.tada/cli-utils'); | ||
|
||
const storeHash = process.env.BIGCOMMERCE_STORE_HASH; | ||
const channelId = process.env.BIGCOMMERCE_CHANNEL_ID; | ||
const customerImpersonationToken = process.env.BIGCOMMERCE_CUSTOMER_IMPERSONATION_TOKEN; | ||
|
||
export const graphqlApiDomain = process.env.BIGCOMMERCE_GRAPHQL_API_DOMAIN ?? 'mybigcommerce.com'; | ||
|
||
// Debugging | ||
console.log('process.cwd()', process.cwd()); | ||
|
||
const generate = async () => { | ||
await generateSchema( | ||
`https://store-${storeHash}${ | ||
channelId === 1 ? '' : `-${channelId}` | ||
}.${graphqlApiDomain}/graphql`, | ||
{ headers: { Authorization: `Bearer ${customerImpersonationToken}` } }, | ||
); | ||
|
||
await generateTadaTypes(); | ||
}; | ||
|
||
generate(); |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.