bananareporter 0.3.0 → 0.3.1

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/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
  <a href="https://oclif.io"><img src="https://img.shields.io/badge/cli-oclif-brightgreen.svg" alt="oclif"/></a>
10
10
  <a href="https://npmjs.org/package/bananareporter"><img src="https://img.shields.io/npm/v/bananareporter.svg" alt="Version"/></a>
11
11
  <a href="https://github.com/nya1/bananareporter/actions/workflows/test.yml"><img src="https://github.com/nya1/bananareporter/actions/workflows/test.yml/badge.svg" alt="Github"/></a>
12
- <a href="https://npmjs.org/package/bananareporter"><img src="https://img.shields.io/npm/dw/bananareporter.svg" alt="Downloads/week"/></a>
12
+ <a href="https://npmjs.org/package/bananareporter"><img src="https://img.shields.io/npm/dt/bananareporter.svg" alt="Total Downloads"/></a>
13
13
  <a href="https://github.com/nya1/bananareporter/blob/main/package.json"><img src="https://img.shields.io/npm/l/bananareporter.svg" alt="License"/></a>
14
14
  </p>
15
15
 
@@ -102,7 +102,7 @@ $ npm install -g bananareporter
102
102
  $ bananareporter COMMAND
103
103
  running command...
104
104
  $ bananareporter (--version)
105
- bananareporter/0.3.0 linux-x64 node-v18.15.0
105
+ bananareporter/0.3.1 linux-x64 node-v18.15.0
106
106
  $ bananareporter --help [COMMAND]
107
107
  USAGE
108
108
  $ bananareporter COMMAND
@@ -161,5 +161,5 @@ EXAMPLES
161
161
  report with 138 entries saved to ./bananareporter.json
162
162
  ```
163
163
 
164
- _See code: [dist/commands/run/index.ts](https://github.com/nya1/bananareporter/blob/v0.3.0/dist/commands/run/index.ts)_
164
+ _See code: [dist/commands/run/index.ts](https://github.com/nya1/bananareporter/blob/v0.3.1/dist/commands/run/index.ts)_
165
165
  <!-- commandsstop -->
@@ -70,6 +70,8 @@ class Run extends core_1.Command {
70
70
  // eslint-disable-next-line unicorn/prefer-spread
71
71
  reportList = reportList.concat(res);
72
72
  }
73
+ // remove any duplicates (based on "id")
74
+ reportList = [...new Map(reportList.map(v => [v.id, v])).values()];
73
75
  if (reportList.length === 0) {
74
76
  this.warn('no entries found, make sure the date range provided and the sources are correct');
75
77
  return;
@@ -65,7 +65,6 @@ class GithubIntegration extends base_1.IntegrationBase {
65
65
  async fetchData() {
66
66
  let page = 1;
67
67
  let commitList = [];
68
- const commitShaList = new Set();
69
68
  while (page > 0) {
70
69
  logger_1.logger.debug(`github integration working on ${page}`);
71
70
  /* eslint-disable no-await-in-loop */
@@ -80,12 +79,7 @@ class GithubIntegration extends base_1.IntegrationBase {
80
79
  break;
81
80
  }
82
81
  // eslint-disable-next-line unicorn/prefer-spread
83
- commitList = commitList.concat(
84
- // remove duplicate items
85
- commits.items.filter(c => !commitShaList.has(c.sha)));
86
- for (const c of commits.items) {
87
- commitShaList.add(c.sha);
88
- }
82
+ commitList = commitList.concat(commits.items);
89
83
  logger_1.logger.debug(`github integration commitList ${commitList.length} (added ${commits.items.length} commits)`);
90
84
  page += 1;
91
85
  await (0, common_1.delay)(this.delayToUse);
@@ -88,7 +88,6 @@ class GitlabIntegration extends base_1.IntegrationBase {
88
88
  let page = 1;
89
89
  let eventList = [];
90
90
  const projectIds = new Set();
91
- const commitShaList = new Set();
92
91
  while (page > 0) {
93
92
  logger_1.logger.debug(`gitlab integration working on ${page}`);
94
93
  /* eslint-disable no-await-in-loop */
@@ -103,11 +102,8 @@ class GitlabIntegration extends base_1.IntegrationBase {
103
102
  break;
104
103
  }
105
104
  // eslint-disable-next-line unicorn/prefer-spread
106
- eventList = eventList.concat(
107
- // remove duplicated commits
108
- events.filter(e => !commitShaList.has(e.push_data.commit_to)));
105
+ eventList = eventList.concat(events);
109
106
  for (const e of events) {
110
- commitShaList.add(e.push_data.commit_to);
111
107
  projectIds.add(e.project_id);
112
108
  }
113
109
  logger_1.logger.debug(`gitlab integration eventList ${eventList.length} (added ${events.length} events)`);
@@ -81,7 +81,7 @@ class TodoTxtIntegration extends base_1.IntegrationBase {
81
81
  const projectName = (_a = rawData.projects) === null || _a === void 0 ? void 0 : _a.map(p => p.replace('+', '')).join(',');
82
82
  const description = `${rawData.description}`;
83
83
  return {
84
- id: `${index}`,
84
+ id: `${this.config.file}_${index}`,
85
85
  date: rawData.completion || rawData.creation || '',
86
86
  description,
87
87
  projectName,
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.3.0",
2
+ "version": "0.3.1",
3
3
  "commands": {
4
4
  "run": {
5
5
  "id": "run",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bananareporter",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Easily generate a report from multiple sources",
5
5
  "author": "nya1",
6
6
  "bin": {