Port sanity-plugin-google-translate to monorepo#906
Conversation
add form builder to peerDeps
Respect filterField function and hidden schema option
add theme wrapper, silence schema warning about title, show permissions
|
@copilot you are moving over some config files that are not necessary in this monorepo setup, please verify and remove all the unnecessary ones |
These files came from the subtree import but are handled at the monorepo root level or are no longer needed: - .editorconfig, .eslintignore, .eslintrc, .prettierignore, .prettierrc (root-level) - .gitignore (root-level) - .npmignore (not needed with @sanity/pkg-utils) - .releaserc.json (using changesets, not semantic-release)
Removed in 25fc5d6. Deleted |
|
@copilot add an example in where we use the plugin see the readme here https://github.com/sanity-io/plugins/pull/906/changes#diff-fd02b2584732a3a696692c7a6aefd6e329b7eaf90d179904476dddd7944e02fbR42-R76 |
Added in 129abd2. The example now includes a |
65d0138 to
e6e4806
Compare
There was a problem hiding this comment.
Pull request overview
Ports sanity-plugin-google-translate into the plugins monorepo, adding package scaffolding, source, tests, test-studio integration, and release metadata.
Changes:
- Adds the Google Translate plugin package with build/test configuration and package exports.
- Adds plugin source, helper utilities, README/changelog, and a package exports test.
- Wires the plugin into the test studio, workspace dependencies, lockfile, Knip config, and changeset release flow.
Reviewed changes
Copilot reviewed 20 out of 21 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
.changeset/google-translate-monorepo-port.md |
Adds major-release changeset for the monorepo port. |
CHANGELOG.md |
Imports historical changelog for the plugin. |
README.md |
Adds installation, usage, examples, and API key guidance. |
dev/test-studio/package.json |
Adds the plugin as a test-studio dependency. |
dev/test-studio/sanity.config.ts |
Registers the Google Translate test-studio example. |
dev/test-studio/src/google-translate/index.tsx |
Adds localized string schema and test document example. |
knip.jsonc |
Adds Knip workspace configuration. |
package.config.ts |
Adds package build configuration with React Compiler and styled-components transforms. |
package.json |
Adds package metadata, exports, scripts, dependencies, peers, and engines. |
pnpm-lock.yaml |
Updates lockfile for the new workspace package and test-studio dependency. |
src/GoogleTranslateInput.tsx |
Adds translated object input UI and Google Translate request handling. |
src/googleTranslate.tsx |
Adds Sanity plugin registration and form input override. |
src/helpers/extractLanguageFromCode.ts |
Adds helper for normalizing language codes. |
src/helpers/getLanguageFromMember.ts |
Adds helper for deriving language codes from form members. |
src/helpers/htmlDecode.ts |
Adds helper for decoding translated HTML entities. |
src/index.test.ts |
Adds package exports test. |
src/index.ts |
Adds public package exports. |
src/types.ts |
Adds plugin option and internal helper types. |
tsconfig.build.json |
Adds build TypeScript config. |
tsconfig.json |
Adds typecheck TypeScript config. |
vitest.config.ts |
Adds Vitest configuration. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (allLanguageFields.length === 1 && target === source) { | ||
| return toast.push({ |
| url.searchParams.set(`target`, item.fieldLang) | ||
|
|
||
| if (item.fieldLang === source) { |
| import {createConfig} from 'sanity' | ||
| import {googleTranslate} from 'sanity-plugin-google-translate' | ||
|
|
||
| export const createConfig({ |
| translate?: boolean | ||
| apiKey?: string | ||
| } | ||
|
|
bjoerge
left a comment
There was a problem hiding this comment.
Great stuff!
Copilot calls out a few things that seems legit, but suppose we can fix those later.
Migrates
sanity-plugin-google-translateinto the plugins monorepo usinggit subtreeto preserve commit history. Also includes the generator fix from #905 (CJS format for Node.js 24 compatibility) since the generator was broken without it.Changes
sanity-io/sanity-plugin-google-translatemain branch with full history#google-translateexample plugin in sanity.config.tsbabel-plugin-styled-componentsin ignoreDependenciestsdown.config.mtsoutputs CJS,config.tsimports.cjsextension.github/,.husky/,.editorconfig,.eslintignore,.eslintrc,.gitignore,.npmignore,.prettierignore,.prettierrc,.releaserc.json)Breaking changes in the new major
styled-components^6.1 peer dependency retainedNotes
@sanity/iconskept at^3.7.4(not in workspace catalog)isolatedDeclarationsdisabled in tsconfig.build.json (can be enabled later)npm trust github sanity-plugin-google-translate --file=release.yml --repository=sanity-io/plugins