feat(shopify-assets): migrate sanity-plugin-shopify-assets to monorepo#976
Open
stipsan wants to merge 55 commits into
Open
feat(shopify-assets): migrate sanity-plugin-shopify-assets to monorepo#976stipsan wants to merge 55 commits into
stipsan wants to merge 55 commits into
Conversation
This isn't a big deal, but we tend to sort imports by type: 1. Node built-ins 2. npm modules 3. Local modules, by depth (eg the "closest" modules to the current module last)
refactor: sort imports roughly by type
feat: strict schema support
Resolve pnpm-lock.yaml conflict by taking main's lockfile (Sanity Studio v6 upgrade) and regenerating with pnpm install to re-add the sanity-plugin-shopify-assets workspace entries.
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Resolve conflicts: - dev/test-studio/sanity.config.ts: keep both shopifyAssetsExample and hotspotArrayExample in the kitchen-sink plugins array - knip.jsonc: keep both sanity-plugin-shopify-assets and sanity-plugin-hotspot-array workspace entries - pnpm-lock.yaml: take main's lockfile and regenerate with pnpm install to re-add the sanity-plugin-shopify-assets workspace entries
The oxlint upgrade from main (^1.69.0) enabled jsx-a11y(control-has-associated-label). Add aria-label to the focus-trap input in DialogHeader and the video element in VideoPlayer.
Resolve conflicts: - README.md: keep main's wider Current Plugins table (adds @sanity/dashboard and dashboard-widget-* plugins) plus the sanity-plugin-shopify-assets row - knip.jsonc: keep both the sanity-plugin-shopify-assets and the three new dashboard-widget-* workspace entries - pnpm-lock.yaml: take main's lockfile and regenerate with pnpm install to re-add the sanity-plugin-shopify-assets workspace entries
Resolve conflicts: - dev/test-studio/sanity.config.ts: keep both shopifyAssetsExample and the new tableExample in the kitchen-sink plugins array - knip.jsonc: keep both sanity-plugin-shopify-assets and @sanity/table workspace entries LICENSE: original sanity-plugin-shopify-assets LICENSE credits Sanity.io alone, so per the plugin-transfer skill rule no LICENSE file restoration is needed.
Add author: directives so @changesets/changelog-github thanks the people who built the plugin instead of the bot that opened the transfer PR. Contributors gathered from the original repo's commit history (excluding semantic-release-bot).
Contributor
There was a problem hiding this comment.
Pull request overview
Migrates sanity-plugin-shopify-assets into the sanity-io/plugins monorepo, aligning it with monorepo build/lint/test conventions and wiring it into the test studio for verification.
Changes:
- Adds the new
sanity-plugin-shopify-assetsworkspace (package config, TS/Vitest configs, schemas/components, and an exports test). - Updates/ports UI implementation to
@sanity/uiv3 (incl.getTheme_v2usage) and introduces Shopify asset picker/input components. - Integrates the plugin into the test studio and monorepo tooling (workspace deps, knip config, changeset, README plugin table).
Reviewed changes
Copilot reviewed 31 out of 33 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Adds the plugin to the monorepo “Current Plugins” table. |
| pnpm-lock.yaml | Adds lockfile entries for the new plugin workspace and its dependencies. |
| plugins/sanity-plugin-shopify-assets/vitest.config.ts | Adds Vitest config (inline vitest-package-exports). |
| plugins/sanity-plugin-shopify-assets/tsconfig.json | Adds typecheck TS config for the plugin. |
| plugins/sanity-plugin-shopify-assets/tsconfig.build.json | Adds build TS config for the plugin. |
| plugins/sanity-plugin-shopify-assets/src/utils/helpers.ts | Adds helper for extracting filename from URLs. |
| plugins/sanity-plugin-shopify-assets/src/types.ts | Defines plugin config and Shopify asset types. |
| plugins/sanity-plugin-shopify-assets/src/schema/shopifyAssetSchema.ts | Defines the shopify.asset schema type and its components. |
| plugins/sanity-plugin-shopify-assets/src/schema/shopifyAssetPreviewSchema.ts | Adds preview sub-schema. |
| plugins/sanity-plugin-shopify-assets/src/schema/shopifyAssetMetadataSchema.ts | Adds metadata sub-schema. |
| plugins/sanity-plugin-shopify-assets/src/sanity-ui.d.ts | Styled-components theme typing for @sanity/ui theme. |
| plugins/sanity-plugin-shopify-assets/src/index.ts | Exports the shopifyAssets plugin and augments schema typing. |
| plugins/sanity-plugin-shopify-assets/src/index.test.ts | Adds package exports manifest test/snapshot. |
| plugins/sanity-plugin-shopify-assets/src/datastores/shopify.ts | Implements Shopify assets querying via Sanity API + RxJS. |
| plugins/sanity-plugin-shopify-assets/src/components/VideoPlayer.tsx | Adds Video.js-based player for previews/diffs. |
| plugins/sanity-plugin-shopify-assets/src/components/ShopifyIcon.tsx | Adds Shopify SVG icon component. |
| plugins/sanity-plugin-shopify-assets/src/components/ShopifyAssetPicker.tsx | Adds dialog UI for searching/browsing Shopify assets. |
| plugins/sanity-plugin-shopify-assets/src/components/ShopifyAssetInput.tsx | Adds Sanity object input that opens the picker and renders preview. |
| plugins/sanity-plugin-shopify-assets/src/components/ShopifyAssetInput.styled.tsx | Adds styled-components wrapper for sticky search UI. |
| plugins/sanity-plugin-shopify-assets/src/components/File.tsx | Adds asset tile component for the picker grid. |
| plugins/sanity-plugin-shopify-assets/src/components/File.styled.tsx | Adds theme-aware styling for asset tiles. |
| plugins/sanity-plugin-shopify-assets/src/components/DialogHeader.tsx | Adds picker dialog header with “Add New” button. |
| plugins/sanity-plugin-shopify-assets/src/components/AssetPreview.tsx | Adds in-form preview UI for selected asset. |
| plugins/sanity-plugin-shopify-assets/src/components/AssetDiff.tsx | Adds diff preview component for review panes. |
| plugins/sanity-plugin-shopify-assets/README.md | Adds plugin README (currently still includes legacy standalone-repo instructions). |
| plugins/sanity-plugin-shopify-assets/package.json | Adds monorepo package manifest for the plugin. |
| plugins/sanity-plugin-shopify-assets/package.config.ts | Adds pkg-utils build config (React Compiler + styled-components). |
| plugins/sanity-plugin-shopify-assets/CHANGELOG.md | Imports historical changelog from prior repo. |
| knip.jsonc | Registers the new workspace for knip. |
| dev/test-studio/src/shopify-assets/index.tsx | Adds test-studio example schema + plugin registration. |
| dev/test-studio/sanity.config.ts | Registers the shopify-assets example in the test studio. |
| dev/test-studio/package.json | Adds the plugin workspace dependency to the test studio. |
| .changeset/shopify-assets-monorepo.md | Adds a major changeset documenting breaking migration changes and authors. |
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+12
to
+15
| const {onChange, readOnly, value, schemaType} = props | ||
| const {options} = schemaType | ||
| const {shopifyDomain} = options | ||
|
|
Comment on lines
+15
to
+22
| useEffect(() => { | ||
| player.current = videojs(videoNode.current ?? '', { | ||
| sources: [{src}], | ||
| controls: true, | ||
| }) | ||
|
|
||
| player.current.src({src}) | ||
| }, [src]) |
Comment on lines
+13
to
+15
| const handleOpenInNewTab = useCallback(() => { | ||
| window.open(`https://${shopifyDomain}/admin/content/files`, '_blank') | ||
| }, [shopifyDomain]) |
Comment on lines
+92
to
+100
| const handleSelect = useCallback( | ||
| (file: Asset) => { | ||
| file._key = value?._key | ||
| file._type = schemaType.name | ||
| onChange(PatchEvent.from([set(file)])) | ||
| onClose() | ||
| }, | ||
| [onChange, onClose, schemaType.name, value?._key], | ||
| ) |
Comment on lines
+30
to
+34
| return axios.get( | ||
| `https://${projectId}.api.sanity.io/v1/shopify/assets/${dataset}?shop=${shop}&query=${encodeURIComponent( | ||
| query, | ||
| )}${cursor && `&cursor=${cursor}`}&limit=${resultsPerPage}`, | ||
| { |
Comment on lines
+51
to
+55
| axios.get( | ||
| `https://${projectId}.api.sanity.io/v1/shopify/assets/${dataset}?shop=${shop}${ | ||
| cursor && `&cursor=${cursor}` | ||
| }&limit=${resultsPerPage}`, | ||
| { |
Comment on lines
+87
to
+104
| ## Develop & test | ||
|
|
||
| This plugin uses [@sanity/plugin-kit](https://github.com/sanity-io/plugin-kit) | ||
| with default configuration for build & watch scripts. | ||
|
|
||
| See [Testing a plugin in Sanity Studio](https://github.com/sanity-io/plugin-kit#testing-a-plugin-in-sanity-studio) | ||
| on how to run this plugin with hotreload in the studio. | ||
|
|
||
| ## License | ||
|
|
||
| [MIT](LICENSE) © Sanity.io | ||
|
|
||
| ### Release new version | ||
|
|
||
| Run ["CI & Release" workflow](https://github.com/sanity-io/sanity-plugin-shopify-assets/actions/workflows/main.yml). | ||
| Make sure to select the main branch and check "Release new version". | ||
|
|
||
| Semantic release will only release on configured branches, so it is safe to run release on any branch. |
Resolve conflicts: - dev/test-studio/sanity.config.ts: keep both shopifyAssetsExample and the new asyncListExample in the kitchen-sink plugins array - knip.jsonc: keep both sanity-plugin-shopify-assets and @sanity/sanity-plugin-async-list workspace entries - pnpm-lock.yaml: take main's lockfile and regenerate with pnpm install to re-add the sanity-plugin-shopify-assets workspace entries
3bcd251 to
f7121fe
Compare
bjoerge
previously approved these changes
Jun 17, 2026
Resolve conflicts: - README.md: keep main's new sanity-plugin-media and sanity-plugin-mux-input rows alongside the sanity-plugin-shopify-assets row (alphabetical order) - dev/test-studio/package.json: keep all three workspace deps - dev/test-studio/sanity.config.ts: keep both shopifyAssetsExample and the new muxInputExample in the kitchen-sink plugins array - pnpm-lock.yaml: take main's lockfile and regenerate with pnpm install to re-add the sanity-plugin-shopify-assets workspace entries
Collapse the duplicate @sanity/client (7.22.1 + 7.23.0) that a plain pnpm install reintroduced, back to the single 7.23.0 version main maintains, fixing type-aware lint errors in @sanity/assist and internationalized-array.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Migrates
sanity-plugin-shopify-assetsinto the monorepo using thecopy plugingenerator (git subtree preserves full history).What changed
pnpm generate "copy plugin"and scaffolded monorepo config (package.json,package.config.ts,tsconfig.json,tsconfig.build.json,vitest.config.ts)@sanity/uiv3 (catalog):getTheme_v2theme API instead of the deprecated legacy theme,gapinstead of deprecatedspacepropsReactdefault imports, removed unsafeas Assetassertions by typing the input asObjectInputProps<Asset>, derived the picker config error during render instead ofsetStatein an effect, removed staleeslint-disablecomments and dead codeshopify.assetoptionsoptional in the type augmentation so the documented plugin-levelshopifyDomainconfiguration type-checks@types/video.jssovideo.js@7imports type-check;rxjsnow from catalogdev/test-studio/src/shopify-assets) with both plugin-level and field-levelshopifyDomain, registered in the kitchen-sink workspacecatalog:specifiers indev/test-studio/package.jsonthat the generator run had pinned to5.31.0Manual verification in test studio
Asset preview rendering (document seeded via API with a Shopify CDN asset value), exercising the migrated
getTheme_v2styling,InfoLinefilename badge, and Select/Remove buttons:shopify_assets_seeded_preview_demo.mp4
Picker dialog opening from both fields with graceful error handling (the placeholder store domain is not connected via Sanity Connect, so the expected "Configuration not found - check plugin configuration" card is shown):
shopify_assets_plugin_test_studio_demo.mp4
Rendered asset preview in document form
Transfer verification
npm trust github sanity-plugin-shopify-assets --file=release.yml --repository=sanity-io/pluginspackage.jsondependencies/peerDependencies/exports verified against original repopnpm dev)pnpm format,pnpm knip,pnpm lint,pnpm build,pnpm test runall passMaintainer follow-up
# [This plugin has moved](https://github.com/sanity-io/plugins/tree/main/plugins/sanity-plugin-shopify-assets)shopify-assetsTo show artifacts inline, enable in settings.