hdoc-tools 0.17.6 → 0.17.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
@@ -612,7 +612,10 @@
612
612
  wip_doc_header = wip_doc_header.replaceAll('{{edit-url}}', fm_headers[i].value);
613
613
  break;
614
614
  case 'last-commit':
615
- const last_commit_date = new Date(fm_headers[i].value).toDateString();
615
+ let last_commit_date = fm_headers[i].value;
616
+ if (last_commit_date !== 'No Commit Date Available') {
617
+ last_commit_date = new Date(fm_headers[i].value).toDateString();
618
+ }
616
619
  wip_doc_header = wip_doc_header.replaceAll('{{last-update}}', last_commit_date);
617
620
  break;
618
621
  }
package/hdoc-module.js CHANGED
@@ -17,7 +17,9 @@
17
17
  axiosRetry(axios, {
18
18
  retries: 5,
19
19
  shouldResetTimeout: true,
20
- retryCondition: (_error) => true,
20
+ retryCondition: (error) => {
21
+ return !error.response.status;
22
+ },
21
23
  onRetry: (retryCount, error, requestConfig) => {
22
24
  retried = true;
23
25
  console.log(`\n[WARNING] API call failed - ${error.message}\nEndpoint: ${requestConfig.url}\nRetrying: ${retryCount}`);
@@ -288,7 +290,7 @@
288
290
  }
289
291
  } catch (err) {
290
292
  if (err.response) {
291
- if (err.response.status !== 403) {
293
+ if (err.response.status !== 403 && err.response.status !== 401) {
292
294
  response.error = err;
293
295
  return response;
294
296
  } else {
@@ -349,22 +351,22 @@
349
351
  response.success = true;
350
352
  let commits = github_response.data;
351
353
  commits.forEach(function (commit) {
352
- if (commit.committer && commit.committer.type && commit.committer.type.toLowerCase() === 'user' && commit.committer.login.toLowerCase() !== 'web-flow') {
353
- if (!contributors[commit.committer.id]) {
354
+ if (commit.type && commit.type.toLowerCase() === 'user' && commit.login.toLowerCase() !== 'web-flow') {
355
+ if (!contributors[commit.id]) {
354
356
  response.contributor_count++;
355
- contributors[commit.committer.id] = {
356
- login: commit.committer.login,
357
- avatar_url: commit.committer.avatar_url,
358
- html_url: commit.committer.html_url,
359
- name: commit.commit.committer.name
357
+ contributors[commit.id] = {
358
+ login: commit.login,
359
+ avatar_url: commit.avatar_url,
360
+ html_url: commit.html_url,
361
+ name: commit.name ? commit.name : commit.login
360
362
  };
361
363
  }
362
- if (response.last_commit_date !== '') {
363
- const new_commit_date = new Date(commit.commit.committer.date);
364
+ if (response.last_commit_date !== '' && response.last_commit_date !== 'No Commit Date Available') {
365
+ const new_commit_date = new Date(commit.date);
364
366
  const exist_commit_date = new Date(response.last_commit_date);
365
- if (new_commit_date > exist_commit_date) response.last_commit_date = commit.commit.committer.date;
367
+ if (new_commit_date > exist_commit_date) response.last_commit_date = commit.date;
366
368
  } else {
367
- response.last_commit_date = commit.commit.committer.date;
369
+ response.last_commit_date = commit.date ? commit.date : 'No Commit Date Available';
368
370
  }
369
371
  }
370
372
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hdoc-tools",
3
- "version": "0.17.6",
3
+ "version": "0.17.8",
4
4
  "description": "Hornbill HDocBook Development Support Tool",
5
5
  "main": "hdoc.js",
6
6
  "bin": {