sfdx-hardis 8.4.1 → 8.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/defaults/mkdocs-project-doc/docs/javascripts/gtag.js +16 -11
  2. package/defaults/mkdocs-project-doc/docs/javascripts/sfdx-hardis-doc.js +103 -0
  3. package/defaults/mkdocs-project-doc/docs/stylesheets/sfdx-hardis-doc.css +204 -0
  4. package/defaults/mkdocs-project-doc/mkdocs.yml +20 -1
  5. package/lib/commands/hardis/doc/project2markdown.d.ts +20 -1
  6. package/lib/commands/hardis/doc/project2markdown.js +319 -88
  7. package/lib/commands/hardis/doc/project2markdown.js.map +1 -1
  8. package/lib/common/docBuilder/docBuilderApex.js +5 -2
  9. package/lib/common/docBuilder/docBuilderApex.js.map +1 -1
  10. package/lib/common/docBuilder/docBuilderApprovalProcess.js +1 -1
  11. package/lib/common/docBuilder/docBuilderApprovalProcess.js.map +1 -1
  12. package/lib/common/docBuilder/docBuilderAssignmentRules.js +3 -1
  13. package/lib/common/docBuilder/docBuilderAssignmentRules.js.map +1 -1
  14. package/lib/common/docBuilder/docBuilderAutoResponseRules.js +2 -2
  15. package/lib/common/docBuilder/docBuilderAutoResponseRules.js.map +1 -1
  16. package/lib/common/docBuilder/docBuilderComponentRoot.js +1 -1
  17. package/lib/common/docBuilder/docBuilderComponentRoot.js.map +1 -1
  18. package/lib/common/docBuilder/docBuilderEscalationRules.js +3 -1
  19. package/lib/common/docBuilder/docBuilderEscalationRules.js.map +1 -1
  20. package/lib/common/docBuilder/docBuilderFlow.d.ts +4 -1
  21. package/lib/common/docBuilder/docBuilderFlow.js +5 -2
  22. package/lib/common/docBuilder/docBuilderFlow.js.map +1 -1
  23. package/lib/common/docBuilder/docBuilderLwc.js +3 -2
  24. package/lib/common/docBuilder/docBuilderLwc.js.map +1 -1
  25. package/lib/common/docBuilder/docBuilderObject.js +28 -6
  26. package/lib/common/docBuilder/docBuilderObject.js.map +1 -1
  27. package/lib/common/docBuilder/docBuilderPackage.js +1 -1
  28. package/lib/common/docBuilder/docBuilderPackage.js.map +1 -1
  29. package/lib/common/docBuilder/docBuilderPackageXml.js +6 -5
  30. package/lib/common/docBuilder/docBuilderPackageXml.js.map +1 -1
  31. package/lib/common/docBuilder/docBuilderPage.js +1 -1
  32. package/lib/common/docBuilder/docBuilderPage.js.map +1 -1
  33. package/lib/common/docBuilder/docBuilderPermissionSet.js +1 -1
  34. package/lib/common/docBuilder/docBuilderPermissionSet.js.map +1 -1
  35. package/lib/common/docBuilder/docBuilderPermissionSetGroup.js +3 -2
  36. package/lib/common/docBuilder/docBuilderPermissionSetGroup.js.map +1 -1
  37. package/lib/common/docBuilder/docBuilderProfile.js +1 -1
  38. package/lib/common/docBuilder/docBuilderProfile.js.map +1 -1
  39. package/lib/common/docBuilder/docBuilderRoot.js +2 -2
  40. package/lib/common/docBuilder/docBuilderRoot.js.map +1 -1
  41. package/lib/common/docBuilder/docBuilderWorkflowRule.js +1 -1
  42. package/lib/common/docBuilder/docBuilderWorkflowRule.js.map +1 -1
  43. package/lib/common/docBuilder/docUtils.d.ts +7 -2
  44. package/lib/common/docBuilder/docUtils.js +82 -10
  45. package/lib/common/docBuilder/docUtils.js.map +1 -1
  46. package/lib/common/docBuilder/objectModelBuilder.js +3 -1
  47. package/lib/common/docBuilder/objectModelBuilder.js.map +1 -1
  48. package/lib/common/gitProvider/utilsMarkdown.d.ts +1 -0
  49. package/lib/common/gitProvider/utilsMarkdown.js +10 -1
  50. package/lib/common/gitProvider/utilsMarkdown.js.map +1 -1
  51. package/lib/common/utils/flowVisualiser/nodeFormatUtils.js +7 -1
  52. package/lib/common/utils/flowVisualiser/nodeFormatUtils.js.map +1 -1
  53. package/lib/i18n/de.json +19 -0
  54. package/lib/i18n/en.json +19 -0
  55. package/lib/i18n/es.json +19 -0
  56. package/lib/i18n/fr.json +19 -0
  57. package/lib/i18n/it.json +19 -0
  58. package/lib/i18n/ja.json +19 -0
  59. package/lib/i18n/nl.json +19 -0
  60. package/lib/i18n/pl.json +19 -0
  61. package/lib/i18n/pt-BR.json +19 -0
  62. package/oclif.lock +75 -49
  63. package/oclif.manifest.json +2777 -2777
  64. package/package.json +6 -6
@@ -9,19 +9,24 @@ location$.subscribe(function(url) {
9
9
  gtag("config", "G-3DM50255LC");
10
10
  });
11
11
  */
12
+ // Replace the placeholder with your own Google Analytics measurement id to enable tracking.
13
+ // While it is left as it is, no request is sent: a project documentation used to call
14
+ // googletagmanager.com on every page load with an id that does not exist.
12
15
  var gtag_id = "G-XXXXXXXXXX";
13
16
 
14
- var script = document.createElement("script");
15
- script.src = "https://www.googletagmanager.com/gtag/js?id=" + gtag_id;
16
- document.head.appendChild(script);
17
+ if (gtag_id !== "G-XXXXXXXXXX") {
18
+ var script = document.createElement("script");
19
+ script.src = "https://www.googletagmanager.com/gtag/js?id=" + gtag_id;
20
+ document.head.appendChild(script);
17
21
 
18
- location$.subscribe(function (url) {
19
- window.dataLayer = window.dataLayer || [];
22
+ location$.subscribe(function (url) {
23
+ window.dataLayer = window.dataLayer || [];
20
24
 
21
- function gtag() {
22
- dataLayer.push(arguments);
23
- }
25
+ function gtag() {
26
+ dataLayer.push(arguments);
27
+ }
24
28
 
25
- gtag("js", new Date());
26
- gtag("config", gtag_id);
27
- });
29
+ gtag("js", new Date());
30
+ gtag("config", gtag_id);
31
+ });
32
+ }
@@ -0,0 +1,103 @@
1
+ /*
2
+ * Behavior owned by sfdx-hardis. Unlike javascripts/tables.js, which is copied once and then
3
+ * belongs to the project, this file is rewritten on every documentation generation, so fixes
4
+ * reach projects that were documented with an older version.
5
+ */
6
+
7
+ // A generated table regularly holds hundreds of rows: the Account object of a large org lists
8
+ // close to 500 fields, on a page 40 000 pixels tall. Above this many rows a table gets a filter
9
+ // box, so a reader looks a row up instead of scrolling for it.
10
+ var SFDX_HARDIS_FILTER_FROM_ROWS = 15;
11
+
12
+ // Labels are written by sfdx-hardis in javascripts/sfdx-hardis-doc-labels.js, in the language the
13
+ // documentation was generated with, and the English wording passed below is the fallback. They are
14
+ // read when a label is drawn rather than when this file is parsed, so the two scripts can be
15
+ // declared in either order in mkdocs.yml.
16
+ function sfdxHardisLabel(key, fallback, values) {
17
+ var labels = window.SFDX_HARDIS_DOC_LABELS || {};
18
+ var text = labels[key] || fallback;
19
+ return text.replace(/\{\{(\w+)\}\}/g, function (match, name) {
20
+ return Object.prototype.hasOwnProperty.call(values || {}, name) ? values[name] : match;
21
+ });
22
+ }
23
+
24
+ function sfdxHardisAddTableFilter(table) {
25
+ var body = table.tBodies[0];
26
+ if (!body || body.rows.length < SFDX_HARDIS_FILTER_FROM_ROWS) {
27
+ return;
28
+ }
29
+ // Material wraps a table in a scrolling container: the filter goes above the whole thing
30
+ var anchor = table.closest(".md-typeset__table") || table;
31
+ if (anchor.previousElementSibling && anchor.previousElementSibling.classList.contains("sfdx-hardis-filter")) {
32
+ return;
33
+ }
34
+
35
+ var wrapper = document.createElement("div");
36
+ wrapper.className = "sfdx-hardis-filter";
37
+
38
+ var input = document.createElement("input");
39
+ input.type = "search";
40
+ input.className = "sfdx-hardis-filter__input";
41
+ input.setAttribute("aria-label", sfdxHardisLabel("filterTableRows", "Filter table rows"));
42
+ input.placeholder = sfdxHardisLabel("filterRowsPlaceholder", "Filter {{count}} rows...", { count: body.rows.length });
43
+
44
+ var count = document.createElement("span");
45
+ count.className = "sfdx-hardis-filter__count";
46
+
47
+ wrapper.appendChild(input);
48
+ wrapper.appendChild(count);
49
+ anchor.parentNode.insertBefore(wrapper, anchor);
50
+
51
+ var rows = Array.prototype.slice.call(body.rows);
52
+ var haystacks = rows.map(function (row) {
53
+ return row.textContent.toLowerCase();
54
+ });
55
+
56
+ function apply() {
57
+ var needle = input.value.trim().toLowerCase();
58
+ var shown = 0;
59
+ for (var i = 0; i < rows.length; i++) {
60
+ var matches = needle === "" || haystacks[i].indexOf(needle) > -1;
61
+ rows[i].hidden = !matches;
62
+ if (matches) {
63
+ shown++;
64
+ }
65
+ }
66
+ count.textContent = needle === ""
67
+ ? ""
68
+ : sfdxHardisLabel("filterMatchCount", "{{shown}} of {{total}}", { shown: shown, total: rows.length });
69
+ }
70
+
71
+ input.addEventListener("input", apply);
72
+ // Escape clears the filter, the way a search field is expected to behave
73
+ input.addEventListener("keydown", function (event) {
74
+ if (event.key === "Escape") {
75
+ input.value = "";
76
+ apply();
77
+ }
78
+ });
79
+ }
80
+
81
+ // Attribute tables (object, profile, permission set, flow node) are written with an empty header
82
+ // row, because their two columns need no title. The theme still paints it, leaving a colored
83
+ // band above the table, so a header row whose cells are all empty is dropped.
84
+ function sfdxHardisHideEmptyTableHeader(table) {
85
+ var head = table.tHead;
86
+ if (!head || head.rows.length !== 1) {
87
+ return;
88
+ }
89
+ var cells = Array.prototype.slice.call(head.rows[0].cells);
90
+ var hasText = cells.some(function (cell) {
91
+ return cell.textContent.trim() !== "";
92
+ });
93
+ if (!hasText) {
94
+ head.hidden = true;
95
+ }
96
+ }
97
+
98
+ document$.subscribe(function () {
99
+ document.querySelectorAll("article table").forEach(function (table) {
100
+ sfdxHardisHideEmptyTableHeader(table);
101
+ sfdxHardisAddTableFilter(table);
102
+ });
103
+ });
@@ -0,0 +1,204 @@
1
+ /* stylelint-disable SelectorFormat */
2
+
3
+ /*
4
+ * Styling owned by sfdx-hardis. Unlike stylesheets/extra.css, which is copied once and then
5
+ * belongs to the project, this file is rewritten on every documentation generation, so fixes
6
+ * reach projects that were documented with an older version. Put project customizations in
7
+ * stylesheets/extra.css instead: it is loaded first, and this file only overrides what it names.
8
+ */
9
+
10
+ /*
11
+ * The header and the footer are painted navy, but the theme styles them as light strips and
12
+ * leaves their text on the default near-black foreground. The site title, the repository link,
13
+ * the version and star counters, the previous/next navigation and the copyright line all came
14
+ * out at a contrast ratio of 1.12:1, where readable text needs 4.5:1. Background and foreground
15
+ * are set together here so the two can no longer drift apart.
16
+ */
17
+ .md-header,
18
+ .md-footer {
19
+ --md-default-fg-color: rgb(255 255 255 / 90%);
20
+ --md-default-fg-color--light: rgb(255 255 255 / 70%);
21
+ --md-default-fg-color--lighter: rgb(255 255 255 / 50%);
22
+ --md-default-fg-color--lightest: rgb(255 255 255 / 10%);
23
+ --md-primary-bg-color: #ffffff;
24
+ --md-primary-bg-color--light: rgb(255 255 255 / 70%);
25
+ --md-footer-fg-color: #ffffff;
26
+ --md-footer-fg-color--light: rgb(255 255 255 / 70%);
27
+ --md-footer-fg-color--lighter: rgb(255 255 255 / 50%);
28
+ --md-typeset-a-color: #ffffff;
29
+
30
+ color: rgb(255 255 255 / 90%);
31
+ background-color: #001135;
32
+ }
33
+
34
+ .md-header a,
35
+ .md-header button,
36
+ .md-footer a,
37
+ .md-footer button {
38
+ color: inherit;
39
+ }
40
+
41
+ /*
42
+ * An object page carries a relationship diagram that mermaid lays out as wide as it needs to.
43
+ * Left alone it either overflows the page or is squeezed to an unreadable size, so it scrolls
44
+ * inside its own box.
45
+ */
46
+ .md-typeset .mermaid {
47
+ overflow-x: auto;
48
+ }
49
+
50
+ /*
51
+ * The permission tree of a profile or a permission set gets a search field, created without any
52
+ * styling: on a white page it was an invisible box with only its placeholder showing. It is given
53
+ * the same treatment as the table filter below.
54
+ */
55
+ #jstree-search,
56
+ .sfdx-hardis-filter__input {
57
+ max-width: 22rem;
58
+ padding: 0.35rem 0.6rem;
59
+ font-size: 0.7rem;
60
+ color: var(--md-default-fg-color);
61
+ background-color: var(--md-default-bg-color);
62
+ border: 0.05rem solid var(--md-default-fg-color--lighter);
63
+ border-radius: 0.2rem;
64
+ }
65
+
66
+ #jstree-search {
67
+ width: 100%;
68
+ }
69
+
70
+ #jstree-search:focus,
71
+ .sfdx-hardis-filter__input:focus {
72
+ border-color: var(--md-accent-fg-color);
73
+ outline: none;
74
+ }
75
+
76
+ /* Filter box that javascripts/sfdx-hardis-doc.js puts above every long table */
77
+ .sfdx-hardis-filter {
78
+ display: flex;
79
+ gap: 0.6rem;
80
+ align-items: center;
81
+ margin: 0.8em 0 0.4em;
82
+ }
83
+
84
+ .sfdx-hardis-filter__input {
85
+ flex: 1 1 auto;
86
+ }
87
+
88
+ .sfdx-hardis-filter__count {
89
+ font-size: 0.65rem;
90
+ color: var(--md-default-fg-color--light);
91
+ }
92
+
93
+ /*
94
+ * Home page. The list of sections used to be a bullet list of bare links under a full-width
95
+ * banner; it is now a grid of cards, each naming what its section holds and how many pages are
96
+ * behind it. The grid reflows down to one column on a phone.
97
+ */
98
+ .sfdx-hardis-home-cards {
99
+ display: grid;
100
+ grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
101
+ gap: 0.7rem;
102
+ /* Each card is only as tall as what it holds, instead of stretching to the tallest of its row */
103
+ align-items: start;
104
+ margin: 1.2em 0;
105
+ }
106
+
107
+ .sfdx-hardis-home-card {
108
+ display: flex;
109
+ flex-direction: column;
110
+ padding: 0.8rem 0.9rem;
111
+ border: 0.05rem solid var(--md-default-fg-color--lightest);
112
+ border-radius: 0.3rem;
113
+ transition: border-color 125ms, box-shadow 125ms;
114
+ }
115
+
116
+ .sfdx-hardis-home-card:hover {
117
+ border-color: var(--md-accent-fg-color);
118
+ box-shadow: 0 0.1rem 0.4rem rgb(0 0 0 / 8%);
119
+ }
120
+
121
+ .md-typeset .sfdx-hardis-home-card p {
122
+ margin: 0 0 0.5em;
123
+ font-size: 0.7rem;
124
+ color: var(--md-default-fg-color--light);
125
+ }
126
+
127
+ .md-typeset .sfdx-hardis-home-card p:last-child {
128
+ margin-bottom: 0;
129
+ }
130
+
131
+ .md-typeset .sfdx-hardis-home-card__title {
132
+ font-size: 0.8rem;
133
+ font-weight: 700;
134
+ color: var(--md-default-fg-color);
135
+ text-decoration: none;
136
+ }
137
+
138
+ .md-typeset .sfdx-hardis-home-card__title:hover {
139
+ color: var(--md-accent-fg-color);
140
+ }
141
+
142
+ .sfdx-hardis-home-card__count {
143
+ padding: 0.05rem 0.35rem;
144
+ margin-left: 0.3rem;
145
+ font-size: 0.62rem;
146
+ font-weight: 700;
147
+ color: var(--md-default-fg-color--light);
148
+ vertical-align: 0.1rem;
149
+ background-color: var(--md-default-fg-color--lightest);
150
+ border-radius: 0.6rem;
151
+ }
152
+
153
+ /* Sections that group several pages list them as chips at the bottom of their card */
154
+ .sfdx-hardis-home-card__links {
155
+ margin-top: auto;
156
+ }
157
+
158
+ .md-typeset .sfdx-hardis-home-card__links p {
159
+ margin: 0;
160
+ line-height: 1.9;
161
+ }
162
+
163
+ .md-typeset .sfdx-hardis-home-card__links a {
164
+ padding: 0.1rem 0.4rem;
165
+ text-decoration: none;
166
+ font-size: 0.65rem;
167
+ color: var(--md-default-fg-color);
168
+ white-space: nowrap;
169
+ background-color: var(--md-default-fg-color--lightest);
170
+ border-radius: 0.2rem;
171
+ }
172
+
173
+ .md-typeset .sfdx-hardis-home-card__links a:hover {
174
+ color: var(--md-primary-bg-color);
175
+ background-color: var(--md-accent-fg-color);
176
+ }
177
+
178
+ /*
179
+ * Generated tables are full of long unbreakable names: an API name, a rule name, a class name.
180
+ * Kept whole they pushed the table past the width of the page, and the last column of the
181
+ * validation rules of Account was cut off with only a hidden scrollbar to reach it. Cells may
182
+ * now break a name anywhere, which is what lets the table fit.
183
+ */
184
+ .md-typeset table td,
185
+ .md-typeset table th {
186
+ overflow-wrap: anywhere;
187
+ }
188
+
189
+ /* The first column names the thing the row is about, so it keeps enough room to stay readable */
190
+ .md-typeset table td:first-child,
191
+ .md-typeset table th:first-child {
192
+ min-width: 8rem;
193
+ }
194
+
195
+ /*
196
+ * A validation rule formula is shown as code, and is the exception: allowed to break anywhere its
197
+ * column collapsed to a few characters and every rule became a tower of two-word lines. It wraps
198
+ * at the spaces the formula already holds, and only splits a call that is too long to fit.
199
+ */
200
+ .md-typeset table code {
201
+ white-space: normal;
202
+ overflow-wrap: break-word;
203
+ word-break: normal;
204
+ }
@@ -1,6 +1,6 @@
1
1
  site_name: Salesforce Project Documentation
2
2
  site_url: https://sfdx-hardis.cloudity.com
3
- repo_url: https://github.com/hardisgroupco/sfdx-hardis
3
+ repo_url: https://github.com/hardisgroupcom/sfdx-hardis
4
4
  edit_uri: tree/master/docs
5
5
  site_author: Nicolas Vuillamy
6
6
  site_description: Salesforce project documentation generated by sfdx-hardis
@@ -15,6 +15,16 @@ theme:
15
15
  features:
16
16
  - navigation.instant
17
17
  - navigation.footer
18
+ # A project documentation holds thousands of pages, and every one of them used to embed the
19
+ # whole menu: 900 KB of navigation markup around 30 KB of content. Pruning it to the branch
20
+ # being read is what keeps the site usable.
21
+ - navigation.prune
22
+ - navigation.path
23
+ - navigation.top
24
+ - navigation.tracking
25
+ - toc.follow
26
+ - search.highlight
27
+ - content.code.copy
18
28
  palette:
19
29
  - scheme: default
20
30
  primary: custom
@@ -58,6 +68,8 @@ markdown_extensions:
58
68
  restrict_base_path: false
59
69
  - mdx_truly_sane_lists
60
70
  - attr_list
71
+ # The home page section cards are markdown written inside div elements
72
+ - md_in_html
61
73
  - pymdownx.superfences:
62
74
  custom_fences:
63
75
  - name: mermaid
@@ -72,9 +84,16 @@ extra_javascript:
72
84
  - javascripts/tables.js
73
85
  - javascripts/gtag.js
74
86
  - javascripts/jstree-handler.js
87
+ # Rewritten by sfdx-hardis on every run: put project behavior in javascripts/tables.js
88
+ - javascripts/sfdx-hardis-doc-labels.js
89
+ - javascripts/sfdx-hardis-doc.js
75
90
  extra_css:
76
91
  - stylesheets/extra.css
77
92
  - https://cdnjs.cloudflare.com/ajax/libs/jstree/3.3.12/themes/default/style.min.css
93
+ - https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/all.min.css
94
+ - stylesheets/jstree-custom.css
95
+ # Loaded last so it overrides the project stylesheet: sfdx-hardis rewrites it on every run
96
+ - stylesheets/sfdx-hardis-doc.css
78
97
  extra:
79
98
  social:
80
99
  - icon: fontawesome/regular/circle-question
@@ -12,7 +12,6 @@ export default class Project2Markdown extends SfCommand<any> {
12
12
  protected packageXmlCandidates: any[];
13
13
  protected outputMarkdownRoot: string;
14
14
  protected outputMarkdownIndexFile: string;
15
- protected mdLines: string[];
16
15
  protected sfdxHardisConfig: any;
17
16
  protected outputPackageXmlMarkdownFiles: any[];
18
17
  protected mkDocsNavNodes: any[];
@@ -77,6 +76,26 @@ export default class Project2Markdown extends SfCommand<any> {
77
76
  private generateLinksInfo;
78
77
  private generateFlowsDocumentation;
79
78
  private humanDisplay;
79
+ /**
80
+ * The home page is the first thing a reader lands on, and for most of them it is the only map of
81
+ * the org they will ever get. It used to be a bare bullet list under a full-width banner, naming
82
+ * sections without saying what any of them held. It is now a grid of cards: one per section, with
83
+ * a sentence of plain language and the number of pages behind it, so someone who does not know
84
+ * Salesforce can still tell where to click.
85
+ *
86
+ * A section is only drawn when the project has one: a project without Lightning Pages, escalation
87
+ * rules or installed packages used to get links to pages that were never written.
88
+ */
89
+ /**
90
+ * DO_NOT_OVERWRITE_INDEX_MD exists so a project can write its own home page. Setting it used to
91
+ * freeze the page for good: a project that set the variable and never touched index.md kept the
92
+ * home page of the sfdx-hardis version that generated it, and no later improvement ever reached
93
+ * it. A page that is still, to the character, what a previous run wrote is therefore refreshed.
94
+ * The first edit to it, however small, hands the page over to the project for good.
95
+ */
96
+ private canWriteHomePage;
97
+ private buildHomeLines;
98
+ private isDocumentedSection;
80
99
  private buildSfdxHardisParams;
81
100
  private buildMajorBranchesAndOrgs;
82
101
  private manageLocalPackages;