Shopify React Router Headers Export Codemod
This is a codemod that automatically adds the required headers
export to pages using authenticate.admin()
.
Using this codemod
You can run this codemod with the following command:
npx codemod shopify/react-router/headers-export
Before
import { authenticate } from "@shopify/admin-api-utils";export async function loader({ request }) {await authenticate.admin(request);// ...}
After
import { authenticate } from "@shopify/admin-api-utils";export async function loader({ request }) {await authenticate.admin(request);// ...}export const headers: HeadersFunction = (headersArgs) => {return boundary.headers(headersArgs);};
Build custom codemods
Use AI-powered codemod studio and automate undifferentiated tasks for yourself, colleagues or the community