概览
一旦你的应用已在本地构建并完成测试,你可以通过两种方式进行分发:- 部署 tar 包 — 直接将你的应用上传到特定的 Twenty 服务器,以供内部或私有使用。
- 发布到 npm — 将你的应用在 Twenty 应用市场上架,供任何工作区发现并安装。
构建你的应用
Run the build command to compile your app and generate a distribution-readymanifest.json:
.twenty/output/. Add --tarball to also produce a .tgz package for manual distribution or the deploy command.
部署到服务器(tar 包)
对于你不希望公开的应用(专有工具、仅供企业使用的集成或实验性构建),你可以将 tar 包直接部署到某台 Twenty 服务器。先决条件
在部署之前,你需要配置一个指向目标服务器的远程。 远程会将服务器 URL 和身份验证凭据本地存储在~/.twenty/config.json 中。
添加远程:
部署
一步构建并将你的应用上传到服务器:共享已部署的应用
通过 tar 包分发的应用不会出现在公共市场中,因此同一服务器上的其他工作区无法通过浏览发现它们。 要共享已部署的应用:- 前往 Settings > Applications > Registrations 并打开你的应用
- 在 Distribution 选项卡中,点击 Copy share link
- 将此链接分享给其他工作区的用户 — 它会将他们直接带到该应用的安装页面
版本管理
要发布更新:- 更新
package.json中的version字段 - Run
yarn twenty deploy(oryarn twenty deploy --remote production) - 已安装该应用的工作区会在其设置中看到可用的升级
发布到 npm
发布到 npm 可让你的应用在 Twenty 应用市场中被发现。 任何 Twenty 工作区都可以直接通过 UI 浏览、安装和升级应用市场中的应用。要求
- 一个 npm 账户
- The
twenty-appkeyword in yourpackage.jsonkeywordsarray (already included when you scaffold withcreate-twenty-app)
应用市场元数据
ThedefineApplication() config supports optional fields that control how your app appears in the marketplace. Use logoUrl and screenshots to reference images from the public/ folder:
src/application-config.ts
author, category, aboutDescription, websiteUrl, termsUrl, etc.).
Publish
beta 或 next)下发布:
应用市场的发现机制如何运作
The Twenty server syncs its marketplace catalog from the npm registry every hour. You can trigger the sync immediately instead of waiting:defineApplication() config — fields like displayName, description, author, category, logoUrl, screenshots, aboutDescription, websiteUrl, and termsUrl.
如果您的应用未在
defineApplication() 中定义 aboutDescription,市场将自动使用 npm 上您的软件包的 README.md 作为关于页面内容。 这意味着您可以为 npm 和 Twenty 市场维护同一个 README。 如果您希望在市场中使用不同的描述,请显式设置 aboutDescription。CI 发布
Use this GitHub Actions workflow to publish automatically on every release (uses OIDC):yarn install、yarn twenty build,然后在 .twenty/output 目录下执行 npm publish。
npm provenance 可选,但建议启用。 使用
--provenance 发布会在你的 npm 列表中添加可信徽章,使用户可以验证该包是由公共 CI 流水线中的特定提交构建的。 有关设置说明,请参见 npm provenance 文档。