Skip to content

Port @sanity/language-filter v4.1.0 to monorepo with git subtree#586

Open
Copilot wants to merge 88 commits intomainfrom
copilot/copy-changes-language-filter
Open

Port @sanity/language-filter v4.1.0 to monorepo with git subtree#586
Copilot wants to merge 88 commits intomainfrom
copilot/copy-changes-language-filter

Conversation

Copy link
Contributor

Copilot AI commented Feb 17, 2026

Migrate @sanity/language-filter to monorepo

  • Use git subtree to add language-filter repository while preserving history
  • Review and understand the plugin structure
  • Update package.json for monorepo compatibility
  • Remove incompatible files/configs (eslint, prettier, husky, babel, jest, etc.)
  • Update dependencies (removed @sanity/incompatible-plugin, updated to monorepo structure)
  • Add tsconfig.build.json and vitest.config.ts
  • Update package.config.ts for React Compiler
  • Fix TypeScript build errors (isolatedDeclarations)
  • Fix all linting issues
  • Convert Jest tests to Vitest
  • Add package exports test
  • Plugin builds successfully
  • Test studio already configured (language-filter used by internationalized-array)
  • Create changeset for major version bump
  • All linting passes (0 errors, 0 warnings)
  • All tests pass (8/8 tests)
  • Disable isolatedDeclarations in tsconfig.build.json per review feedback
  • Use catalog: for @sanity/ui and @sanity/util dependencies
  • Add @sanity/util to monorepo catalog at version ^5.8.1
  • Update LICENSE copyright year to 2026
  • Remove styled-components and babel-plugin-styled-components dependencies
  • Update test-studio to use workspace:* for @sanity/language-filter
  • Add parentValue parameter to filterField function (v4.1.0)
  • Update version to 4.1.0
  • Update internationalized-array to support language-filter v4.1.0
  • Add changeset for internationalized-array update
  • Remove unused languageSubscription.ts module

Migration complete! The @sanity/language-filter plugin has been successfully ported to the monorepo with full git history preserved via git subtree.

Key Changes

Dependencies:

  • Removed styled-components and babel-plugin-styled-components - replaced styled component with inline styles
  • Updated @sanity/ui and @sanity/util to use catalog versions
  • Added @sanity/util to the monorepo catalog at version ^5.8.1
  • Removed all standalone repository tooling (eslint, prettier, husky, babel, jest)
  • Updated test-studio to use workspace:* for @sanity/language-filter dependency

New Features (v4.1.0):

  • Added parentValue parameter to filterField function, allowing more advanced filtering based on the parent object's current value
  • The filterField function now receives four parameters: enclosingType, field, selectedLanguageIds, and parentValue

Code Modernization:

  • Replaced deprecated useClickOutside hook with useClickOutsideEvent
  • Fixed FormEvent usage with proper React.ChangeEvent
  • Added explicit return type annotations for TypeScript compatibility
  • Converted styled component to inline styles for simpler styling approach
  • Removed unused languageSubscription.ts module (state management now uses React Context)

Companion Changes:

  • Updated sanity-plugin-internationalized-array to support new language-filter v4.1.0 API
  • Moved @sanity/language-filter from dependencies to devDependencies/peerDependencies in internationalized-array
  • Added changeset for internationalized-array patch release

Testing:

  • Converted from Jest to Vitest
  • Added package exports validation test
  • Updated tests to include new parentValue parameter
  • All 8 tests passing

Breaking Changes:

  • React 19.2+ required
  • Sanity Studio v5+ required
  • ESM-only (CommonJS removed)
  • Node.js 20.19+ required
  • styled-components peer dependency removed
  • filterField function signature changed: now accepts fourth parameter parentValue (type: Record<string, unknown> | undefined)
  • Language subscription bus removed: languageSubscription.ts module and its exports (createSelectedLanguageIdsBus, SelectedLanguageIdsBus, LanguageSubscription, Unsubscribe, LanguageSubscribe) have been removed in favor of React Context

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

snorrees and others added 30 commits August 25, 2022 15:33
Upgraded with
"npx @sanity/plugin-kit inject --preset semver-workflow --preset renovatebot"
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR ports the @sanity/language-filter plugin from its standalone repository to the Sanity plugins monorepo using git subtree, preserving the complete git history. The migration updates the plugin to v4.1.0, which adds a new parentValue parameter to the filterField function, enabling more advanced filtering based on the parent object's current value.

Changes:

  • Ported plugin to monorepo with monorepo-compatible configurations (package.json, tsconfig, vitest, package.config.ts)
  • Replaced deprecated hooks and modernized code (useClickOutside → useClickOutsideEvent, removed styled-components)
  • Added v4.1.0 feature: parentValue parameter to filterField function signature
  • Converted tests from Jest to Vitest and added package exports validation

Reviewed changes

Copilot reviewed 23 out of 24 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
pnpm-workspace.yaml Added @sanity/util to catalog at ^5.8.1
pnpm-lock.yaml Updated lockfile with new plugin dependencies and workspace references
plugins/@sanity/language-filter/package.json Configured as monorepo plugin with catalog dependencies
plugins/@sanity/language-filter/src/*.ts(x) Plugin source code with modernized hooks and new parentValue support
plugins/@sanity/language-filter/tsconfig*.json TypeScript configurations with isolatedDeclarations disabled
plugins/@sanity/language-filter/vitest.config.ts Vitest test configuration for jsdom environment
plugins/@sanity/language-filter/package.config.ts React Compiler configuration targeting React 19
plugins/@sanity/language-filter/README.md Updated documentation with parentValue parameter
plugins/@sanity/language-filter/CHANGELOG.md Historical changelog from git subtree
plugins/@sanity/language-filter/LICENSE MIT license with 2026 copyright
dev/test-studio/package.json Updated to use workspace:* for language-filter
.changeset/language-filter-monorepo-port.md Changeset documenting major breaking changes
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pedrobonamin
Copy link
Contributor

@copilot add a changeset for the array internationalization update

Co-authored-by: pedrobonamin <46196328+pedrobonamin@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 17, 2026

@copilot add a changeset for the array internationalization update

Done in 57f5a17. Added changeset for the internationalized-array update to support @sanity/language-filter v4.1.0 with the new parentValue parameter.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 26 out of 27 changed files in this pull request and generated 3 comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: pedrobonamin <46196328+pedrobonamin@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 25 out of 26 changed files in this pull request and generated no new comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

10 participants