Skip to content

refactor: replace extract code with sanity schema library#584

Draft
binoy14 wants to merge 2 commits intomainfrom
manifest-cleanup
Draft

refactor: replace extract code with sanity schema library#584
binoy14 wants to merge 2 commits intomainfrom
manifest-cleanup

Conversation

@binoy14
Copy link
Contributor

@binoy14 binoy14 commented Mar 10, 2026

Description

Replaces duplicate code with @sanity/schema/_internal

What to review

Anything I miss

Testing

Existing tests should suffice

@claude
Copy link

claude bot commented Mar 10, 2026

Claude finished @binoy14's task in 1m 29s —— View job


Code Review

  • Gather context and read changed files
  • Analyze diff for issues
  • Post review findings

Two files were missed that still import from deleted extractWorkspaceManifest.ts:

1. deployStudioSchemasAndManifests.worker.ts:6,38 — broken import (runtime crash)

import {extractWorkspaceManifest} from '../manifest/extractWorkspaceManifest.js'
// ...
const workspaceManifests = await extractWorkspaceManifest(workspaces, workDir)

extractWorkspaceManifest.ts was deleted in this PR but this file still imports from it. Needs to be migrated to use extractCreateWorkspaceManifest from @sanity/schema/_internal the same way extractManifest.worker.ts was updated.

2. extractSanityWorkspace.worker.ts:6 — broken import (runtime crash)

import {extractManifestSchemaTypes} from '../manifest/extractWorkspaceManifest.js'

Same issue — extractWorkspaceManifest.ts is gone. If extractManifestSchemaTypes is available from @sanity/schema/_internal, it should be imported from there. If not, this function needs an equivalent replacement.

3. deployStudioSchemasAndManifests.worker.ts:7 — type import from cleaned-up types.ts

import {type CreateWorkspaceManifest} from '../manifest/types.js'

CreateWorkspaceManifest was removed from types.ts in this PR. This import needs to be updated to @sanity/schema/_internal (same as writeWorkspaceFiles.ts was updated).

4. _internal.ts — breaking change

extractManifestSchemaTypes was a public export from @sanity/cli/src/exports/_internal.ts. Removing it without a major version bump or deprecation notice may break external consumers.

5. list.ts:70-72 — redundant empty string check

if (flags.id === '') {
  errors.push('id argument is empty')
}
const id = flags.id ? parseWorkspaceSchemaId(flags.id, errors)?.schemaId : undefined

The flags.id === '' check is redundant — the ternary on the next line already handles the falsy case ('' is falsy). The error will be pushed but id becomes undefined, and then errors.length > 0 exits. This works but the explicit check is dead-guarding. Fix this →

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