Skip to content

feat(workbench): thread internal singleton flag through unstable_defineApp#1386

Draft
gu-stav wants to merge 1 commit into
mainfrom
sdk-1786
Draft

feat(workbench): thread internal singleton flag through unstable_defineApp#1386
gu-stav wants to merge 1 commit into
mainfrom
sdk-1786

Conversation

@gu-stav

@gu-stav gu-stav commented Jun 25, 2026

Copy link
Copy Markdown
Member

Description

unstable_defineApp now accepts an internal isSingleton: boolean and threads it through to the deploy command. It's hidden from the public DefineAppInput type the same way applicationType is — validated by the schema, omitted from the user-facing surface, set by Sanity-owned apps via @ts-expect-error.

Deploy needs to know whether an app is a Sanity-owned singleton; this wires the flag to where the deploy command can read it (getWorkbench(cliConfig).isSingleton), without exposing it to user apps.

Closes SDK-1786.

What to review

  • The flag follows the exact path applicationType already takes: schema → isWorkbenchApp narrowing (cli-core) → resolveWorkbenchAppgetWorkbench (deploy).
  • No detection/resolution logic — isSingleton is a pure passthrough flag, unlike applicationType which is inferred when absent.
  • DefineAppInput still hides the field (type-surface test asserts it).

Testing

Added unit coverage: schema validation, type-surface exclusion, loader clone preservation, and that the flag reaches the deploy accessor. Typecheck, lint, depcheck and the affected suites all pass.

@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

📦 Bundle Stats — @sanity/cli

Compared against main (85605dd4)

@sanity/cli

Metric Value vs main (85605dd)
Internal (raw) 2.7 KB -
Internal (gzip) 1.0 KB -
Bundled (raw) 11.16 MB +182 B, +0.0%
Bundled (gzip) 2.10 MB +52 B, +0.0%
Import time 874ms -18ms, -2.0%

bin:sanity

Metric Value vs main (85605dd)
Internal (raw) 782 B -
Internal (gzip) 423 B -
Bundled (raw) 9.87 MB -
Bundled (gzip) 1.78 MB -
Import time 2.01s -23ms, -1.1%

🗺️ View treemap · Artifacts

Details
  • Import time regressions over 10% are flagged with ⚠️
  • Sizes shown as raw / gzip 🗜️. Internal bytes = own code only. Total bytes = with all dependencies. Import time = Node.js cold-start median.

📦 Bundle Stats — @sanity/cli-core

Compared against main (85605dd4)

Metric Value vs main (85605dd)
Internal (raw) 106.7 KB +33 B, +0.0%
Internal (gzip) 26.7 KB +25 B, +0.1%
Bundled (raw) 21.72 MB +33 B, +0.0%
Bundled (gzip) 3.46 MB +24 B, +0.0%
Import time 777ms +10ms, +1.3%

🗺️ View treemap · Artifacts

Details
  • Import time regressions over 10% are flagged with ⚠️
  • Sizes shown as raw / gzip 🗜️. Internal bytes = own code only. Total bytes = with all dependencies. Import time = Node.js cold-start median.

📦 Bundle Stats — create-sanity

Compared against main (85605dd4)

Metric Value vs main (85605dd)
Internal (raw) 908 B -
Internal (gzip) 483 B -
Bundled (raw) 931 B -
Bundled (gzip) 491 B -
Import time ❌ ChildProcess denied: node -
Details
  • Import time regressions over 10% are flagged with ⚠️
  • Sizes shown as raw / gzip 🗜️. Internal bytes = own code only. Total bytes = with all dependencies. Import time = Node.js cold-start median.

@github-actions

Copy link
Copy Markdown
Contributor

Coverage Delta

File Statements
packages/@sanity/cli-core/src/config/cli/workbenchApp.ts 100.0% (±0%)
packages/@sanity/workbench-cli/src/defineApp.ts 100.0% (±0%)
packages/@sanity/workbench-cli/src/resolveWorkbenchApp.ts 100.0% (±0%)

Comparing 3 changed files against main @ 1b7bf66260e5c55a1e7a207e3bc2f9bac78bf4da

Overall Coverage

Metric Coverage
Statements 74.4% (±0%)
Branches 64.3% (±0%)
Functions 69.1% (±0%)
Lines 75.0% (±0%)

…fineApp

Deploy needs to know whether an app is a Sanity-owned singleton. Accept and
thread `isSingleton` the same way as `applicationType`: validated by the schema,
hidden from the public `DefineAppInput`, and readable via `getWorkbench` in the
deploy command.
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