Skip to content

Remove form-data from cli-kit/app#7729

Draft
amcaplan wants to merge 1 commit into
mainfrom
remove-dep/form-data
Draft

Remove form-data from cli-kit/app#7729
amcaplan wants to merge 1 commit into
mainfrom
remove-dep/form-data

Conversation

@amcaplan
Copy link
Copy Markdown
Contributor

@amcaplan amcaplan commented Jun 5, 2026

Remove form-data from @shopify/cli-kit

Why: Part of an initiative to cut low-value dependency churn (14 Dependabot bumps / 24 months).

Replacement: Native FormData (Node ≥ 22.12) + structural typing.

  • api.ts: replaced the form-data Headers type import with a structural type.
  • bundle.ts (GCS upload): kept as a raw PUT with a manually-set Content-Type boundary — wire behavior is preserved (verified against existing upload tests).

⚠️ Reviewer callouts (MEDIUM confidence — review carefully):

  • The public formData() helper now returns a native FormData, which drops .getHeaders() and .getBoundary() that the form-data instance exposed. This is a public-surface change — please confirm no external consumer relies on those methods.
  • This branch was implemented partly via a fallback agent path (the primary launch hit a transient infra timeout); the diff scope has been verified to touch only the expected files.

Validation: type-check ✅, lint ✅, vitest ✅ (93 tests, including deploy/upload and dev-session-process).

🤖 AI-generated draft — needs human review before merge.

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added the Area: @shopify/cli @shopify/cli package issues label Jun 5, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 5, 2026

Differences in type declarations

We detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:

  • Some seemingly private modules might be re-exported through public modules.
  • If the branch is behind main you might see odd diffs, rebase main into this branch.

New type declarations

We found no new type declarations in this PR

Existing type declarations

packages/cli-kit/dist/private/node/api.d.ts
@@ -1,4 +1,7 @@
-import { Headers } from 'form-data';
+export interface AnyHeaders {
+    forEach: (callback: (value: any, key: any) => void) => void;
+    get?: (name: string) => string | null;
+}
 export type API = 'admin' | 'storefront-renderer' | 'partners' | 'business-platform' | 'app-management';
 export declare const allAPIs: API[];
 export type NetworkRetryBehaviour = {
@@ -38,7 +41,7 @@ export declare function isTransientNetworkError(error: unknown): boolean;
  */
 export declare function isNetworkError(error: unknown): boolean;
 export declare function simpleRequestWithDebugLog<T extends {
-    headers: Headers;
+    headers: AnyHeaders;
     status: number;
 }>(requestOptions: RequestOptions<T>, errorHandler?: (error: unknown, requestId: string | undefined) => unknown): Promise<T>;
 /**
@@ -59,7 +62,7 @@ export declare function simpleRequestWithDebugLog<T extends {
  * @returns The response from the request
  */
 export declare function retryAwareRequest<T extends {
-    headers: Headers;
+    headers: AnyHeaders;
     status: number;
 }>(requestOptions: RequestOptions<T>, errorHandler?: (error: unknown, requestId: string | undefined) => unknown, retryOptions?: {
     limitRetriesTo?: number;
packages/cli-kit/dist/public/node/http.d.ts
@@ -1,5 +1,4 @@
 import { NetworkRetryBehaviour } from '../../private/node/api.js';
-import FormData from 'form-data';
 import { RequestInfo, RequestInit, Response } from 'node-fetch';
 export { FetchError, Request, Response } from 'node-fetch';
 /**

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: @shopify/cli @shopify/cli package issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant