-
Notifications
You must be signed in to change notification settings - Fork 417
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
base: next
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great, Snorre! Thank you for picking up my work. I've left a couple of small comments, and also bumped this with the Studio team to see if anybody else is able to take a look.
name: 'manifest', | ||
signature: '[COMMAND]', | ||
isGroupRoot: true, | ||
description: 'Interacts with the studio configuration.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this description correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but I was a bit unsure about what to put here. Manifest sort of looks at the whole studio config and extracts part of it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For context schemaGroup
reads: Interacts with Sanity Studio schema configurations
} | ||
|
||
try { | ||
await extractManifest(args, context) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could it be a good idea to add a timeout to this operation, at least for initial iterations before we understand how it performs for various schemas in the wild (and in different environments)? We could set a fairly lengthy value (1 or 2 minutes, perhaps) that would at least ensure we don't block folks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, was considering it but was a lazy boi 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a 2 minute timeout.
Also added a line about which env var to set if you run into an extract error - probably useful if folks run into the timeout. Adding 5 seconds to a built is one thing, adding 2 minutes quite another 😓
This looks good to me, but we should have someone with more knowledge about this area also take a look. @ricokahler |
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.
Eror output
If the extract fails, you get this error:
Manifest extract will not stop deployment.
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
Introduces a new command, so this needs consideration.
TODO: Figure out what needs to go into release docs. Should probably link to a Create - Studio howto document?