feat(media): move sanity-plugin-media to the plugins monorepo#978
feat(media): move sanity-plugin-media to the plugins monorepo#978stipsan wants to merge 536 commits into
Conversation
…ent z-index clashing
…uploads with native inputs
… dedicated selected reducer
Correction of typos
Hey Robin 👋 `@sanity/base` is using `@sanity/ui: ^0.33.6`, which forces package managers to download two versions of the library when this plugin is installed. This is making studios throw an error `Cannot read property 'sanity' of undefined`. For more context, see sanity-io/sanity#2190 I'd suggest moving `@sanity/ui` and `styled-components` into `peerDependencies` as those are shipped with Sanity studio. This will make your plugin more resilient in the long run :)
…t with scoped provider
…#267) Co-authored-by: Cody Olsen <81981+stipsan@users.noreply.github.com>
* fix: allow sanity v5 as peer dependency * fix(types): match client version, allow only image/file types - not video
…utils (#290) * chore: setup vitest and test the main plugin actions, components and utils * fix: lint issues * fix: copilot pr comments * fix: add generic error payload for notifications
* feat: add localization support to media plugin configuration and components You can now enable localization support by passing a `locales` array to the plugin config
Adds the ability to automatically tag assets when they are uploaded through image field. This helps keep the media library organized without relying on users to manually tag assets. When opening the Media Browser from a field with mediaTags configured, the browser now automatically filters to show only assets that have those tags, making it easier to find relevant assets. --------- Co-authored-by: pedrobonamin <pedrobonamin@gmail.com>
- point repository/homepage/bugs metadata at sanity-io/plugins - trim standalone-repo scripts and devDependencies; use catalog: where available - keep pkg-utils v7 + plugin-kit build toolchain, dual CJS/ESM output, dependencies, peerDependencies, engines and files unchanged - disable plugin-kit eslint/scripts checks that no longer apply in the monorepo - disable exactOptionalPropertyTypes (fresh dep resolution surfaces violations the old standalone lockfile masked; type-check only) - fix phantom 'is-hotkey' import to use the declared is-hotkey-esm dependency - remove @ts-expect-error that is unused against current sanity types - add zod packageExtension so @hookform/resolvers types resolve the dependent's zod v3 instead of the hidden-hoisted zod v4
…est 4 config - oxlint and knip exclusion is temporary until the legacy code is brought up to monorepo standards in a follow-up PR - replace the removed Vite 'esbuild' option with its Vite 8 'oxc' equivalent so JSX in component tests transforms again (all 149 tests pass)
🦋 Changeset detectedLatest commit: a2e7ee4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub. |
|
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|
…-plugin-media-7523 # Conflicts: # pnpm-lock.yaml
…-plugin-media-7523 # Conflicts: # pnpm-lock.yaml
Moves
sanity-plugin-media(v4.3.1) into the monorepo viagit subtree add(full history preserved). Move-only, non-breaking: the goal of this PR is to relocate the plugin and ship a patch release (4.3.2) to verify it publishes from this repo. Bringing the code up to monorepo standards happens in follow-up PRs.Demo
Manually verified in the test studio (kitchen-sink workspace): Media tool, asset metadata dialog, and the
mediaFieldimage picker withmediaTagspre-filtering, asset selection and auto-tagging.media_plugin_demo_tool_and_asset_source.mp4
Image field picker pre-filtered by the product tag
What changed
git subtree add(no generator, per maintainer direction).github/, eslint/prettier/husky/commitlint/semantic-release configs,LICENSE,package-lock.json); keptsrc/,README.md,CHANGELOG.md, the original tsconfigs/vitest configs,sanity.json+v2-incompatible.js(published files),scripts/migrate-to-localized-fields.ts(referenced by the README), andsanity.config.ts(reference for the test-studio setup).gitignorewith the entries only the plugin's gitignore covered (.vscode,.idea/*.iml,.yalc) before removing the plugin-level filepackage.json: kept the original build toolchain (@sanity/pkg-utils@^7+@sanity/plugin-kit, dual CJS/ESM output) and leftdependencies,peerDependencies,engines, andfilesunchanged; onlyrepository/homepage/bugsmetadata, scripts (build,watch,prepack), and devDependencies changed (catalog:where available)is-hotkeyimport switched to the declaredis-hotkey-esmdependency (previously worked only via npm hoisting)@ts-expect-errorthat is unused against current Sanity typesexactOptionalPropertyTypes(fresh dependency resolution surfaces violations the old standalone lockfile masked; type-check only)packageExtensionsfor@hookform/resolversso its types resolve the dependent's zod v3 instead of the hidden-hoisted zod v4esbuildoption with its Vite 8oxcequivalent (all 37 test files / 149 tests pass under the root vitest)oxlintandknip(oxfmt-only for now); formatted with oxfmtmediaExample(kitchen-sink workspace) modeled on the plugin's standalone dev studio config, exercisingmedia()andmediaFieldwith image + file fieldsREADME.mdtable and a patch changesetTransfer verification
npm trust github sanity-plugin-media --file=release.yml --repository=sanity-io/pluginspackage.jsondependencies/peerDependencies/exports/engines/files verified unchanged against the published 4.3.1 packagepnpm dev, see demo video)pnpm format,pnpm knip,pnpm lint,pnpm build,pnpm test runall passFollow-up PRs (intentionally out of scope here)
oxlint/knipforplugins/sanity-plugin-mediaand fix legacy lint/type issues (React Compiler rules, type-aware rules, re-enableexactOptionalPropertyTypes)@repo/package.config,@sanity/pkg-utilsv10, React Compiler, ESM-only) as a major release@sanity/plugin-kitinto the repo (then drop the plugin-local devDependency)sanity.config.tsfrom the plugin workspace once no longer neededMaintainer follow-up
# [This plugin has moved](https://github.com/sanity-io/plugins/tree/main/plugins/sanity-plugin-media)mediaTo show artifacts inline, enable in settings.