Преглед изворни кода

feat(materials): set form-materials to esm (#279)

Yiwei Mao пре 7 месеци
родитељ
комит
83221a61b6

+ 1 - 1
apps/docs/components/materials.tsx

@@ -9,7 +9,7 @@ export function MaterialDisplay(props: any) {
         command={{
           'By Import': `import { ${props.exportName} } from '@flowgram.ai/materials'`,
           // components/type-selector/index.tsx -> components/type-selector
-          'By CLI': `npx @flowgram.ai/form-materials ${props.filePath
+          'By CLI': `npx @flowgram.ai/form-materials@latest ${props.filePath
             .split('/')
             .slice(0, -1)
             .join('/')}`,

+ 2 - 2
apps/docs/src/en/guide/advanced/form-materials.mdx

@@ -21,7 +21,7 @@ import { JsonSchemaEditor } from '@flowgram.ai/form-materials'
 If customization of components is required (e.g., changing text, styles, or business logic), it is recommended to **add the material source code to the project for customization via CLI**:
 
 ```bash
-npx @flowgram.ai/form-materials
+npx @flowgram.ai/form-materials@latest
 ```
 
 After running, the CLI will prompt the user to select the material to add to the project:
@@ -36,7 +36,7 @@ After running, the CLI will prompt the user to select the material to add to the
 Users can also directly add the source code of a specified material via CLI:
 
 ```bash
-npx @flowgram.ai/form-materials components/json-schema-editor
+npx @flowgram.ai/form-materials@latest components/json-schema-editor
 ```
 
 After the CLI runs successfully, the relevant materials will be automatically added to the `src/form-materials` directory in the current project.

+ 2 - 2
apps/docs/src/zh/guide/advanced/form-materials.mdx

@@ -22,7 +22,7 @@ import { JsonSchemaEditor } from '@flowgram.ai/form-materials'
 如果业务对组件有定制诉求(如:更改文案、样式、业务逻辑),推荐 **通过 CLI 将物料源代码添加到项目中进行定制**:
 
 ```bash
-npx @flowgram.ai/form-materials
+npx @flowgram.ai/form-materials@latest
 ```
 
 运行后 CLI 会提示用户选择要添加到项目中的物料:
@@ -37,7 +37,7 @@ npx @flowgram.ai/form-materials
 使用者也可以直接在 CLI 中添加指定物料的源代码:
 
 ```bash
-npx @flowgram.ai/form-materials components/json-schema-editor
+npx @flowgram.ai/form-materials@latest components/json-schema-editor
 ```
 
 CLI 运行成功后,相关物料会自动添加到当前项目下的 `src/form-materials` 目录下

+ 0 - 0
packages/materials/form-materials/.eslintrc.js → packages/materials/form-materials/.eslintrc.cjs


+ 1 - 0
packages/materials/form-materials/package.json

@@ -4,6 +4,7 @@
   "homepage": "https://flowgram.ai/",
   "repository": "https://github.com/bytedance/flowgram.ai",
   "license": "MIT",
+  "type": "module",
   "exports": {
     "types": "./dist/index.d.ts",
     "import": "./dist/esm/index.js",