-
Notifications
You must be signed in to change notification settings - Fork 245
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Read codegen documents from user GraphQL config (#1577)
* Get codegen documents from user config if available * Update GraphQL config in skeleton to support changing document locations * Changesets * Changesets * Show gql document globs in success banner after codegen * Simplify document patterns in skeleton * Changesets * Refactor
- Loading branch information
Showing
7 changed files
with
88 additions
and
7 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 @@ | ||
--- | ||
'@shopify/cli-hydrogen': minor | ||
--- | ||
|
||
When generating Codegen, the CLI now looks first at the project GraphQL config (e.g. `.graphqlrc.yml` file) to find the documents for the Storefront API schema. |
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,26 @@ | ||
--- | ||
'skeleton': patch | ||
--- | ||
|
||
Updated the GraphQL config in `.graphqlrc.yml` to use the more modern `projects` structure: | ||
|
||
```diff | ||
-schema: node_modules/@shopify/hydrogen/storefront.schema.json | ||
+projects: | ||
+ default: | ||
+ schema: 'node_modules/@shopify/hydrogen/storefront.schema.json' | ||
``` | ||
|
||
This allows you to add additional projects to the GraphQL config, such as third party CMS schemas. | ||
|
||
Also, you can modify the document paths used for the Storefront API queries. This is useful if you have a large codebase and want to exclude certain files from being used for codegen or other GraphQL utilities: | ||
|
||
```yaml | ||
projects: | ||
default: | ||
schema: 'node_modules/@shopify/hydrogen/storefront.schema.json' | ||
documents: | ||
- '!*.d.ts' | ||
- '*.{ts,tsx,js,jsx}' | ||
- 'app/**/*.{ts,tsx,js,jsx}' | ||
``` |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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 +1,7 @@ | ||
schema: node_modules/@shopify/hydrogen-react/storefront.schema.json | ||
projects: | ||
default: | ||
schema: 'node_modules/@shopify/hydrogen/storefront.schema.json' | ||
documents: | ||
- '!*.d.ts' | ||
- '*.{ts,tsx,js,jsx}' | ||
- 'app/**/*.{ts,tsx,js,jsx}' |