diff --git a/.github/linters/.cspell.json b/.github/linters/.cspell.json index 0844c443e..1461f35d3 100644 --- a/.github/linters/.cspell.json +++ b/.github/linters/.cspell.json @@ -113,6 +113,7 @@ "MASTERLABEL", "MYFOLDER", "MYREPORTNAME", + "MYSTATUS", "MYTASK", "Metadatas", "NOPMD", @@ -219,6 +220,7 @@ "accordioninstance", "accordionlinter", "accordionlist", + "accordionmerge", "accordionmonitoring", "accordionms", "accordionnotifications", diff --git a/CHANGELOG.md b/CHANGELOG.md index 90467f040..00634844a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,14 @@ Note: Can be used with `sfdx plugins:install sfdx-hardis@beta` and docker image `hardisgroupcom/sfdx-hardis@beta` +## [5.15.5] 2025-01-16 + +- Flow Visual Diff enhancements + - Display full node fields table when it contains updated elements + - Fix removed long links + - Handle cases where Flow has been added or deleted +- Update [hardis:project:deploy:notify](https://sfdx-hardis.cloudity.com/hardis/project/deploy/notify/) documentation + ## [5.15.4] 2025-01-15 - Allow to disable calls to AI prompts API using DISABLE_AI=true diff --git a/docs/commands.md b/docs/commands.md index d27150423..b6c222024 100644 --- a/docs/commands.md +++ b/docs/commands.md @@ -32,9 +32,11 @@ |:----------------------------------------------------------------------------|:------| | [**hardis:doc:extract:permsetgroups**](hardis/doc/extract/permsetgroups.md) | | | [**hardis:doc:flow2markdown**](hardis/doc/flow2markdown.md) | | +| [**hardis:doc:mkdocs-to-salesforce**](hardis/doc/mkdocs-to-salesforce.md) | | | [**hardis:doc:packagexml2markdown**](hardis/doc/packagexml2markdown.md) | | | [**hardis:doc:plugin:generate**](hardis/doc/plugin/generate.md) | | | [**hardis:doc:project2markdown**](hardis/doc/project2markdown.md) | | +| [**hardis:doc:project2markdown copy**](hardis/doc/project2markdown copy.md) | | ## hardis:git diff --git a/docs/hardis/doc/flow2markdown.md b/docs/hardis/doc/flow2markdown.md index 83cec91c4..7ed792d5b 100644 --- a/docs/hardis/doc/flow2markdown.md +++ b/docs/hardis/doc/flow2markdown.md @@ -4,6 +4,9 @@ ## Description Generates a markdown documentation from a Flow file + +If [AI integration](https://sfdx-hardis.cloudity.com/salesforce-ai-setup/) is configured, documentation will contain a summary of the Flow. + ## Parameters diff --git a/docs/hardis/doc/mkdocs-to-salesforce.md b/docs/hardis/doc/mkdocs-to-salesforce.md new file mode 100644 index 000000000..5c8305ba8 --- /dev/null +++ b/docs/hardis/doc/mkdocs-to-salesforce.md @@ -0,0 +1,43 @@ + +# hardis:doc:mkdocs-to-salesforce + +## Description + +Generates MkDocs HTML pages and upload them to Salesforce as a static resource + +This command performs the following operations: + +- Generates MkDocs HTML pages (using locally installed mkdocs-material, or using mkdocs docker image) +- Creates a Static Resource, a VisualForce page and a Custom Tab metadata +- Upload the metadatas to the default org +- Opens the Custom Tab in the default browser (only if not in CI context) + +Note: the documentation must have been previously generated using "sf hardis:doc:project2markdown --with-history" + +You can: + +- Specify the type of documentation to generate (CICD or Monitoring) using the --type flag. Default is CICD. +- Override default styles by customizing mkdocs.yml + +More info on [Documentation section](https://sfdx-hardis.cloudity.com/salesforce-project-documentation/) + + +## Parameters + +| Name | Type | Description | Default | Required | Options | +|:------------------|:-------:|:--------------------------------------------------------------|:-------:|:--------:|:-------------------:| +| debug
-d | boolean | Activate debug mode (more logs) | | | | +| flags-dir | option | undefined | | | | +| json | boolean | Format output as json. | | | | +| skipauth | boolean | Skip authentication check when a default username is required | | | | +| target-org
-o | option | undefined | | | | +| type
-t | option | Type of the documentation to generate. Default is "all" | CICD | | CICD
Monitoring | +| websocket | option | Websocket host:port for VsCode SFDX Hardis UI integration | | | | + +## Examples + +```shell +sf hardis:doc:mkdocs-to-salesforce +``` + + diff --git a/docs/hardis/doc/packagexml2markdown.md b/docs/hardis/doc/packagexml2markdown.md index 8c5136481..990441c08 100644 --- a/docs/hardis/doc/packagexml2markdown.md +++ b/docs/hardis/doc/packagexml2markdown.md @@ -15,6 +15,7 @@ Generates a markdown documentation from a package.xml file | json | boolean | Format output as json. | | | | | outputfile
-f | option | Force the path and name of output report file. Must end with .md | | | | | skipauth | boolean | Skip authentication check when a default username is required | | | | +| target-org
-o | option | undefined | | | | | websocket | option | Websocket host:port for VsCode SFDX Hardis UI integration | | | | ## Examples diff --git a/docs/hardis/doc/project2markdown copy.md b/docs/hardis/doc/project2markdown copy.md new file mode 100644 index 000000000..d1c06e6d4 --- /dev/null +++ b/docs/hardis/doc/project2markdown copy.md @@ -0,0 +1,74 @@ + +# hardis:doc:project2markdown copy + +## Description + +Generates a markdown documentation from a SFDX project + +- Package.xml files +- Source Packages +- sfdx-hardis configuration +- Installed packages + +Can work on any sfdx project, no need for it to be a sfdx-hardis flavored one. + +Generates markdown files will be written in **docs** folder (except README.md where a link to doc index is added) + +To read Flow documentations if your markdown reader doesn't handle MermaidJS syntax, this command could require @mermaid-js/mermaid-cli + +- Run `npm install @mermaid-js/mermaid-cli --global` if puppeteer works in your environment +- It can also be run as a docker image + +Both modes will be tried by default, but you can also force one of them by defining environment variable `MERMAID_MODES=docker` or `MERMAID_MODES=cli` + +_sfdx-hardis docker image is alpine-based and does not succeed to run mermaid/puppeteer: if you can help, please submit a PR !_ + +If Flow history doc always display a single state, you probably need to update your workflow configuration: + +- on Gitlab: Env variable [`GIT_FETCH_EXTRA_FLAGS: --depth 10000`](https://github.com/hardisgroupcom/sfdx-hardis/blob/main/defaults/monitoring/.gitlab-ci.yml#L11) +- on GitHub: [`fetch-depth: 0`](https://github.com/hardisgroupcom/sfdx-hardis/blob/main/defaults/monitoring/.github/workflows/org-monitoring.yml#L58) +- on Azure: [`fetchDepth: "0"`](https://github.com/hardisgroupcom/sfdx-hardis/blob/main/defaults/monitoring/azure-pipelines.yml#L39) +- on Bitbucket: [`step: clone: depth: full`](https://github.com/hardisgroupcom/sfdx-hardis/blob/main/defaults/monitoring/bitbucket-pipelines.yml#L18) + +![Screenshot flow doc](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/screenshot-flow-doc.jpg) + +![Screenshot project documentation](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/screenshot-project-doc.jpg) + +![Screenshot project documentation](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/screenshot-project-doc-2.jpg) + +## Doc HTML Pages + +To read the documentation as HTML pages, run the following code (you need [**Python**](https://www.python.org/downloads/) on your computer) + +```python +pip install mkdocs-material mdx_truly_sane_lists +mkdocs serve +``` + +To just generate HTML pages that you can host anywhere, run `mkdocs build` + + + +## Parameters + +| Name | Type | Description | Default | Required | Options | +|:-------------|:-------:|:--------------------------------------------------------------------|:-------:|:--------:|:-------:| +| debug
-d | boolean | Activate debug mode (more logs) | | | | +| diff-only | boolean | Generate documentation only for changed files (used for monitoring) | | | | +| flags-dir | option | undefined | | | | +| json | boolean | Format output as json. | | | | +| skipauth | boolean | Skip authentication check when a default username is required | | | | +| websocket | option | Websocket host:port for VsCode SFDX Hardis UI integration | | | | +| with-history | boolean | Generate a markdown file with the history diff of the Flow | | | | + +## Examples + +```shell +sf hardis:doc:project2markdown +``` + +```shell +sf hardis:doc:project2markdown --with-history +``` + + diff --git a/docs/hardis/doc/project2markdown.md b/docs/hardis/doc/project2markdown.md index 7d11d9f2b..5997e134a 100644 --- a/docs/hardis/doc/project2markdown.md +++ b/docs/hardis/doc/project2markdown.md @@ -36,30 +36,39 @@ If Flow history doc always display a single state, you probably need to update y ![Screenshot project documentation](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/screenshot-project-doc-2.jpg) +If it is a sfdx-hardis CI/CD project, a diagram of the branches and orgs strategy will be generated. + +![](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/screenshot-doc-branches-strategy.jpg) + +If [AI integration](https://sfdx-hardis.cloudity.com/salesforce-ai-setup/) is configured, documentation will contain a summary of the Flow. + +If you have a complex strategy, you might need to input property **mergeTargets** in branch-scoped sfdx-hardis.yml file to have a correct diagram. + ## Doc HTML Pages -To read the documentation as HTML pages, run the following code (you need python on your computer) +To read the documentation as HTML pages, run the following code (you need [**Python**](https://www.python.org/downloads/) on your computer) ```python -pip install mkdocs-material mdx_truly_sane_lists -mkdocs serve +pip install mkdocs-material mdx_truly_sane_lists || python -m pip install mkdocs-material mdx_truly_sane_lists || py -m pip install mkdocs-material mdx_truly_sane_lists +mkdocs serve || python -m mkdocs serve || py -m mkdocs serve ``` -To just generate HTML pages that you can host anywhere, run `mkdocs build` +To just generate HTML pages that you can host anywhere, run `mkdocs build || python -m mkdocs build || py -m mkdocs build` ## Parameters -| Name | Type | Description | Default | Required | Options | -|:-------------|:-------:|:--------------------------------------------------------------------|:-------:|:--------:|:-------:| -| debug
-d | boolean | Activate debug mode (more logs) | | | | -| diff-only | boolean | Generate documentation only for changed files (used for monitoring) | | | | -| flags-dir | option | undefined | | | | -| json | boolean | Format output as json. | | | | -| skipauth | boolean | Skip authentication check when a default username is required | | | | -| websocket | option | Websocket host:port for VsCode SFDX Hardis UI integration | | | | -| with-history | boolean | Generate a markdown file with the history diff of the Flow | | | | +| Name | Type | Description | Default | Required | Options | +|:------------------|:-------:|:--------------------------------------------------------------------|:-------:|:--------:|:-------:| +| debug
-d | boolean | Activate debug mode (more logs) | | | | +| diff-only | boolean | Generate documentation only for changed files (used for monitoring) | | | | +| flags-dir | option | undefined | | | | +| json | boolean | Format output as json. | | | | +| skipauth | boolean | Skip authentication check when a default username is required | | | | +| target-org
-o | option | undefined | | | | +| websocket | option | Websocket host:port for VsCode SFDX Hardis UI integration | | | | +| with-history | boolean | Generate a markdown file with the history diff of the Flow | | | | ## Examples diff --git a/docs/hardis/org/monitor/backup.md b/docs/hardis/org/monitor/backup.md index 038dfd1df..fc5da8cc2 100644 --- a/docs/hardis/org/monitor/backup.md +++ b/docs/hardis/org/monitor/backup.md @@ -38,6 +38,8 @@ This command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.co [Doc generation (including visual flows)](https://sfdx-hardis.cloudity.com/hardis/doc/project2markdown/) is triggered at the end of the command. +If you want to also upload HTML Documentation on your Salesforce Org as static resource, use variable **SFDX_HARDIS_DOC_DEPLOY_TO_ORG="true"** + If Flow history doc always display a single state, you probably need to update your workflow configuration: - on Gitlab: Env variable [`GIT_FETCH_EXTRA_FLAGS: --depth 10000`](https://github.com/hardisgroupcom/sfdx-hardis/blob/main/defaults/monitoring/.gitlab-ci.yml#L11) diff --git a/docs/hardis/org/user/activateinvalid.md b/docs/hardis/org/user/activateinvalid.md index fe3ccbf80..df3ec1e7b 100644 --- a/docs/hardis/org/user/activateinvalid.md +++ b/docs/hardis/org/user/activateinvalid.md @@ -31,11 +31,11 @@ sf hardis:org:user:activateinvalid ``` ```shell -sf hardis:org:user:activateinvalid --target-org myuser@myorg.com +sf hardis:org:user:activateinvalid --target-org my-user@myorg.com ``` ```shell -sf hardis:org:user:activateinvalid --profiles 'System Administrator,MyCustomProfile' --target-org myuser@myorg.com +sf hardis:org:user:activateinvalid --profiles 'System Administrator,MyCustomProfile' --target-org my-user@myorg.com ``` diff --git a/docs/hardis/org/user/freeze.md b/docs/hardis/org/user/freeze.md index f76bc21f0..5cf994735 100644 --- a/docs/hardis/org/user/freeze.md +++ b/docs/hardis/org/user/freeze.md @@ -33,7 +33,7 @@ sf hardis:org:user:freeze ``` ```shell -sf hardis:org:user:freeze --target-org myuser@myorg.com +sf hardis:org:user:freeze --target-org my-user@myorg.com ``` ```shell diff --git a/docs/hardis/org/user/unfreeze.md b/docs/hardis/org/user/unfreeze.md index 1bedc639f..01db84e3e 100644 --- a/docs/hardis/org/user/unfreeze.md +++ b/docs/hardis/org/user/unfreeze.md @@ -33,7 +33,7 @@ sf hardis:org:user:unfreeze ``` ```shell -sf hardis:org:user:unfreeze --target-org myuser@myorg.com +sf hardis:org:user:unfreeze --target-org my-user@myorg.com ``` ```shell diff --git a/docs/hardis/project/audit/apiversion.md b/docs/hardis/project/audit/apiversion.md index ce4534776..ed6b6b6b6 100644 --- a/docs/hardis/project/audit/apiversion.md +++ b/docs/hardis/project/audit/apiversion.md @@ -3,19 +3,28 @@ ## Description -Audit API version +This command detects metadatas whose apiVersion is lower than parameter --minimumapiversion + + It can also fix the apiVersions with the latest one, if parameter --fix is sent + + Example to handle [ApexClass / Trigger & ApexPage mandatory version upgrade](https://help.salesforce.com/s/articleView?id=sf.admin_locales_update_api.htm&type=5) : + + `sf hardis:project:audit:apiversion --metadatatype ApexClass,ApexTrigger,ApexPage --minimumapiversion 45.0 --fix` + ## Parameters -| Name | Type | Description | Default | Required | Options | -|:-------------------------|:-------:|:--------------------------------------------------------------|:-------:|:--------:|:-------:| -| debug
-d | boolean | Activate debug mode (more logs) | | | | -| failiferror
-f | boolean | Fails (exit code 1) if an error is found | | | | -| flags-dir | option | undefined | | | | -| json | boolean | Format output as json. | | | | -| minimumapiversion
-m | option | Minimum allowed API version | 20 | | | -| skipauth | boolean | Skip authentication check when a default username is required | | | | -| websocket | option | Websocket host:port for VsCode SFDX Hardis UI integration | | | | +| Name | Type | Description | Default | Required | Options | +|:-------------------------|:-------:|:---------------------------------------------------------------------------------------------------|:-------:|:--------:|:-------:| +| debug
-d | boolean | Activate debug mode (more logs) | | | | +| failiferror
-f | boolean | Fails (exit code 1) if an error is found | | | | +| fix | boolean | Fix ApiVersion on specified Metadata Types. | | | | +| flags-dir | option | undefined | | | | +| json | boolean | Format output as json. | | | | +| metadatatype | option | Metadata Types to fix. Comma separated. Supported Metadata types: ApexClass, ApexTrigger, ApexPage | | | | +| minimumapiversion
-m | option | Minimum allowed API version | 20 | | | +| skipauth | boolean | Skip authentication check when a default username is required | | | | +| websocket | option | Websocket host:port for VsCode SFDX Hardis UI integration | | | | ## Examples @@ -23,4 +32,12 @@ Audit API version sf hardis:project:audit:apiversion ``` +```shell +sf hardis:project:audit:apiversion --metadatatype ApexClass,ApexTrigger,ApexPage --minimumapiversion 45 +``` + +```shell +sf hardis:project:audit:apiversion --metadatatype ApexClass,ApexTrigger,ApexPage --minimumapiversion 45 --fix +``` + diff --git a/docs/hardis/project/deploy/notify.md b/docs/hardis/project/deploy/notify.md index ffb1bd65d..a90d0e10e 100644 --- a/docs/hardis/project/deploy/notify.md +++ b/docs/hardis/project/deploy/notify.md @@ -5,19 +5,72 @@ Post notifications related to: -- Deployment simulation -- Deployment process +- **Deployment simulation** _(use with --check-only)_ - According to the [integrations you configured](https://sfdx-hardis.cloudity.com/salesforce-ci-cd-setup-integrations-home/), notifications can contain deployment information and [Flow Visual Git Diff](https://sfdx-hardis.cloudity.com/salesforce-deployment-assistant-home/#flow-visual-git-diff) +- **Deployment process** _(to call only if your deployment is successful)_ + +### Integrations + +According to the [integrations you configured](https://sfdx-hardis.cloudity.com/salesforce-ci-cd-setup-integrations-home/), notifications can contain deployment information and [Flow Visual Git Diff](https://sfdx-hardis.cloudity.com/salesforce-deployment-assistant-home/#flow-visual-git-diff) + +- GitHub, Gitlab, Azure DevOps, Bitbucket comments on Pull Requests (including Flows Visual Git Diff) + +- Slack, Microsoft Teams, Email deployment summary after a successful deployment -- GitHub, Gitlab, Azure DevOps, Bitbucket comments on Pull Requests -- Slack, Microsoft Teams, Email deployment summary - JIRA tags and comments on tickets that just has been deployed - This command is for custom SF Cli pipelines, if you are a sfdx-hardis user, it is already embedded in sf hardis:deploy:smart. +![](https://sfdx-hardis.cloudity.com/assets/images/screenshot-jira-gitlab.jpg) + +![](https://sfdx-hardis.cloudity.com/assets/images/screenshot-jira-slack.jpg) + +### Flows Visual Git Diff + +- Visually show you the differences on a diagram + +- Display the update details without having to open any XML ! + +🟩 = added + +🟥 = removed + +🟧 = updated + +![](https://sfdx-hardis.cloudity.com/assets/images/flow-visual-git-diff.jpg) + +![](https://sfdx-hardis.cloudity.com/assets/images/flow-visual-git-diff-2.jpg) + +### In custom CI/CD workflow + +Example of usage in a custom CI/CD pipeline: + +```bash +# Disable exit-on-error temporarily +set +e + +# Run the deploy command +sf project deploy start [....] +RET_CODE=$? + +# Re-enable exit-on-error +set -e + +# Determine MYSTATUS based on return code +if [ $RET_CODE -eq 0 ]; then + MYSTATUS="valid" +else + MYSTATUS="invalid" +fi + +# Run the notify command with MYSTATUS +sf hardis:project:deploy:notify --check-only --deploy-status "$MYSTATUS" +``` + +### Other usages + +This command is for custom SF Cli pipelines, if you are a sfdx-hardis user, it is already embedded in sf hardis:deploy:smart. + +You can also use [sfdx-hardis wrapper commands of SF deployment commands](https://sfdx-hardis.cloudity.com/salesforce-deployment-assistant-setup/#using-custom-cicd-pipeline) - You can also use [sfdx-hardis wrapper commands of SF deployment commands](https://sfdx-hardis.cloudity.com/salesforce-deployment-assistant-setup/#using-custom-cicd-pipeline) - ## Parameters diff --git a/docs/hardis/project/deploy/smart.md b/docs/hardis/project/deploy/smart.md index b49d3798f..0973969d3 100644 --- a/docs/hardis/project/deploy/smart.md +++ b/docs/hardis/project/deploy/smart.md @@ -258,4 +258,8 @@ SYSTEM_ACCESSTOKEN=xxxxxx SYSTEM_COLLECTIONURI=https://dev.azure.com/xxxxxxx/ SY CI_SFDX_HARDIS_BITBUCKET_TOKEN=xxxxxx BITBUCKET_WORKSPACE=sfdxhardis-demo BITBUCKET_REPO_SLUG=test BITBUCKET_BUILD_NUMBER=1 BITBUCKET_BRANCH=uat BITBUCKET_PR_ID=2 FORCE_TARGET_BRANCH=uat NODE_OPTIONS=--inspect-brk sf hardis:project:deploy:smart --check --websocket localhost:2702 --skipauth --target-org my-salesforce-org@client.com ``` +```shell +GITHUB_TOKEN=xxxx GITHUB_REPOSITORY=my-user/my-repo FORCE_TARGET_BRANCH=uat NODE_OPTIONS=--inspect-brk sf hardis:project:deploy:smart --check --websocket localhost:2702 --skipauth --target-org my-salesforce-org@client.com +``` + diff --git a/docs/hardis/project/deploy/sources/dx.md b/docs/hardis/project/deploy/sources/dx.md index 0da6a1ed2..5fee7e736 100644 --- a/docs/hardis/project/deploy/sources/dx.md +++ b/docs/hardis/project/deploy/sources/dx.md @@ -258,4 +258,8 @@ SYSTEM_ACCESSTOKEN=xxxxxx SYSTEM_COLLECTIONURI=https://dev.azure.com/xxxxxxx/ SY CI_SFDX_HARDIS_BITBUCKET_TOKEN=xxxxxx BITBUCKET_WORKSPACE=sfdxhardis-demo BITBUCKET_REPO_SLUG=test BITBUCKET_BUILD_NUMBER=1 BITBUCKET_BRANCH=uat BITBUCKET_PR_ID=2 FORCE_TARGET_BRANCH=uat NODE_OPTIONS=--inspect-brk sf hardis:project:deploy:smart --check --websocket localhost:2702 --skipauth --target-org my-salesforce-org@client.com ``` +```shell +GITHUB_TOKEN=xxxx GITHUB_REPOSITORY=my-user/my-repo FORCE_TARGET_BRANCH=uat NODE_OPTIONS=--inspect-brk sf hardis:project:deploy:smart --check --websocket localhost:2702 --skipauth --target-org my-salesforce-org@client.com +``` + diff --git a/docs/hardis/project/generate/flow-git-diff.md b/docs/hardis/project/generate/flow-git-diff.md index fe2be25d0..31a314e53 100644 --- a/docs/hardis/project/generate/flow-git-diff.md +++ b/docs/hardis/project/generate/flow-git-diff.md @@ -5,21 +5,23 @@ Generate Flow Visual Git Diff markdown between 2 commits -This command requires @mermaid-js/mermaid-cli to be installed. +Note: This command might requires @mermaid-js/mermaid-cli to be installed. Run `npm install @mermaid-js/mermaid-cli --global` ## Parameters -| Name | Type | Description | Default | Required | Options | -|:-------------|:-------:|:--------------------------------------------------------------|:-------:|:--------:|:-------:| -| debug
-d | boolean | Activate debug mode (more logs) | | | | -| flags-dir | option | undefined | | | | -| flow | option | Path to flow file (will be prompted if not set) | | | | -| json | boolean | Format output as json. | | | | -| skipauth | boolean | Skip authentication check when a default username is required | | | | -| websocket | option | Websocket host:port for VsCode SFDX Hardis UI integration | | | | +| Name | Type | Description | Default | Required | Options | +|:--------------|:-------:|:--------------------------------------------------------------------------------------------|:-------:|:--------:|:-------:| +| commit-after | option | Hash of the commit of the new flow state (will be prompted if not set) | | | | +| commit-before | option | Hash of the commit of the previous flow state, or "allStates" (will be prompted if not set) | | | | +| debug
-d | boolean | Activate debug mode (more logs) | | | | +| flags-dir | option | undefined | | | | +| flow | option | Path to flow file (will be prompted if not set) | | | | +| json | boolean | Format output as json. | | | | +| skipauth | boolean | Skip authentication check when a default username is required | | | | +| websocket | option | Websocket host:port for VsCode SFDX Hardis UI integration | | | | ## Examples @@ -27,4 +29,8 @@ Run `npm install @mermaid-js/mermaid-cli --global` sf hardis:project:generate:flow-git-diff ``` +```shell +sf hardis:project:generate:flow-git-diff --flow "force-app/main/default/flows/Opportunity_AfterUpdate_Cloudity.flow-meta.xml" --commit-before 8bd290e914c9dbdde859dad7e3c399776160d704 --commit-after e0835251bef6e400fb91e42f3a31022f37840f65 +``` + diff --git a/docs/index.md b/docs/index.md index 9a2093750..ad1f49bc9 100644 --- a/docs/index.md +++ b/docs/index.md @@ -27,11 +27,16 @@ It will allow you to: - Do with simple commands what could be done manually in minutes/hours - [Define a **ready to use CI/CD Pipeline** for your Salesforce project](https://sfdx-hardis.cloudity.com/salesforce-ci-cd-home/) - [**Backup Metadatas** and **monitor any Salesforce org**](https://sfdx-hardis.cloudity.com/salesforce-monitoring-home/) +- [Generate your **project documentation**](https://sfdx-hardis.cloudity.com/salesforce-project-documentation/), including AI-generated description and Flow Visual History [_Please see the full list of commands in Online documentation_](https://sfdx-hardis.cloudity.com) ___ +Watch sfdx-hardis 2025 new features :) + +[![sfdx-hardis 2025 new features](https://img.youtube.com/vi/JRKH5COUVQ0/0.jpg)](https://youtu.be/JRKH5COUVQ0) + **sfdx-hardis** commands are also available with UI in [**SFDX Hardis Visual Studio Code Extension**](https://marketplace.visualstudio.com/items?itemName=NicolasVuillamy.vscode-sfdx-hardis) [![VsCode SFDX Hardis](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/extension-demo.gif)](https://marketplace.visualstudio.com/items?itemName=NicolasVuillamy.vscode-sfdx-hardis) @@ -189,9 +194,11 @@ Everyone is welcome to contribute to sfdx-hardis (even juniors: we'll assist you |:----------------------------------------------------------------------------|:------| | [**hardis:doc:extract:permsetgroups**](hardis/doc/extract/permsetgroups.md) | | | [**hardis:doc:flow2markdown**](hardis/doc/flow2markdown.md) | | +| [**hardis:doc:mkdocs-to-salesforce**](hardis/doc/mkdocs-to-salesforce.md) | | | [**hardis:doc:packagexml2markdown**](hardis/doc/packagexml2markdown.md) | | | [**hardis:doc:plugin:generate**](hardis/doc/plugin/generate.md) | | | [**hardis:doc:project2markdown**](hardis/doc/project2markdown.md) | | +| [**hardis:doc:project2markdown copy**](hardis/doc/project2markdown copy.md) | | ### hardis:git diff --git a/docs/schema/sfdx-hardis-json-schema-parameters.html b/docs/schema/sfdx-hardis-json-schema-parameters.html index e3e404816..ed9a41bd5 100644 --- a/docs/schema/sfdx-hardis-json-schema-parameters.html +++ b/docs/schema/sfdx-hardis-json-schema-parameters.html @@ -4085,6 +4085,78 @@

+
+
+
+

+ +

+
+ +
+
+ +

Merge target branches

Type: array of string
+

In branch-scoped config file, declares the list of branches that the current one can have as merge target. For example, integration will have mergeTargets [uat]

+
+ + + + + + No Additional Items

Each item of this array must be:

+
+
+ + + Type: string
+ + + + + + + +
+

+
Examples:
+
[
+    "preprod"
+]
+
+
[
+    "integration"
+]
+
+
+
+
+
+
@@ -5863,6 +5935,6 @@

\ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index a2c759055..004186ce3 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -175,10 +175,12 @@ nav: extract: permsetgroups: hardis/doc/extract/permsetgroups.md flow2markdown: hardis/doc/flow2markdown.md + mkdocs-to-salesforce: hardis/doc/mkdocs-to-salesforce.md packagexml2markdown: hardis/doc/packagexml2markdown.md plugin: generate: hardis/doc/plugin/generate.md project2markdown: hardis/doc/project2markdown.md + project2markdown copy: hardis/doc/project2markdown copy.md git: pull-requests: extract: hardis/git/pull-requests/extract.md diff --git a/src/commands/hardis/project/deploy/notify.ts b/src/commands/hardis/project/deploy/notify.ts index e55dc432d..89fe7fde6 100644 --- a/src/commands/hardis/project/deploy/notify.ts +++ b/src/commands/hardis/project/deploy/notify.ts @@ -16,19 +16,72 @@ export default class DeployNotify extends SfCommand { public static description = `Post notifications related to: - - **Deployment simulation** _(use with --check-only)_ - - **Deployment process** _(to call only if your deployment is successful)_ +- **Deployment simulation** _(use with --check-only)_ - According to the [integrations you configured](${CONSTANTS.DOC_URL_ROOT}/salesforce-ci-cd-setup-integrations-home/), notifications can contain deployment information and [Flow Visual Git Diff](${CONSTANTS.DOC_URL_ROOT}/salesforce-deployment-assistant-home/#flow-visual-git-diff) +- **Deployment process** _(to call only if your deployment is successful)_ + +### Integrations + +According to the [integrations you configured](${CONSTANTS.DOC_URL_ROOT}/salesforce-ci-cd-setup-integrations-home/), notifications can contain deployment information and [Flow Visual Git Diff](${CONSTANTS.DOC_URL_ROOT}/salesforce-deployment-assistant-home/#flow-visual-git-diff) - GitHub, Gitlab, Azure DevOps, Bitbucket comments on Pull Requests (including Flows Visual Git Diff) + - Slack, Microsoft Teams, Email deployment summary after a successful deployment + - JIRA tags and comments on tickets that just has been deployed - This command is for custom SF Cli pipelines, if you are a sfdx-hardis user, it is already embedded in sf hardis:deploy:smart. +![](${CONSTANTS.DOC_URL_ROOT}/assets/images/screenshot-jira-gitlab.jpg) + +![](${CONSTANTS.DOC_URL_ROOT}/assets/images/screenshot-jira-slack.jpg) + +### Flows Visual Git Diff + +- Visually show you the differences on a diagram + +- Display the update details without having to open any XML ! + +🟩 = added + +🟥 = removed + +🟧 = updated + +![](${CONSTANTS.DOC_URL_ROOT}/assets/images/flow-visual-git-diff.jpg) + +![](${CONSTANTS.DOC_URL_ROOT}/assets/images/flow-visual-git-diff-2.jpg) + +### In custom CI/CD workflow + +Example of usage in a custom CI/CD pipeline: + +\`\`\`bash +# Disable exit-on-error temporarily +set +e + +# Run the deploy command +sf project deploy start [....] +RET_CODE=$? + +# Re-enable exit-on-error +set -e + +# Determine MYSTATUS based on return code +if [ $RET_CODE -eq 0 ]; then + MYSTATUS="valid" +else + MYSTATUS="invalid" +fi + +# Run the notify command with MYSTATUS +sf hardis:project:deploy:notify --check-only --deploy-status "$MYSTATUS" +\`\`\` + +### Other usages + +This command is for custom SF Cli pipelines, if you are a sfdx-hardis user, it is already embedded in sf hardis:deploy:smart. - You can also use [sfdx-hardis wrapper commands of SF deployment commands](${CONSTANTS.DOC_URL_ROOT}/salesforce-deployment-assistant-setup/#using-custom-cicd-pipeline) - ` +You can also use [sfdx-hardis wrapper commands of SF deployment commands](${CONSTANTS.DOC_URL_ROOT}/salesforce-deployment-assistant-setup/#using-custom-cicd-pipeline) +` public static examples = [ '$ sf hardis:project:deploy:notify --check-only --deploy-status valid --message "This deployment check is valid\\n\\nYahooo !!"', diff --git a/src/commands/hardis/project/generate/flow-git-diff.ts b/src/commands/hardis/project/generate/flow-git-diff.ts index a4f80d712..86764bd1e 100644 --- a/src/commands/hardis/project/generate/flow-git-diff.ts +++ b/src/commands/hardis/project/generate/flow-git-diff.ts @@ -24,7 +24,7 @@ export default class GenerateFlowGitDiff extends SfCommand { public static description = `Generate Flow Visual Git Diff markdown between 2 commits -This command requires @mermaid-js/mermaid-cli to be installed. +Note: This command might requires @mermaid-js/mermaid-cli to be installed. Run \`npm install @mermaid-js/mermaid-cli --global\` `; diff --git a/src/common/utils/mermaidUtils.ts b/src/common/utils/mermaidUtils.ts index 8a8a0633e..5f29d5266 100644 --- a/src/common/utils/mermaidUtils.ts +++ b/src/common/utils/mermaidUtils.ts @@ -189,10 +189,8 @@ ${formatClasses(changedClasses, changed)} export async function generateFlowVisualGitDiff(flowFile, commitBefore: string, commitAfter: string, options: { mermaidMd: boolean, svgMd: boolean, pngMd: boolean, debug: boolean } = { mermaidMd: false, svgMd: true, pngMd: false, debug: false }) { const result: any = { outputDiffMdFile: "", hasFlowDiffs: false }; - const flowXmlBefore = await git().show([`${commitBefore}:${flowFile}`]); - const mermaidMdBefore = await buildMermaidMarkdown(flowXmlBefore, flowFile); - const flowXmlAfter = await git().show([`${commitAfter}:${flowFile}`]); - const mermaidMdAfter = await buildMermaidMarkdown(flowXmlAfter, flowFile); + const { mermaidMdBefore, flowXmlBefore } = await getFlowXmlBefore(commitBefore, flowFile); + const { mermaidMdAfter, flowXmlAfter } = await getFlowXmlAfter(commitAfter, flowFile); const flowLabel = path.basename(flowFile, ".flow-meta.xml"); const reportDir = await getReportDirectory(); @@ -229,7 +227,7 @@ export async function generateFlowVisualGitDiff(flowFile, commitBefore: string, let diffMarkdown = compareMdLines.join("\n"); - if (result.hasFlowDiffs === true) { + if (result.hasFlowDiffs === true && flowXmlAfter !== "" && flowXmlBefore !== "") { diffMarkdown = await completeWithDiffAiDescription(diffMarkdown, flowXmlAfter, flowXmlBefore) } @@ -264,6 +262,30 @@ export async function generateFlowVisualGitDiff(flowFile, commitBefore: string, return result; } +async function getFlowXmlAfter(commitAfter: string, flowFile: any) { + try { + const flowXmlAfter = await git().show([`${commitAfter}:${flowFile}`]); + const mermaidMdAfter = await buildMermaidMarkdown(flowXmlAfter, flowFile); + return { mermaidMdAfter, flowXmlAfter }; + } + // eslint-disable-next-line @typescript-eslint/no-unused-vars + catch (err: any) { + return { mermaidMdAfter: "", flowXmlAfter: "" }; + } +} + +async function getFlowXmlBefore(commitBefore: string, flowFile: any) { + try { + const flowXmlBefore = await git().show([`${commitBefore}:${flowFile}`]); + const mermaidMdBefore = await buildMermaidMarkdown(flowXmlBefore, flowFile); + return { mermaidMdBefore, flowXmlBefore }; + } + // eslint-disable-next-line @typescript-eslint/no-unused-vars + catch (err: any) { + return { mermaidMdBefore: "", flowXmlBefore: "" }; + } +} + function buildFinalCompareMarkdown(mixedLines: any[], compareMdLines, isMermaid, isTableStarted, linkLines) { if (mixedLines.length === 0) { return; @@ -362,6 +384,7 @@ function buildFinalCompareMarkdown(mixedLines: any[], compareMdLines, isMermaid, } /* jscpd:ignore-end */ // Skip table lines that have not been updated + /* else if (!isMermaid && styledLine.startsWith("|") && isTableStarted === false) { isTableStarted = true; const tableFilteredLines: any[] = []; @@ -389,6 +412,7 @@ function buildFinalCompareMarkdown(mixedLines: any[], compareMdLines, isMermaid, } return; } + */ // Tables lines if (!isMermaid && status === "removed" && styledLine.startsWith("|") && !styledLine.startsWith("|:-")) { @@ -419,10 +443,10 @@ function buildFinalCompareMarkdown(mixedLines: any[], compareMdLines, isMermaid, styledLine = `## 🟩${styledLine.replace("## ", "")}`; } // Normal lines - else if (!isMermaid && status === "removed" && styledLine !== "" && !styledLine.startsWith("|:-") && !styledLine.startsWith("___")) { + else if (!isMermaid && status === "removed" && styledLine !== "" && !styledLine.includes('```') && !styledLine.startsWith("|:-") && !styledLine.startsWith("___")) { styledLine = `🟥${styledLine}`; } - else if (!isMermaid && status === "added" && styledLine !== "" && !styledLine.startsWith("|:-") && !styledLine.startsWith("___")) { + else if (!isMermaid && status === "added" && styledLine !== "" && !styledLine.includes('```') && !styledLine.startsWith("|:-") && !styledLine.startsWith("___")) { styledLine = `🟩${styledLine}`; } // Boxes lines @@ -472,7 +496,7 @@ function buildFinalCompareMarkdown(mixedLines: any[], compareMdLines, isMermaid, /* jscpd:ignore-start */ // Long Link lines else if (isMermaid === true && status === "removed" && currentLine.includes('--->')) { - styledLine = styledLine.replace("--->", "--.->");//+ ":::removedLink" + styledLine = styledLine.replace("--->", "-.->");//+ ":::removedLink" linkLines.push("removed"); if (styledLine.split("|").length === 3) { const splits = styledLine.split("|");