Some checks failed
App Prod-Parity E2E Dispatch / dispatch (push) Failing after 10s
CD Storybook UI / build (push) Failing after 3m25s
CD Storybook UI / dispatch (push) Has been skipped
CD deploy main / website-changed-files (push) Successful in 18m8s
CI Agent Skills / changed-files-check (push) Successful in 18m9s
CI Create App E2E minimal / changed-files-check (push) Successful in 24s
CI Create App / changed-files-check (push) Successful in 26s
CI Docs / changed-files-check (push) Successful in 26s
CI Emails / changed-files-check (push) Successful in 28s
CI Example App Hello World / changed-files-check (push) Successful in 23s
CI Front / changed-files-check (push) Has been skipped
CI Example App Postcard / changed-files-check (push) Successful in 27s
CI UI / changed-files-check (push) Has been skipped
CI Utils Test / changed-files-check (push) Successful in 45s
CI Twenty Apps / discover (push) Successful in 1m3s
CD deploy main / deploy-main (push) Failing after 3s
CI Agent Skills / agent-skills-validate (push) Has been skipped
CI Create App / create-app-test (lint) (push) Has been skipped
CI Emails / emails-test (push) Has been skipped
CI Front / front-task (lingui:compile) (push) Has been skipped
CI Front / front-task (lint) (push) Has been skipped
CI Example App Postcard / example-app-postcard (push) Has been skipped
CI UI / ui-task (lint) (push) Has been skipped
CI UI / ui-task (pack-size) (push) Has been skipped
CI UI / ui-task (size) (push) Has been skipped
CI UI / ui-task (test) (push) Has been skipped
CI UI / ui-task (typecheck) (push) Has been skipped
CI Utils Test / utils-test (push) Has been skipped
CI Twenty Apps / ${{ matrix.app.name }} (push) Has been skipped
CI Emails / ci-emails-status-check (push) Successful in 2s
CI Example App Hello World / ci-example-app-hello-world-status-check (push) Successful in 2s
CI Example App Postcard / ci-example-app-postcard-status-check (push) Successful in 3s
CI UI / ui-sb-test (push) Has been skipped
CI Utils Test / ci-utils-test-status-check (push) Successful in 2s
CI Twenty Apps / ci-twenty-apps-status-check (push) Successful in 2s
CI UI / ci-ui-status-check (push) Successful in 2s
CI Desktop / desktop (push) Failing after 1m8s
Push docs to Crowdin / Push documentation to Crowdin (push) Failing after 55s
Push translations to Crowdin / Extract and upload translations (push) Failing after 5s
Push website translations to Crowdin / Extract and upload website translations (push) Failing after 5s
CI Create App / create-app-test (test) (push) Has been skipped
CI Create App / create-app-test (typecheck) (push) Has been skipped
CI Docs / docs-lint (push) Has been skipped
CI Example App Hello World / example-app-hello-world (push) Has been skipped
CI Front / front-task (lingui:extract) (push) Has been skipped
CI Front / front-task (test) (push) Has been skipped
CI Front / front-task (typecheck) (push) Has been skipped
CI UI / ui-sb-build (push) Failing after 1m32s
CI Twenty Apps / ${{ matrix.app.name }} (${{ matrix.server-source }}) (push) Has been skipped
CI Agent Skills / agent-skills-publish (push) Has been skipped
CI Create App / ci-create-app-status-check (push) Successful in 2s
CI Agent Skills / agent-skills-remote-source (push) Has been skipped
CI Create App E2E minimal / create-app-e2e-minimal (push) Has been cancelled
CI E2E Main / e2e-test (push) Has been cancelled
CI Front / front-sb-build (push) Has been cancelled
CI Front / front-build (push) Has been cancelled
CI Create App E2E minimal / ci-create-app-e2e-minimal-status-check (push) Has been cancelled
CI E2E Main / ci-e2e-main-status-check (push) Has been cancelled
CI E2E Main / notify-main-ci-failure (push) Has been cancelled
CI E2E Main / qa-scout-comment (push) Has been cancelled
CI Front / front-sb-test (push) Has been cancelled
CI Front / front-sb-screenshots (push) Has been cancelled
CI Front / ci-front-status-check (push) Has been cancelled
DPA Sub-Processor Sync / sync-subprocessors (push) Failing after 3s
AI Catalog Sync / sync-catalog (push) Failing after 2s
64 lines
3.5 KiB
Plaintext
64 lines
3.5 KiB
Plaintext
---
|
||
title: 脚手架
|
||
description: 通过 yarn twenty dev:add 以交互方式生成实体文件——对象、字段、视图、逻辑函数等。
|
||
icon: wand-magic-sparkles
|
||
---
|
||
|
||
无需手动创建实体文件,使用交互式脚手架:
|
||
|
||
```bash filename="Terminal"
|
||
yarn twenty dev:add
|
||
```
|
||
|
||
它会提示你选择一个实体类型,引导你填写所需字段,然后生成一个可直接使用的文件,其中包含稳定的 `universalIdentifier` 和正确的 `defineEntity()` 调用。
|
||
|
||
你也可以直接传入实体类型以跳过第一个提示:
|
||
|
||
```bash filename="Terminal"
|
||
yarn twenty dev:add object
|
||
yarn twenty dev:add logicFunction
|
||
yarn twenty dev:add frontComponent
|
||
```
|
||
|
||
## 可用的实体类型
|
||
|
||
| 实体类型 | 命令 | 生成的文件 |
|
||
| ------- | ------------------------------------------ | --------------------------------------------------------- |
|
||
| 对象 | `yarn twenty dev:add object` | `src/objects/\<name>.ts` |
|
||
| 字段 | `yarn twenty dev:add field` | `src/fields/\<name>.ts` |
|
||
| 逻辑函数 | `yarn twenty dev:add logicFunction` | `src/logic-functions/\<name>.ts` |
|
||
| 前端组件 | `yarn twenty dev:add frontComponent` | `src/front-components/\<name>.tsx` |
|
||
| 角色 | `yarn twenty dev:add role` | `src/roles/\<name>.ts` |
|
||
| 技能 | `yarn twenty dev:add skill` | `src/skills/\<name>.ts` |
|
||
| 代理 | `yarn twenty dev:add agent` | `src/agents/\<name>.ts` |
|
||
| 视图 | `yarn twenty dev:add view` | `src/views/\<name>.ts` |
|
||
| 导航菜单项 | `yarn twenty dev:add navigationMenuItem` | `src/navigation-menu-items/\<name>.ts` |
|
||
| 页面布局 | `yarn twenty dev:add pageLayout` | `src/page-layouts/\<name>.ts` |
|
||
| 页面布局选项卡 | `yarn twenty dev:add pageLayoutTab` | `src/page-layout-tabs/\<name>.ts` |
|
||
| 命令菜单项 | `yarn twenty dev:add commandMenuItem` | `src/command-menu-items/\<name>.ts` |
|
||
| 视图字段 | `yarn twenty dev:add viewField` | `src/view-fields/\<name>.ts` |
|
||
| 连接提供方 | `yarn twenty dev:add connectionProvider` | `src/connection-providers/\<name>.ts` |
|
||
| 时间线活动类型 | `yarn twenty dev:add timelineActivityType` | `src/timeline-activity-types/\<name>.ts` |
|
||
|
||
## 脚手架生成的内容
|
||
|
||
每种实体类型都有其自己的模板。 例如,`yarn twenty dev:add object` 会询问:
|
||
|
||
1. **名称(单数)**——例如,`invoice`
|
||
2. **名称(复数)**——例如,`invoices`
|
||
3. **标签(单数)**——根据名称自动填充(例如,`Invoice`)
|
||
4. **标签(复数)**——自动填充(例如,`Invoices`)
|
||
5. **创建视图和导航项?**——如果你选择是,脚手架还会为新对象生成相应的视图和侧边栏链接。
|
||
|
||
其他实体类型的提示更简单——大多只会询问名称。
|
||
|
||
`field` 实体类型更为详细:它会询问字段名称、标签、类型(从所有可用字段类型列表中选择,如 `TEXT`、`NUMBER`、`SELECT`、`RELATION` 等),以及目标对象的 `universalIdentifier`。
|
||
|
||
## 自定义输出路径
|
||
|
||
使用 `--path` 标志将生成的文件放置在自定义位置:
|
||
|
||
```bash filename="Terminal"
|
||
yarn twenty dev:add logicFunction --path src/custom-folder
|
||
```
|