hdoc-tools 0.50.1 → 0.51.0

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 (2) hide show
  1. package/hdoc-build.js +27 -6
  2. package/package.json +1 -1
package/hdoc-build.js CHANGED
@@ -89,8 +89,8 @@
89
89
  let prod_families = {};
90
90
  let prods_supported = [];
91
91
  let doc_id = "";
92
- let git_token =
93
- "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"; // Github fine-grained personal access token that has minimum read-only access to Hornbill Docs metadata
92
+ let git_token = "";
93
+ let skip_github_calls = false;
94
94
  let hdocbook_config = {};
95
95
  let hdocbook_project;
96
96
  let includes_found = 0;
@@ -510,6 +510,7 @@
510
510
  let contribs = [];
511
511
  let last_commit = null;
512
512
  if (
513
+ !skip_github_calls &&
513
514
  hdocbook_config.publicSource &&
514
515
  hdocbook_config.publicSource !== "" &&
515
516
  hdocbook_config.publicSource.includes("github.com/Hornbill-Docs")
@@ -568,6 +569,21 @@
568
569
  id: "edit-path",
569
570
  value: github_paths.edit_path,
570
571
  });
572
+ } else if (
573
+ skip_github_calls &&
574
+ hdocbook_config.publicSource &&
575
+ hdocbook_config.publicSource.includes("github.com/Hornbill-Docs")
576
+ ) {
577
+ const clean_repo = hdocbook_config.publicSource.endsWith("/")
578
+ ? hdocbook_config.publicSource.slice(0, -1)
579
+ : hdocbook_config.publicSource;
580
+ const rel = file_path.relativePath.replace(/\\\\/g, "/").replace(/\\/g, "/");
581
+ const edit_path = `${clean_repo}/blob/main/${rel}`;
582
+ metadata.edit_url = edit_path;
583
+ fm_headers.push({
584
+ id: "edit-path",
585
+ value: edit_path,
586
+ });
571
587
  }
572
588
 
573
589
  if (pdf_enable && !pdf_path_excluded(file_path.relativePath)) {
@@ -720,7 +736,7 @@
720
736
  try {
721
737
  json_tidy = JSON.stringify(JSON.parse(json_tidy), null, 2);
722
738
  } catch (e) {
723
- console.info(
739
+ console.log(
724
740
  `[WARNING] Could not tidy JSON in file [${file}]: ${e}`,
725
741
  );
726
742
  }
@@ -747,7 +763,7 @@
747
763
  lineSeparator: "\n",
748
764
  });
749
765
  } catch (e) {
750
- console.info(
766
+ console.log(
751
767
  `[WARNING] Could not tidy XML in file [${file}]: ${e}`,
752
768
  );
753
769
  }
@@ -1076,9 +1092,14 @@
1076
1092
  );
1077
1093
 
1078
1094
  // Get github repo details
1079
- github_repo_details = await hdoc.get_github_repo_details( api_path, git_token );
1095
+ github_repo_details = await hdoc.get_github_repo_details( api_path, git_token );
1080
1096
  if (!github_repo_details.success) {
1081
- console.warn(`Unable to retrieve GitHub Repository details: ${github_repo_details.error}`);
1097
+ if (git_token === "") {
1098
+ console.info("[WARNING] Private GitHub repo detected — provide --git-token <PAT> to retrieve contributor metadata.");
1099
+ skip_github_calls = true;
1100
+ } else {
1101
+ console.info(`[WARNING] Unable to retrieve GitHub Repository details: ${github_repo_details.error}`);
1102
+ }
1082
1103
  }
1083
1104
  }
1084
1105
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hdoc-tools",
3
- "version": "0.50.1",
3
+ "version": "0.51.0",
4
4
  "description": "Hornbill HDocBook Development Support Tool",
5
5
  "main": "hdoc.js",
6
6
  "bin": {