-
Notifications
You must be signed in to change notification settings - Fork 427
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(sanity): studio manifests cont (#7403)
* feat(sanity): allow `extractSchema` worker to emit schemas for all workspaces * feat(sanity): include workspace and dataset names when extracting schema * feat(cli): add `manifest` commands * feat(manifest): add `@sanity/manifest` package * refactor(sanity): use manifest schemas from `@sanity/manifest` * chore: format files * feat(schema): include `title`, `description`, and `deprecated` attributes when extracting schema * feat(sanity): add `direct` schema format to schema extractor * Revert "feat(schema): include `title`, `description`, and `deprecated` attributes when extracting schema" This reverts commit 60cb576. * feat(sanity): export `ConcreteRuleClass` class * feat(sanity): include validation rules in manifests * refactor(sanity): move manifest extraction code * feat(sanity): extract manifest during build * feat(sanity): adopt `.studioschema.json` filename suffix for manifest schemas * refactor(sanity): rename manifest extraction functions (remove plural) * fix(sanity): remove redundant success message * fix(sanity): stop build spinner before starting manifest extraction * feat(sanity): add `unstable_extractManifestOnBuild` CLI config option * feat(test-studio): enable `unstable_extractManifestOnBuild` * fix(sanity): switch to node crypto for node 18 compatibility * feat(cli): add `unstable_staticAssetsPath` CLI configuration option * chore(cli): refine `unstable_extractManifestOnBuild` CLI configuration option description * feat(sanity): remove extraneous `types` wrapper from manifests * debug(test-studio): remove Mux plugin to unblock typegen * feat(embedded-studio): enable manifest extraction * feat(starter-next-studio): enable manifest extraction * wip * feat(sanity): normalize type constraints in manifest validation * wip * chore: merge fix * feat: serialize userland properties and validation rules in manifest * fix: remove @sanity/manifest package * chore: cleanup * fix: serialize fieldsets * fix: omit default titles on fields and array-members * fix: ensure manifest schema is restoreble and supports cross dataset references * chore: mergefix * fix: serialization of type aliases no longer inlines fields and of props * fix: removes double dot in filename * feat: manifest command * chore: tweaks * chore: revert redundant changes * fix: adds manifest group to CLI * chore: wording change * fix: adds a 2-minute timeout to manifest extract * fix: ensures error code when mainfest extract fails and changes failed spinner message to info * chore: use *ENABLED instead of *DISABLED for constant * chore: defensive optional chaining for option extraction * chore: reworded EXTRACT_FAILURE_MESSAGE --------- Co-authored-by: Ash <[email protected]>
- Loading branch information
1 parent
0cdfdce
commit a098753
Showing
26 changed files
with
2,797 additions
and
96 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import {defineCliConfig} from 'sanity/cli' | ||
|
||
export default defineCliConfig({ | ||
api: { | ||
projectId: 'ppsg7ml5', | ||
dataset: 'test', | ||
}, | ||
}) |
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,34 @@ | ||
import {defineConfig, defineType} from 'sanity' | ||
import {structureTool} from 'sanity/structure' | ||
|
||
const BLOG_POST_SCHEMA = defineType({ | ||
type: 'document', | ||
name: 'blogPost', | ||
title: 'Blog post', | ||
fields: [ | ||
{ | ||
type: 'string', | ||
name: 'title', | ||
title: 'Title', | ||
}, | ||
], | ||
}) | ||
|
||
export const SCHEMA_TYPES = [BLOG_POST_SCHEMA] | ||
|
||
export default defineConfig({ | ||
projectId: 'ppsg7ml5', | ||
dataset: 'test', | ||
|
||
document: { | ||
unstable_comments: { | ||
enabled: true, | ||
}, | ||
}, | ||
|
||
schema: { | ||
types: SCHEMA_TYPES, | ||
}, | ||
|
||
plugins: [structureTool()], | ||
}) |
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,4 @@ | ||
.next | ||
|
||
public/static/*.create-schema.json | ||
public/static/create-manifest.json |
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,41 +1,13 @@ | ||
import {useMemo} from 'react' | ||
import {defineConfig, Studio} from 'sanity' | ||
import {structureTool} from 'sanity/structure' | ||
import {Studio} from 'sanity' | ||
|
||
import config from '../sanity.config' | ||
|
||
const wrapperStyles = {height: '100vh', width: '100vw'} | ||
|
||
export default function StudioRoot({basePath}: {basePath: string}) { | ||
const config = useMemo( | ||
() => | ||
defineConfig({ | ||
basePath, | ||
plugins: [structureTool()], | ||
title: 'Next.js Starter', | ||
projectId: 'ppsg7ml5', | ||
dataset: 'test', | ||
schema: { | ||
types: [ | ||
{ | ||
type: 'document', | ||
name: 'post', | ||
title: 'Post', | ||
fields: [ | ||
{ | ||
type: 'string', | ||
name: 'title', | ||
title: 'Title', | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
}), | ||
[basePath], | ||
) | ||
|
||
return ( | ||
<div style={wrapperStyles}> | ||
<Studio config={config} /> | ||
<Studio config={{...config, basePath}} /> | ||
</div> | ||
) | ||
} |
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 |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
"license": "MIT", | ||
"author": "Sanity.io <[email protected]>", | ||
"scripts": { | ||
"build": "next build", | ||
"build": "sanity manifest extract --path public/static && next build", | ||
"dev": "next dev", | ||
"start": "next start" | ||
}, | ||
|
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,8 @@ | ||
import {defineCliConfig} from 'sanity/cli' | ||
|
||
export default defineCliConfig({ | ||
api: { | ||
projectId: 'ppsg7ml5', | ||
dataset: 'test', | ||
}, | ||
}) |
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,25 @@ | ||
import {defineConfig} from 'sanity' | ||
import {structureTool} from 'sanity/structure' | ||
|
||
export default defineConfig({ | ||
plugins: [structureTool()], | ||
title: 'Next.js Starter', | ||
projectId: 'ppsg7ml5', | ||
dataset: 'test', | ||
schema: { | ||
types: [ | ||
{ | ||
type: 'document', | ||
name: 'post', | ||
title: 'Post', | ||
fields: [ | ||
{ | ||
type: 'string', | ||
name: 'title', | ||
title: 'Title', | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
}) |
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 |
---|---|---|
|
@@ -18,6 +18,7 @@ const coreCommands = [ | |
'graphql', | ||
'hook', | ||
'migration', | ||
'manifest', | ||
'preview', | ||
'schema', | ||
'start', | ||
|
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
Oops, something went wrong.