-
Notifications
You must be signed in to change notification settings - Fork 427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/studio manifests cont #7403
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
All work on this leg of the Create integration is now concluded as far as I see it. I've re-tested the latest commit with a tagged release (3.57.2-manifests.74) on another project. Compatible schema
Incompatible schema
Bonus win, running localhost with manifest exposed can be done with
(no hot reload, but thats ok) |
ping @ricokahler @ryanbonial great if ya'll could look over my latest comments and changes, and review. The idea is to get this into next weeks release, so we can shore up this part of the Create integration. |
⚡️ Editor Performance ReportUpdated Thu, 03 Oct 2024 08:54:41 GMT
Detailed information🏠 Reference resultThe performance result of
🧪 Experiment resultThe performance result of this branch
📚 Glossary
|
* 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]>
* 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]>
Studio manifest for Create
The Create project needs access to workspaces and schema define in the Studio.
Create will use the schema to allow users to automatically map their documents into a Studio document type.
Create needs workspace information to deep-link into studios.
This PR introduces "manifest extract", which makes workspace and schema details HTTP accessible for sanity deploy'ed studios.
Timeline
Create is fine with using a tagged release of studio until this PR gets merged and released.
PR includes
sanity manifest extract
.sanity deploy
commandssanity build
The following files are produced
create-manifest.json
<schema-hash>.create-schema.json
By default these gets written to
/dist/static
, and will therefor be served from<studio-url>/static/<filename>
when usingsanity deploy
.Custom deploys will be expected to serve the files under
<studio-url>/static/
as well.For Next.js, this can be done by using
sanity manifest extract --path /public/static && next build
, and putting the generated files on.gitignore
.History
@juice49 graciously provided most of the implementation; I have adjusted it further as the requirements has changed.
Failure states
When running
sanity extract manifest
we do want to return an error code and show the exception, since it is explicit intent, and you want a manifest (and should be able to know why it failed).Example when ran in test-studio:
When running
sanity deploy
, we dont want to return an error code, or fail the deploy:Example when ran in test-studio (with custom studioHost):
Manifest extract will not stop deployment, and is also does not show a big fat ❌ (could be scary to devs, since this is now default)
Create - Studio integration
For a broader discussion internally, refer to this SCQA
What to review
sanity deploy
. Are there ways in which manifest extract could preventsanity deploy
from working?Headsup: some of the files are kinda big; remember to expand them in the diff when reviewing.
Testing
Consider the jest tests: are they exhaustive enough?
Manual testing
In a project you can deploy using sanity deploy:
npm i sanity@manifests
npm run deploy
(ornpm run build && npm run start
to run on localhost)<studioHost>/static/create-manifest.json
<studioHost>/static/<schema-path-found-in-workspace>
on the form<schema-hash>.create-schema.json
)Check the SCQA doc for how to test with Create
Testing commands:
sanity
should include manifest command groupsanity manifest
should list sub commands (currently only extract)sanity manifest extract --help
should show help for the new commandsanity manifest extract
in a project should extract the manifest (or fail gracefully)Regression testing
sanity schema extract
should work as before(this branch should not make any changes to the codepath, this is just here to sanity check that reverted changes didnt make it back in)
Known issues
Notes for release
No need to mention this feature yet.