Skip to content

fix(next-config): make cleanup-interceptors actually work from consumer projects#2621

Merged
paales merged 5 commits into
canaryfrom
fix/cleanup-interceptors-scan-node-modules
May 20, 2026
Merged

fix(next-config): make cleanup-interceptors actually work from consumer projects#2621
paales merged 5 commits into
canaryfrom
fix/cleanup-interceptors-scan-node-modules

Conversation

@paales

@paales paales commented May 20, 2026

Copy link
Copy Markdown
Member

Summary

Two small bugs in graphcommerce cleanup-interceptors:

  1. findDotOriginalFiles never found anything from a consumer project. The function walked up the tree looking for a @graphcommerce/* parent package; from a consumer project (where there is no such parent) parentPath ended up null and the glob expanded to literally null/**/*.original.tsx — silently finding zero files no matter how many interceptors were on disk. Now falls back to cwd and cwd/node_modules/@graphcommerce when there's no @graphcommerce parent, so interceptors written into the consumer's node_modules get picked up.
  2. X files restored from .original always printed 0. restoredCount was declared but never incremented; the now-removed removedCount was the one being incremented. Counter and message are now consistent.

Why

Consumer projects use yarn graphcommerce cleanup-interceptors (often chained before patch-package via yarn create-patch) to get node_modules/@graphcommerce/* back to canary state before generating a patch. With the old findDotOriginalFiles the script was a no-op in that flow — patches ended up including all the locally-written interceptor wrappers and .original files, polluting the diff with framework-generated state.

Test plan

  • From a consumer project with active plugins (so node_modules/@graphcommerce/* contains .original.tsx files), yarn graphcommerce cleanup-interceptors reports the actual count and restores them
  • From an upstream @graphcommerce/* package, behaviour is unchanged (uses the parentPath walk)
  • Counter in the final message matches the number of files actually restored

🤖 Generated with Claude Code

paales and others added 4 commits May 20, 2026 10:43
Mirrors the API already exposed by CustomerUpdateForm. Lets consumers
group dynamic customer attributes into named fieldsets via
AttributesFormAutoLayout instead of falling back to the untranslated
"Other" bucket when extending the customer schema with extra attributes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ack label

The fallback fieldset that catches attributes not claimed by a registered
fieldset was rendered as a hardcoded English "Other" string, bypassing
project translation catalogs. Wrap in <Trans> so consumers can localize.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…nal row is empty

When a store doesn't register dob/gender on the registration form,
nameFieldset produced `grid-template-areas: "firstname lastname" ""`,
which is invalid CSS (empty row, zero columns). Browsers silently fell
back to the default single-column layout, so firstname/lastname stacked
on separate rows at md+ even though the helper meant to put them
side-by-side. Filter empty rows out before joining.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…er projects

findDotOriginalFiles walked up the tree looking for a @graphcommerce/*
parent package. For a consumer project there is no such parent, so
parentPath ended up null and the glob expanded to literally
"null/**/*.original.tsx" — the command silently found zero files no
matter what was on disk. Fall back to cwd and cwd/node_modules/
@graphcommerce when there is no @graphcommerce parent, so interceptors
written into node_modules are actually picked up.

Also drop the unused `removedCount` and increment `restoredCount` in
its place — the final "X files restored from .original" message was
always printing 0 because the wrong counter was being incremented.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented May 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
graphcommerce-246 Ready Ready Preview May 20, 2026 9:15am
graphcommerce-247 Ready Ready Preview May 20, 2026 9:15am
graphcommerce-hygraph-dynamic-rows-ui Ready Ready Preview May 20, 2026 9:15am
graphcommerce-open-source Ready Ready Preview May 20, 2026 9:15am
graphcommerce-storyblok Ready Ready Preview May 20, 2026 9:15am

Request Review

@changeset-bot

changeset-bot Bot commented May 20, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 295fe77

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 86 packages
Name Type
@graphcommerce/next-config Major
@graphcommerce/magento-customer Major
@graphcommerce/magento-store Major
@graphcommerce/hygraph-dynamic-rows-ui Major
@graphcommerce/framer-scroller-example Major
@graphcommerce/magento-graphcms Major
@graphcommerce/magento-open-source Major
@graphcommerce/magento-storyblok Major
@graphcommerce/address-fields-nl Major
@graphcommerce/algolia-categories Major
@graphcommerce/algolia-insights Major
@graphcommerce/algolia-personalization Major
@graphcommerce/algolia-products Major
@graphcommerce/magento-cart-checkout Major
@graphcommerce/magento-cart-email Major
@graphcommerce/magento-cart-items Major
@graphcommerce/magento-cart-shipping-address Major
@graphcommerce/magento-cart Major
@graphcommerce/magento-newsletter Major
@graphcommerce/magento-payment-tokens Major
@graphcommerce/magento-product-configurable Major
@graphcommerce/magento-product-downloadable Major
@graphcommerce/magento-review Major
@graphcommerce/magento-wishlist Major
@graphcommerce/algolia-recommend Major
@graphcommerce/magento-payment-klarna Major
@graphcommerce/magento-payment-multisafepay Major
@graphcommerce/magento-product-bundle Major
@graphcommerce/magento-product-simple Major
@graphcommerce/magento-product-virtual Major
@graphcommerce/magento-cart-payment-method Major
@graphcommerce/magento-cart-shipping-method Major
@graphcommerce/magento-payment-braintree Major
@graphcommerce/magento-payment-included Major
@graphcommerce/mollie-magento-payment Major
@graphcommerce/google-datalayer Major
@graphcommerce/magento-cart-coupon Major
@graphcommerce/magento-cart-pickup Major
@graphcommerce/magento-compare Major
@graphcommerce/magento-payment-adyen Major
@graphcommerce/magento-payment-afterpay Major
@graphcommerce/magento-payment-paypal Major
@graphcommerce/magento-product-grouped Major
@graphcommerce/magento-product Major
@graphcommerce/magento-recently-viewed-products Major
@graphcommerce/demo-magento-graphcommerce Major
@graphcommerce/googleanalytics Major
@graphcommerce/googletagmanager Major
@graphcommerce/algolia-search Major
@graphcommerce/magento-category Major
@graphcommerce/magento-graphql-rest Major
@graphcommerce/magento-search-overlay Major
@graphcommerce/magento-search Major
@graphcommerce/storyblok-ui Major
@graphcommerce/docs Major
@graphcommerce/browserslist-config-pwa Major
@graphcommerce/changeset-changelog Major
@graphcommerce/eslint-config-pwa Major
@graphcommerce/graphql-codegen-markdown-docs Major
@graphcommerce/graphql-codegen-near-operation-file Major
@graphcommerce/graphql-codegen-relay-optimizer-plugin Major
@graphcommerce/misc Major
@graphcommerce/prettier-config-pwa Major
@graphcommerce/typescript-config-pwa Major
@graphcommerce/cli Major
@graphcommerce/ecommerce-ui Major
@graphcommerce/framer-next-pages Major
@graphcommerce/framer-scroller Major
@graphcommerce/framer-utils Major
@graphcommerce/google-playstore Major
@graphcommerce/googlerecaptcha Major
@graphcommerce/graphcms-ui Major
@graphcommerce/graphql-mesh Major
@graphcommerce/graphql Major
@graphcommerce/hygraph-cli Major
@graphcommerce/hygraph-dynamic-rows Major
@graphcommerce/hygraph-ui Major
@graphcommerce/image Major
@graphcommerce/lingui-next Major
@graphcommerce/magento-cms Major
@graphcommerce/magento-graphql Major
@graphcommerce/next-ui Major
@graphcommerce/react-hook-form Major
@graphcommerce/service-worker Major
@graphcommerce/framer-next-pages-example Major
@graphcommerce/image-example Major

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

…ptors fix

- generateInterceptors snapshots: refreshed to match the existing
  `as typeof X & React.FC<Y>` typing pattern the template emitter has
  been producing on canary (pre-existing snapshot drift, unrelated to
  this PR's logic change).
- dist/index.js: regenerated via `yarn packages` so the published build
  output matches the cleanupInterceptors / findDotOriginalFiles source
  changes in this PR.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

1 participant