Skip to content

Commit

Permalink
Upgrade python
Browse files Browse the repository at this point in the history
  • Loading branch information
nvuillam committed Jan 4, 2025
1 parent 51ab7d0 commit d0c13c6
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 5 deletions.
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@

Note: Can be used with `sfdx plugins:install sfdx-hardis@beta` and docker image `hardisgroupcom/sfdx-hardis@beta`

## [5.11.1] 2025-01-03

- New command [hardis:doc:mkdocs-to-salesforce](https://sfdx-hardis.cloudity.com/hardis/doc/mkdocs-to-salesforce/) to generate static HTML doc and host it in a Static Resource and a VisualForce page
- Remove hyperlinks from MermaidJs on Pull Request comments, to improve display on GitHub & Gitlab
- Upgrade base image to python:3.12.8-alpine3.20, so mkdocs can be installed and run if necessary

## [5.11.0] 2025-01-03

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Docker image to run sfdx-hardis

FROM alpine:3.21
FROM python:3.12.8-alpine3.20

LABEL maintainer="Nicolas VUILLAMY <nicolas.vuillamy@cloudity.com>"

Expand Down
10 changes: 10 additions & 0 deletions config/sfdx-hardis.jsonschema.json
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,16 @@
"title": "Dev Hub Username",
"type": "string"
},
"docDeployToOrg": {
"$id": "#/properties/docDeployToOrg",
"default": false,
"description": "Automatically deploy MkDocs HTML documentation from CI/CD Workflows to Salesforce org as static resource",
"examples": [
true
],
"title": "Doc: Deploy to Salesforce Org",
"type": "boolean"
},
"extends": {
"$id": "#/properties/extends",
"description": "You can base your local sfdx-hardis configuration on a remote config file. That allows you to have the same config base for all your projects",
Expand Down
Binary file added docs/assets/images/screenshot-html-doc.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 25 additions & 1 deletion docs/salesforce-project-documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,39 @@ With a single command, you can generate a Web Site documenting your Salesforce m

![](assets/images/project-documentation.gif)

## How To
## How To generate

- Use the Git repository containing your SFDX project, or create it easily using [sfdx-hardis Monitoring](salesforce-monitoring-home.md), or simply calling [BackUp command](hardis/org/monitor/backup.md)

- Call VsCode SFDX-Hardis command [**Documentation Generation > Generate Project Documentation (with history)**](hardis/doc/project2markdown.md)
- Corresponding command line: `sf hardis:doc:project2markdown --with-history`

## Run Locally

- Run command **Documentation Generation > Run local HTML Doc Pages** (Note: you need [Python](https://www.python.org/downloads/) on your computer)
- Corresponding command lines: `pip install mkdocs-material mdx_truly_sane_lists`, then `mkdocs serve`

- Open <http://127.0.0.1:8000/> in your Web Browser

## Host on Salesforce org

You can also host the HTML documentation directly in your Salesforce org !

![](assets/images/screenshot-html-doc.jpg)

### Manually

- Run command **Documentation Generation -> Upload HTML Doc to Salesforce**
- Corresponding command line: [`sf hardis:doc:mkdocs-to-salesforce`](hardis/doc/mkdocs-to-salesforce.md)

- Set generated Custom Tab as `Default On` on your Profile if necessary

- Assign generated Permission Set to the users you want to access the SFDX Doc tab

- Add the tab in a Lightning Application (optional)

### From CI/CD

If using sfdx-hardis monitoring, just set the variable **SFDX_HARDIS_DOC_DEPLOY_TO_ORG=true** (or the .sfdx-hardis.yml variable `docDeployToOrg: true`)

If using custom pipelines, add `sf hardis:doc:project2markdown --with-history` then `sf hardis:doc:mkdocs-to-salesforce` in your workflow.
10 changes: 9 additions & 1 deletion src/commands/hardis/org/monitor/backup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ import * as path from 'path';
import { buildOrgManifest } from '../../../../common/utils/deployUtils.js';
import { execCommand, filterPackageXml, uxLog } from '../../../../common/utils/index.js';
import { MetadataUtils } from '../../../../common/metadata-utils/index.js';
import { CONSTANTS } from '../../../../config/index.js';
import { CONSTANTS, getConfig } from '../../../../config/index.js';
import { NotifProvider, NotifSeverity } from '../../../../common/notifProvider/index.js';
import { MessageAttachment } from '@slack/web-api';
import { getNotificationButtons, getOrgMarkdown, getSeverityIcon } from '../../../../common/utils/notifUtils.js';
import { generateCsvFile, generateReportPath } from '../../../../common/utils/filesUtils.js';
import { countPackageXmlItems, parsePackageXmlFile, writePackageXmlFile } from '../../../../common/utils/xmlUtils.js';
import Project2Markdown from '../../doc/project2markdown.js';
import MkDocsToSalesforce from '../../doc/mkdocs-to-salesforce.js';

Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
const messages = Messages.loadMessages('sfdx-hardis', 'org');
Expand Down Expand Up @@ -57,6 +58,8 @@ This command is part of [sfdx-hardis Monitoring](${CONSTANTS.DOC_URL_ROOT}/sales
[Doc generation (including visual flows)](${CONSTANTS.DOC_URL_ROOT}/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)
Expand Down Expand Up @@ -269,6 +272,11 @@ If Flow history doc always display a single state, you probably need to update y
try {
await Project2Markdown.run(["--diff-only", "--with-history"]);
uxLog(this, c.cyan("Documentation generated from retrieved sources. If you want to skip it, use option --skip-doc"));
const config = await getConfig("user");
if (config.docDeployToOrg || process.env?.SFDX_HARDIS_DOC_DEPLOY_TO_ORG === "true") {
await MkDocsToSalesforce.run(["--type", "Monitoring"]);
}

} catch (e: any) {
uxLog(this, c.yellow("Error while generating project documentation " + e.message));
}
Expand Down

0 comments on commit d0c13c6

Please sign in to comment.