部署 "创建预留定制"
了解如何将 Inventory 定制部署到 Order Hub SaaS 环境。 要了解有关部署过程的更多信息,请参阅 部署现有应用程序的定制。
过程
- 登录到 Order Hub。
- 切换到要在其中发布定制的租户。
- 转至 设置 > 配置 > 附加组件 > 定制配置。
- 记录下列值。
- 定制文件夹
- 将此值用作需要在 package-customization.json 中定义的用于打包定制的
customizatonContextRoot。 - 定制客户机标识
- 运行此命令以部署定制时,请将此值用作
client-id。 - 定制认证密钥
- 运行此命令以部署定制时,请将此值用作
client-secret。 仅当您首次设置租户时,才会显示认证密钥。 如果您不知道认证密钥,请单击 重新生成密钥。
- 编辑您定制的模块的根级别的 package-customization.json 文件。
- 由于您已定制 buc-app-inventory 模块,因此请打开 devtoolkit_docker/orderhub-code/buc-app-inventory/package-customization.json 文件。
- 使用您在步骤4 中检索到的自定义文件夹值更新 customizationContextRoot。
- 在 "路径" 部分中,包含您定制的 inventory-search-results 路径。例如,
{ "repositoryName": "buc-app-inventory", "customizationContextRoot": "/buc-app-customization/balohTK3ang5GmXsRwOSeSidbQOKEw6N", // replace this with the value you retrieved for customization folder "routes": { "inventory-search-results": { "type": "code" } } }
- 打开 buc-app-inventory/packages/inventory-search-results/package.json 文件。
- 在构建合并脚本中添加以下属性 --deploy-url=<customizationContextRoot>/buc-app-inventory/inventory-search-results。例如,
"build-merged": "ng build inventory-search-results --configuration=merged-prod --deploy-url=/buc-app-customization/balohTK3ang5GmXsRwOSeSidbQOKEw6N/buc-app-inventory/inventory-search-results/"注: 您需要更新构建合并脚本,因为您已定制现有模块。 - 在 devtoolkit_docker/packages/buc-app-inventory下创建 features.json 文件。由于未添加任何新路由 (仅定制现有 'inventory-search-results' 路由) ,因此请添加空数组。
[] - 打开终端并转至模块的根文件夹 devtoolkit_docker/orderhub-code/buc-app-inventory。
- 运行以下命令以构建用于部署的软件包。 此命令可能需要一些时间才能完成。
yarn package-customization - 运行以下命令以将定制部署到租户。
yarn orderhub-cli publish-customization --client-id=<clientId> --client-secret=<clientSecret> --package-name=buc-app-inventory注意 :如果发布自定义命令失败(例如,由于客户端密钥错误),您可以使用--publish-only=true /dist/buc-app-inventory.zip --package-name重新运行该命令。
有关使用 publish-customization 命令的更多信息,请参阅 为现有应用程序部署定制。yarn orderhub-cli publish-customization --client-id=<clientId> --client-secret=<clientSecret> --publish-only=true --package-name=./dist/buc-app-inventory.zip - 如果已将定制部署到 DEV 租户,请通过完成以下步骤断开与开发者工具箱的连接。 如果您已部署到其他租户,那么只需登录到该租户即可验证定制是否可用。
- 登录到 Order Hub。
- 转至 设置 > 定制。
- 单击 启用 OOB 模块定制。
- 将定制的模块设置为 OFF。
- 保存更改并重新装入机架。菜单将还原为没有 "(DEV MODE)" 的原始标签。 现在,您可以从 Order Hub (而不是开发者工具箱) 验证您的定制是否可用并呈现。