@ds-sfdc/sfparty (英语)
为什么用sfparty?
销售力元数据一般被存储在大型的XML文件中,这需要一定的努力来配合. 这些XML文件很难读取,对diff具有挑战性,在合并时可能导致冲突并被腐蚀出XML. sfparty是一种通过将销售力元数据XML文件分拆为更小的YAML或JSON部分来改进开发者和DevOps体验的功能. 这样就更容易理解和管理元数据,消除了发生冲突和腐败的XML的风险. 此外,sfparty将这些部分重新组合到XML文件中的能力使得它成为CI/CD需求的理想解决方案. 它可以方便地进行版本控制和精简部署程序.
安装
npm i -g @ds-sfdc/sfparty
国家预防机制安装问题
command not found: sfparty
sfparti是一个可执行文件,意在全球安装.
EACCESS: permission denied
关于如何解决国家预防机制的EACCESS问题,有若干备选方案。 使用最简单的方式 sudo
sudo npm i -g @ds-sfdc/sfparty
取决于你的系统,你可能会有一些问题 安装sfpart 使用国家预防机制。 这些通常是文件系统权限问题. 这里与各种条款有一些联系,就如何解决这一问题提出了建议.
修复 npm 权限问题
总是使用 sudo 安装全局软件包
使用 npm 配置而不是使用 chown 或 chmod
图标
分开
sfparty split
组合
sfparty combine
更新
sfparty update
选项
-y, --type type(s) of metadata to process
-n, --name name of metadata file
-f, --format format to use yaml (default) or json
-s, --source package directory path specified in sfdx-project.json
-t, --target target path to directory to create yaml/json files
-g, --git combine files based on git commits
-h, --help Show help
-v, --version Show version
组合选项
使用组合命令时有下列选项:
gi
-g, --git process files based on git commits. This option does not require a value.
Git 选项
使用组合命令时有下列选项:
-a, --append append package and destructive package instead of overwriting.
-l, --delta when possible create delta metadata files for CI/CD deployment.
-p, --package path to your change package XML file.
-x, --destructive path to your destructive change package XML file.
实例
自定义标签
sfparty split --type=label
权限设置
sfparty split --type=permset
sfparty split --type=permset --name="My Permission Set"
简介
sfparty split --type=profile
sfparty split --type=profile --name="My Profile"
工作流程
sfparty split --type=workflow
sfparty split --type=workflow --name="Workflow"
多种类型
sfparty split --type="workflow,label"
源目录
源目录将使用 sfdx- project.json 文件所指定的您的默认包文件夹, 因此必须从您的 Salesforce 项目目录中执行 。 如果主/ 默认文件夹不存在, 它将创建它们 .
{
"packageDirectories": [
{
"path": "force-app",
"default": true
},
{
"path": "my-package"
}
],
"namespace": "",
"sfdcLoginUrl": "https://login.salesforce.com",
"sourceApiVersion": "56.0"
}
sfparty split --source="my-package"
目标目录
源目录将使用 sfdx- project.json 文件中规定的您的默认包文件夹, 以及附件 -party 最终。 例如,如果默认源路径是 force-app,则默认目标目录将是 force-app-party 除非另有说明。 目标不需要在 sfdx- project.json 中指定,但是合并命令不会在 sfdx-project.json 中没有指定的文件夹上工作.
sfparty split --target="test"
胡斯基·吉特·胡克斯
如果您使用 Git 钩工具, 如 husky,可以添加后置钩来自动运行 combine 当执行时命令 merge 或者说 git pull 命令.
发生后
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
sfparty combine --git
排雷中心/发改委
sfparti是用于补充您的 CI/CD 进程。 你的管道应该已经建成了 package.xml 财务报告和审定财务报表 destructiveChanges.xml当sfparty运行时,它会做一个 git diff 并附加文件的更改。 你可以使用一个工具,比如 sfdx- git- 德尔塔 以建立 包.
Command:
sfparty combine --git
Required:
-g, --git process files based on git commits. This option does not require a value.
Optional:
-a, --append append package and destructive package instead of overwriting.
-l, --delta when possible create delta metadata files for CI/CD deployment.
-p, --package path to your change package XML file.
-x, --destructive path to your destructive change package XML file.
示例
上一个提交当前
sfparty combine --git=HEAD~1..HEAD --append --delta --package=deploy/package.xml --destructive=deploy/destructiveChanges/destructiveChanges.xml
上一个承诺当前并输出到不同的目标目录
默认目标是在 sfdx-project.json 文档。 你可以用这个 --target 如果您想要在另一个位置创建文件,则参数。 sfparty将相应创建/main/default/*目录.
sfparty combine --git=HEAD~1..HEAD --append --delta --package=deploy/package.xml --destructive=deploy/destructiveChanges/destructiveChanges.xml --target=deployDir/force-app