auto-form icon indicating copy to clipboard operation
auto-form copied to clipboard

@autoform/react should be a peerDependencies of @autoform/mui, instead of dependencies

Open csr632 opened this issue 2 months ago • 1 comments

When I need to use buildZodFieldConfig:

import { z } from 'zod';
import { buildZodFieldConfig } from '@autoform/react';
import { FieldTypes } from '@autoform/mui';
const fieldConfig = buildZodFieldConfig<
  FieldTypes,
  {
    // You can define custom props here
    isImportant?: boolean;
  }
>();

I need to import it from @autoform/react. But it is auto-installed as a dependencies of @autoform/mui. I cannot import it in my project (I am using pnpm which strictly preventing phantom dependency). For some reason I cannot config public-hoist-pattern of pnpm (team regulation to prevent phantom dependency). So I have to install @autoform/react in my project, which may causing duplicate @autoform/react packages in the node_modules tree.

csr632 avatar Sep 28 '25 08:09 csr632

After more digging, I think buildZodFieldConfig from '@autoform/react' is deprecated. We should use import { fieldConfig } from '@autoform/zod' now. There are some doc still referring buildZodFieldConfig currently.

csr632 avatar Sep 28 '25 15:09 csr632