Skip to content

feat(shopify-assets): migrate sanity-plugin-shopify-assets to monorepo#976

Open
stipsan wants to merge 55 commits into
mainfrom
cursor/migrate-shopify-assets-3d60
Open

feat(shopify-assets): migrate sanity-plugin-shopify-assets to monorepo#976
stipsan wants to merge 55 commits into
mainfrom
cursor/migrate-shopify-assets-3d60

Conversation

@stipsan

@stipsan stipsan commented Jun 12, 2026

Copy link
Copy Markdown
Member

Migrates sanity-plugin-shopify-assets into the monorepo using the copy plugin generator (git subtree preserves full history).

What changed

  • Imported source via pnpm generate "copy plugin" and scaffolded monorepo config (package.json, package.config.ts, tsconfig.json, tsconfig.build.json, vitest.config.ts)
  • Migrated UI code to @sanity/ui v3 (catalog): getTheme_v2 theme API instead of the deprecated legacy theme, gap instead of deprecated space props
  • Fixed legacy patterns for monorepo lint rules: type-only imports, removed React default imports, removed unsafe as Asset assertions by typing the input as ObjectInputProps<Asset>, derived the picker config error during render instead of setState in an effect, removed stale eslint-disable comments and dead code
  • Made field-level shopify.asset options optional in the type augmentation so the documented plugin-level shopifyDomain configuration type-checks
  • Added @types/video.js so video.js@7 imports type-check; rxjs now from catalog
  • Wired a test-studio example (dev/test-studio/src/shopify-assets) with both plugin-level and field-level shopifyDomain, registered in the kitchen-sink workspace
  • Added a major changeset and a root README plugins table entry
  • Restored catalog: specifiers in dev/test-studio/package.json that the generator run had pinned to 5.31.0

Manual verification in test studio

Asset preview rendering (document seeded via API with a Shopify CDN asset value), exercising the migrated getTheme_v2 styling, InfoLine filename 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

  • Trusted publishing configured: npm trust github sanity-plugin-shopify-assets --file=release.yml --repository=sanity-io/plugins
  • package.json dependencies/peerDependencies/exports verified against original repo
  • Test studio example wired and manually verified (pnpm dev)
  • pnpm format, pnpm knip, pnpm lint, pnpm build, pnpm test run all pass
  • Major changeset added with validated breaking changes

Maintainer follow-up

To show artifacts inline, enable in settings.

Open in Web Open in Cursor 

thebiggianthead and others added 30 commits December 23, 2022 15:22
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
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.
@socket-security

socket-security Bot commented Jun 12, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addednpm/​pretty-ms@​8.0.010010010081100
Addednpm/​pretty-bytes@​6.1.110010010081100
Addednpm/​react-photo-album@​2.4.110010010086100
Addednpm/​react-infinite-scroll-component@​6.1.110010010091100
Addednpm/​axios@​1.17.09610010096100

View full report

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).
@stipsan stipsan marked this pull request as ready for review June 16, 2026 12:52
@stipsan stipsan requested a review from a team as a code owner June 16, 2026 12:52
@stipsan stipsan requested review from bjoerge and Copilot and removed request for a team June 16, 2026 12:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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-assets workspace (package config, TS/Vitest configs, schemas/components, and an exports test).
  • Updates/ports UI implementation to @sanity/ui v3 (incl. getTheme_v2 usage) 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 thread plugins/sanity-plugin-shopify-assets/src/datastores/shopify.ts
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
bjoerge
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.