Skip to content

Commit

Permalink
MermaidCli generation fallbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
nvuillam committed Dec 22, 2024
1 parent 9c56c10 commit c20d06a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Note: Can be used with `sfdx plugins:install sfdx-hardis@beta` and docker image

- Visual flow management, using MermaidJs
- [hardis:doc:project2markdown](https://sfdx-hardis.cloudity.com/hardis/doc/project2markdown/): Add a markdown file for each Flow
- If unable to run mermaid-cli, store markdown with mermaidJs diagram content anyway (can happen from Monitoning Backup Command)
- [hardis:doc:flow2markdown](https://sfdx-hardis.cloudity.com/hardis/doc/flow2markdown/): Generate the markdown documentation of a single flow (available from VsCode extension)
- [hardis:project:generate:flow-git-diff](https://sfdx-hardis.cloudity.com/hardis/project/generate/flow-git-diff/): Generate the visual git diff for a single flow (available from VsCode extension)
- [hardis:project:deploy:smart](https://sfdx-hardis.cloudity.com/hardis/project/deploy/smart/): Add visual git diff for flows updated by a Pull Request
Expand Down
8 changes: 6 additions & 2 deletions src/commands/hardis/doc/project2markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ Run \`npm install @mermaid-js/mermaid-cli --global\`
const packageDirs = this.project?.getPackageDirectories();
const flowFiles = await listFlowFiles(packageDirs);
const flowErrors: string[] = [];
const flowWarnings: string[] = [];
const flowDescriptions: any[] = [];
for (const flowFile of flowFiles) {
uxLog(this, c.grey(`Generating markdown for Flow ${flowFile}...`));
Expand All @@ -160,11 +161,14 @@ Run \`npm install @mermaid-js/mermaid-cli --global\`
}
const gen2res = await generateMarkdownFileWithMermaid(outputFlowMdFile);
if (!gen2res) {
flowErrors.push(flowFile);
flowWarnings.push(flowFile);
continue;
}
}
uxLog(this, c.green(`Successfully generated ${flowFiles.length - flowErrors.length} Flows documentation`));
uxLog(this, c.green(`Successfully generated ${flowFiles.length - flowWarnings.length - flowErrors.length} Flows documentation`));
if (flowErrors.length > 0) {
uxLog(this, c.yellow(`Partially generated documentation (Markdown with mermaidJs but without SVG) for ${flowWarnings.length} Flows: ${flowWarnings.join(", ")}`));
}
if (flowErrors.length > 0) {
uxLog(this, c.yellow(`Error generating documentation for ${flowErrors.length} Flows: ${flowErrors.join(", ")}`));
}
Expand Down

0 comments on commit c20d06a

Please sign in to comment.