-
Notifications
You must be signed in to change notification settings - Fork 389
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(typegen): also search for queries in app and sanity folders (#6475)
* feat(typegen): also search for queries in app and sanity folders * feat(typegen): format generated types with prettier
- Loading branch information
Showing
7 changed files
with
117 additions
and
15 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
44 changes: 44 additions & 0 deletions
44
packages/@sanity/cli/test/__snapshots__/typegen.test.ts.snap
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,44 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`CLI: \`sanity typegen\` sanity typegen generate: formats code 1`] = ` | ||
"/** | ||
* --------------------------------------------------------------------------------- | ||
* This file has been generated by Sanity TypeGen. | ||
* Command: \`sanity typegen generate\` | ||
* | ||
* Any modifications made directly to this file will be overwritten the next time | ||
* the TypeScript definitions are generated. Please make changes to the Sanity | ||
* schema definitions and/or GROQ queries if you need to update these types. | ||
* | ||
* For more information on how to use Sanity TypeGen, visit the official documentation: | ||
* https://www.sanity.io/docs/sanity-typegen | ||
* --------------------------------------------------------------------------------- | ||
*/ | ||
// Source: schema.json | ||
export type Person = { | ||
_id: string; | ||
_type: 'person'; | ||
_createdAt: string; | ||
_updatedAt: string; | ||
_rev: string; | ||
name?: string; | ||
slug?: Slug; | ||
}; | ||
export type Slug = { | ||
_type: 'slug'; | ||
current?: string; | ||
source?: string; | ||
}; | ||
export declare const internalGroqTypeReferenceTo: unique symbol; | ||
// Source: ./src/queries.ts | ||
// Variable: PAGE_QUERY | ||
// Query: *[_type == \\"page\\" && slug.current == $slug][0] | ||
export type PAGE_QUERYResult = null; | ||
" | ||
`; |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.