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): remote template bootstrapper to support write token #8277

Open
wants to merge 2 commits into
base: next
Choose a base branch
from

Conversation

RostiMelk
Copy link
Member

@RostiMelk RostiMelk commented Jan 15, 2025

Description

Allow the remote template bootstrapper to generate a write token by specifying it in your .env.example.

I'm using the earlier implementation of generateSanityApiReadToken, but renamed it to generateSanityApiToken, and added an arg for specifying the role of the token.

What to review

  • The copy, is the token naming and cli output ok?
  • Are the roles ok to use?

Testing

  1. Checkout to this branch
  2. cd packages/@sanity/cli
  3. pnpm install
  4. pnpm run build && npm link
  5. In a projects folder, run sanity init --template https://github.com/sanity-io/nextjs-blog-cms-sanity-v3 (this template expects a write token)
  6. the .env.local should have a write token env set

Notes for release

Tbd if we need one

Copy link

vercel bot commented Jan 15, 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 Jan 15, 2025 10:32am
performance-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 15, 2025 10:32am
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 15, 2025 10:32am
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Jan 15, 2025 10:32am
test-next-studio ⬜️ Ignored (Inspect) Jan 15, 2025 10:32am

Copy link
Contributor

No changes to documentation

Copy link
Contributor

github-actions bot commented Jan 15, 2025

Component Testing Report Updated Jan 15, 2025 10:36 AM (UTC)

❌ Failed Tests (2) -- expand for details
File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 1m 4s 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) 51s 11 7 0
formBuilder/inputs/PortableText/copyPaste/CopyPasteFields.spec.tsx ✅ Passed (Inspect) 0s 0 12 0
formBuilder/inputs/PortableText/Decorators.spec.tsx ✅ Passed (Inspect) 25s 6 0 0
formBuilder/inputs/PortableText/DisableFocusAndUnset.spec.tsx ✅ Passed (Inspect) 14s 3 0 0
formBuilder/inputs/PortableText/DragAndDrop.spec.tsx ✅ Passed (Inspect) 26s 6 0 0
formBuilder/inputs/PortableText/FocusTracking.spec.tsx ✅ Passed (Inspect) 1m 6s 15 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 1m 27s 21 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 1m 39s 18 0 0
formBuilder/inputs/PortableText/PresenceCursors.spec.tsx ✅ Passed (Inspect) 12s 3 9 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 26s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ✅ Passed (Inspect) 1m 42s 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

Copy link
Contributor

github-actions bot commented Jan 15, 2025

⚡️ Editor Performance Report

Updated Wed, 15 Jan 2025 10:36:36 GMT

Benchmark reference
latency of sanity@latest
experiment
latency of this branch
Δ (%)
latency difference
article (title) 27.4 efps (37ms) 25.3 efps (40ms) +3ms (+8.2%)
article (body) 71.9 efps (14ms) 77.5 efps (13ms) -1ms (-/-%)
article (string inside object) 28.6 efps (35ms) 27.8 efps (36ms) +1ms (+2.9%)
article (string inside array) 26.3 efps (38ms) 24.4 efps (41ms) +3ms (+7.9%)
recipe (name) 50.0 efps (20ms) 52.6 efps (19ms) -1ms (-5.0%)
recipe (description) 55.6 efps (18ms) 58.8 efps (17ms) -1ms (-5.6%)
recipe (instructions) 99.9+ efps (5ms) 99.9+ efps (6ms) +1ms (-/-%)
synthetic (title) 18.9 efps (53ms) 19.6 efps (51ms) -2ms (-3.8%)
synthetic (string inside object) 19.6 efps (51ms) 20.2 efps (50ms) -2ms (-2.9%)

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) 37ms 53ms 64ms 467ms 797ms 9.9s
article (body) 14ms 17ms 21ms 164ms 218ms 5.0s
article (string inside object) 35ms 36ms 40ms 48ms 4ms 6.0s
article (string inside array) 38ms 39ms 42ms 146ms 125ms 6.7s
recipe (name) 20ms 22ms 25ms 45ms 0ms 6.6s
recipe (description) 18ms 19ms 20ms 40ms 0ms 4.4s
recipe (instructions) 5ms 7ms 8ms 11ms 0ms 3.0s
synthetic (title) 53ms 56ms 59ms 109ms 546ms 12.2s
synthetic (string inside object) 51ms 54ms 72ms 666ms 1393ms 8.7s

🧪 Experiment result

The performance result of this branch

Benchmark latency p75 p90 p99 blocking time test duration
article (title) 40ms 42ms 69ms 395ms 730ms 10.4s
article (body) 13ms 15ms 17ms 179ms 189ms 4.9s
article (string inside object) 36ms 38ms 49ms 154ms 137ms 6.4s
article (string inside array) 41ms 43ms 50ms 153ms 149ms 6.6s
recipe (name) 19ms 20ms 24ms 45ms 0ms 6.9s
recipe (description) 17ms 18ms 21ms 39ms 0ms 4.6s
recipe (instructions) 6ms 7ms 8ms 9ms 0ms 3.1s
synthetic (title) 51ms 52ms 56ms 67ms 323ms 11.9s
synthetic (string inside object) 50ms 54ms 62ms 450ms 1093ms 8.1s

📚 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.

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.

1 participant