hdoc-tools 0.11.6 → 0.11.8

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.
package/hdoc-build.js CHANGED
@@ -36,6 +36,7 @@
36
36
  css_templates = [],
37
37
  doc_header_template = '',
38
38
  doc_header_template_non_git = '',
39
+ global_source_path = '',
39
40
  pdf_created = 0,
40
41
  pdf_enable = false,
41
42
  pdf_header_template = '',
@@ -178,6 +179,7 @@
178
179
 
179
180
  // Get contributor data from Github, if exists
180
181
  let contribs = [];
182
+ let last_commit = null;
181
183
  if (hdocbook_config.publicSource && hdocbook_config.publicSource !== '' && hdocbook_config.publicSource.includes('github.com/Hornbill-Docs')) {
182
184
 
183
185
  const github_paths = hdoc.get_github_api_path(hdocbook_config.publicSource, file_path.relativePath);
@@ -186,6 +188,7 @@
186
188
  if (!contributors.success) {
187
189
  console.log(`Error retrieving contributors from Github: ${contributors.error}`);
188
190
  } else {
191
+ last_commit = contributors.last_commit_date;
189
192
  metadata.last_commit = contributors.last_commit_date;
190
193
  metadata.contributor_count = contributors.contributor_count;
191
194
  metadata.edit_url = github_paths.edit_path;
@@ -253,7 +256,8 @@
253
256
  metadata: metadata,
254
257
  contributors: contribs,
255
258
  pdf_size: pdf_size,
256
- md5: file_path.hash
259
+ md5: file_path.hash,
260
+ lastmod: last_commit !== null ? last_commit : file_path.hb_lastmod
257
261
  });
258
262
  // Save HTML into HTML file
259
263
  try {
@@ -386,6 +390,7 @@
386
390
 
387
391
  // Get contributor data from Github, if exists
388
392
  let contribs = [];
393
+ let last_commit = null;
389
394
  if (hdocbook_config.publicSource && hdocbook_config.publicSource !== '' && hdocbook_config.publicSource.includes('github.com/Hornbill-Docs')) {
390
395
 
391
396
  const github_paths = hdoc.get_github_api_path(hdocbook_config.publicSource, file_path.relativePath);
@@ -394,6 +399,7 @@
394
399
  if (!contributors.success) {
395
400
  console.log(`Error retrieving contributors from Github: ${contributors.error}`);
396
401
  } else {
402
+ last_commit = contributors.last_commit_date;
397
403
  metadata.last_commit = contributors.last_commit_date;
398
404
  metadata.contributor_count = contributors.contributor_count;
399
405
  metadata.edit_url = github_paths.edit_path;
@@ -474,7 +480,7 @@
474
480
  contributors: contribs,
475
481
  pdf_size: pdf_size,
476
482
  md5: file_path.hash,
477
- lastmod: file_path.stat.mtime.toISOString()
483
+ lastmod: last_commit !== null ? last_commit : file_path.hb_lastmod
478
484
  });
479
485
 
480
486
  // Add MD file to delete queue
@@ -538,6 +544,9 @@
538
544
  // File callback for build scan
539
545
  const build_file_callback = function (element) {
540
546
  if (element.extension === 'md') {
547
+ element.hb_source_path = path.join(global_source_path, element.relativePath);
548
+ const fstats = fs.statSync(element.hb_source_path);
549
+ element.hb_lastmod = `${fstats.mtime.toISOString().slice(0, 19)}Z`;
541
550
  md_files.push(element);
542
551
  } else {
543
552
  // File is html, see if there's a matching md file and if there is then ignore the html
@@ -545,6 +554,9 @@
545
554
  if (fs.existsSync(md_path)) {
546
555
  return;
547
556
  }
557
+ element.hb_source_path = path.join(global_source_path, element.relativePath);
558
+ const fstats = fs.statSync(element.hb_source_path);
559
+ element.hb_lastmod = `${fstats.mtime.toISOString().slice(0, 19)}Z`;
548
560
  static_html_files.push(element);
549
561
  }
550
562
  };
@@ -576,6 +588,7 @@
576
588
  if (github_api_token !== '') {
577
589
  git_token = github_api_token;
578
590
  }
591
+ global_source_path = source_path;
579
592
  verbose = verbose_output;
580
593
 
581
594
  const start_time = Date.now();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hdoc-tools",
3
- "version": "0.11.6",
3
+ "version": "0.11.8",
4
4
  "description": "Hornbill HDocBook Development Support Tool",
5
5
  "main": "hdoc.js",
6
6
  "bin": {
@@ -1,7 +0,0 @@
1
- _work/
2
- node_modules/
3
- package-lock.json
4
- .wsuo
5
- VSWorkspaceState.json
6
- slnx.state
7
- slnx.sqlite