Skip to content
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(cli): add deploy command for non-studio applications #8592

Open
wants to merge 5 commits into
base: feat/org-select-for-core-apps
Choose a base branch
from

Conversation

cngonzalez
Copy link
Member

@cngonzalez cngonzalez commented Feb 11, 2025

Description

This PR builds on #8394 by adding a command to deploy non-studio apps. Non-studio apps will not have the same URL assumptions as deployed studios, so the intent of creating a core app is as follows:

  1. sanity detects if you are in a non-studio application by reading sanity.cli.ts, specifically looking for the __experimental_coreAppConfiguration key.
  2. If there is no configuration key for an appId already present, generate one and ask the user to title it.
  3. Deploy the app (right now, this will still be at ${appHost}.sanity.studio but this is obscured).
  4. Request the user save the app key.

The flow is very similar to that of deploying a studio, but some language and options have changed.

What to review

This PR assumes that the organizationId (needed for deployment) is in the api key of sanity.cli, as in #8573 . This doesn't have to be the case, and please do let me know if we'd like to change it.
appHost may not make total sense to our users, and I'm happy to change that key in configuration as well.
If any other language is odd, please let me know. If the user flow doesn't feel right, please let me know.

Testing

Tests were added for existing test files. If you'd also like to manually test, please do the following:

  1. pnpx sanity@latest init --template core-app
  2. In the initialized app, update your sanity dependency to 3.74.2-canary.98+555ec258f0 in your package.json and install
  3. add:
  api: {
    organizationId: 'oF5P8QpKU',
  },

to the generated sanity.cli file.
4. Set your environment to staging with export SANITY_INTERNAL_ENV=staging
5. Run sanity app deploy and examine the instructions and flow. Feel free to also put the generated appHost in your sanity.cli file under __experimental_coreAppConfiguration. You can run it again with the configuration. To see your application, you can check Brett in staging to find your app and go to its designated appHost.

Notes for release

None, internal.

Copy link

vercel bot commented Feb 11, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
page-building-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 14, 2025 7:24pm
performance-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 14, 2025 7:24pm
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 14, 2025 7:24pm
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Visit Preview Feb 14, 2025 7:24pm
test-next-studio ⬜️ Ignored (Inspect) Feb 14, 2025 7:24pm

@cngonzalez cngonzalez force-pushed the feat/sdk-139/create-sanity-app-deploy-command branch from e441d77 to e4f839f Compare February 11, 2025 15:05
Copy link
Contributor

No changes to documentation

Copy link
Contributor

github-actions bot commented Feb 11, 2025

⚡️ Editor Performance Report

Updated Fri, 14 Feb 2025 15:56:27 GMT

Benchmark reference
latency of sanity@latest
experiment
latency of this branch
Δ (%)
latency difference
article (title) 24.7 efps (41ms) 26.0 efps (39ms) -2ms (-4.9%)
article (body) 72.2 efps (14ms) 67.3 efps (15ms) +1ms (-/-%)
article (string inside object) 26.3 efps (38ms) 27.0 efps (37ms) -1ms (-2.6%)
article (string inside array) 23.5 efps (43ms) 24.4 efps (41ms) -2ms (-3.5%)
recipe (name) 48.8 efps (21ms) 47.6 efps (21ms) +1ms (+2.4%)
recipe (description) 57.1 efps (18ms) 52.6 efps (19ms) +2ms (+8.6%)
recipe (instructions) 99.9+ efps (6ms) 99.9+ efps (6ms) +0ms (-/-%)
synthetic (title) 19.0 efps (53ms) 20.0 efps (50ms) -3ms (-4.8%)
synthetic (string inside object) 19.6 efps (51ms) 19.6 efps (51ms) +0ms (-/-%)

efps — editor "frames per second". The number of updates assumed to be possible within a second.

Derived from input latency. efps = 1000 / input_latency

Detailed information

🏠 Reference result

The performance result of sanity@latest

Benchmark latency p75 p90 p99 blocking time test duration
article (title) 41ms 62ms 73ms 394ms 772ms 10.4s
article (body) 14ms 17ms 28ms 171ms 205ms 5.4s
article (string inside object) 38ms 41ms 45ms 142ms 236ms 7.2s
article (string inside array) 43ms 46ms 51ms 279ms 305ms 7.6s
recipe (name) 21ms 22ms 23ms 46ms 4ms 6.9s
recipe (description) 18ms 18ms 20ms 35ms 0ms 4.6s
recipe (instructions) 6ms 8ms 8ms 10ms 0ms 3.1s
synthetic (title) 53ms 58ms 70ms 413ms 1143ms 13.5s
synthetic (string inside object) 51ms 55ms 59ms 376ms 983ms 8.7s

🧪 Experiment result

The performance result of this branch

Benchmark latency p75 p90 p99 blocking time test duration
article (title) 39ms 42ms 58ms 459ms 790ms 10.2s
article (body) 15ms 18ms 39ms 213ms 306ms 5.5s
article (string inside object) 37ms 41ms 54ms 293ms 342ms 7.3s
article (string inside array) 41ms 43ms 50ms 294ms 353ms 7.3s
recipe (name) 21ms 23ms 26ms 52ms 5ms 7.2s
recipe (description) 19ms 21ms 24ms 33ms 0ms 4.6s
recipe (instructions) 6ms 7ms 9ms 25ms 0ms 3.2s
synthetic (title) 50ms 52ms 61ms 388ms 1039ms 12.6s
synthetic (string inside object) 51ms 53ms 56ms 374ms 855ms 8.6s

📚 Glossary

column definitions

  • benchmark — the name of the test, e.g. "article", followed by the label of the field being measured, e.g. "(title)".
  • latency — the time between when a key was pressed and when it was rendered. derived from a set of samples. the median (p50) is shown to show the most common latency.
  • p75 — the 75th percentile of the input latency in the test run. 75% of the sampled inputs in this benchmark were processed faster than this value. this provides insight into the upper range of typical performance.
  • p90 — the 90th percentile of the input latency in the test run. 90% of the sampled inputs were faster than this. this metric helps identify slower interactions that occurred less frequently during the benchmark.
  • p99 — the 99th percentile of the input latency in the test run. only 1% of sampled inputs were slower than this. this represents the worst-case scenarios encountered during the benchmark, useful for identifying potential performance outliers.
  • blocking time — the total time during which the main thread was blocked, preventing user input and UI updates. this metric helps identify performance bottlenecks that may cause the interface to feel unresponsive.
  • test duration — how long the test run took to complete.

Copy link
Contributor

github-actions bot commented Feb 11, 2025

Component Testing Report Updated Feb 14, 2025 3:59 PM (UTC)

❌ Failed Tests (2) -- expand for details
File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 1m 11s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 12s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ❌ Failed (Inspect) 1m 57s 4 0 2
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ✅ Passed (Inspect) 53s 11 7 0
formBuilder/inputs/PortableText/copyPaste/CopyPasteFields.spec.tsx ✅ Passed (Inspect) 0s 0 12 0
formBuilder/inputs/PortableText/Decorators.spec.tsx ✅ Passed (Inspect) 26s 6 0 0
formBuilder/inputs/PortableText/DisableFocusAndUnset.spec.tsx ✅ Passed (Inspect) 15s 3 0 0
formBuilder/inputs/PortableText/DragAndDrop.spec.tsx ✅ Passed (Inspect) 27s 6 0 0
formBuilder/inputs/PortableText/FocusTracking.spec.tsx ✅ Passed (Inspect) 1m 7s 15 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 1m 37s 21 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 2m 4s 21 0 0
formBuilder/inputs/PortableText/PresenceCursors.spec.tsx ✅ Passed (Inspect) 13s 3 9 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 27s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ✅ Passed (Inspect) 1m 45s 21 0 0
formBuilder/tree-editing/TreeEditing.spec.tsx ✅ Passed (Inspect) 0s 0 3 0
formBuilder/tree-editing/TreeEditingNestedObjects.spec.tsx ✅ Passed (Inspect) 0s 0 3 0

@cngonzalez cngonzalez force-pushed the feat/sdk-139/create-sanity-app-deploy-command branch from e4f839f to 8aaae08 Compare February 11, 2025 15:33
@cngonzalez cngonzalez force-pushed the feat/sdk-139/create-sanity-app-deploy-command branch from 8aaae08 to 97e7988 Compare February 11, 2025 15:42
@cngonzalez cngonzalez force-pushed the feat/sdk-139/create-sanity-app-deploy-command branch from 97e7988 to 596ed96 Compare February 11, 2025 19:22
@cngonzalez cngonzalez force-pushed the feat/sdk-139/create-sanity-app-deploy-command branch from 596ed96 to bee4196 Compare February 11, 2025 22:18
@cngonzalez cngonzalez force-pushed the feat/sdk-139/create-sanity-app-deploy-command branch from bee4196 to 2c7d7e8 Compare February 11, 2025 22:44
Copy link
Contributor

github-actions bot commented Feb 11, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 42.71% 54276 / 127064
🔵 Statements 42.71% 54276 / 127064
🔵 Functions 48.08% 2785 / 5792
🔵 Branches 79.3% 10537 / 13286
File CoverageNo changed files found.
Generated in workflow #30435 for commit 5737dbd by the Vitest Coverage Report Action

Copy link
Contributor

@binoy14 binoy14 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly nitpick comments but looks great otherwise. Tested it and was able to get an app deployed 🚀

@cngonzalez cngonzalez changed the base branch from next to graphite-base/8592 February 14, 2025 19:16
@cngonzalez cngonzalez force-pushed the feat/sdk-139/create-sanity-app-deploy-command branch from 75aa903 to 5737dbd Compare February 14, 2025 19:16
@cngonzalez cngonzalez changed the base branch from graphite-base/8592 to feat/org-select-for-core-apps February 14, 2025 19:16
Copy link
Member Author

cngonzalez commented Feb 14, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants