bananareporter 0.4.2 → 0.4.4

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
@@ -103,7 +103,7 @@ $ npm install -g bananareporter
103
103
  $ bananareporter COMMAND
104
104
  running command...
105
105
  $ bananareporter (--version)
106
- bananareporter/0.4.2 linux-x64 node-v18.16.0
106
+ bananareporter/0.4.4 linux-x64 node-v18.16.0
107
107
  $ bananareporter --help [COMMAND]
108
108
  USAGE
109
109
  $ bananareporter COMMAND
@@ -162,5 +162,5 @@ EXAMPLES
162
162
  report with 138 entries saved to ./bananareporter.json
163
163
  ```
164
164
 
165
- _See code: [dist/commands/run/index.ts](https://github.com/nya1/bananareporter/blob/v0.4.2/dist/commands/run/index.ts)_
165
+ _See code: [dist/commands/run/index.ts](https://github.com/nya1/bananareporter/blob/v0.4.4/dist/commands/run/index.ts)_
166
166
  <!-- commandsstop -->
@@ -51,15 +51,31 @@ class GitCliIntegration extends base_1.IntegrationBase {
51
51
  // extract project name from directory
52
52
  const directory = path.basename(this.config.path);
53
53
  // execute git log
54
- const gitLogCommand = shell.exec(`git -C ${this.config.path} --no-pager log --branches="*" --author="${this.config.authorUsername}" --reverse --no-merges --source --format='{"commit": "%H","author": "%an","dateUnix": %at,"commitMessage": "%s","branch": "%S"},' --after="${fromDate.toISOString()}" --before="${toDate.toISOString()}"`, {
54
+ const gitLogCommand = shell.exec(`git -C ${this.config.path} --no-pager log --branches="*" --author="${this.config.authorUsername
55
+ // hash - author - date unix - commit message - branch
56
+ }" --reverse --no-merges --source --format='%H~~~~~%an~~~~~%at~~~~~%s~~~~~%S>%n%n' --after="${fromDate.toISOString()}" --before="${toDate.toISOString()}"`, {
55
57
  silent: true,
56
58
  });
57
59
  if (gitLogCommand.code !== 0) {
58
60
  throw new Error(`unable to execute git log to ${this.config.path}, output: ${gitLogCommand.stderr}`);
59
61
  }
60
- const parsedOutput = (gitLogCommand === null || gitLogCommand === void 0 ? void 0 : gitLogCommand.stdout) ? `[${gitLogCommand.stdout.slice(0, -2)}]` : '[]';
61
- logger_1.logger.debug('git log parsed output', { parsedOutput });
62
- const gitLogJson = JSON.parse(parsedOutput);
62
+ const gitLogJson = [];
63
+ if (gitLogCommand.stdout) {
64
+ for (const line of gitLogCommand.stdout.split('>\n\n')) {
65
+ const splitGit = line.split('~~~~~');
66
+ logger_1.logger.debug('git log', { splitGit });
67
+ if (splitGit.length !== 5) {
68
+ continue;
69
+ }
70
+ gitLogJson.push({
71
+ commit: splitGit[0].replace(/\n/g, ''),
72
+ author: splitGit[1],
73
+ dateUnix: Number(splitGit[2]),
74
+ commitMessage: splitGit[3],
75
+ branch: splitGit[4],
76
+ });
77
+ }
78
+ }
63
79
  return gitLogJson.map((e, i) => {
64
80
  // add project name
65
81
  e.projectName = directory;
@@ -67,10 +83,11 @@ class GitCliIntegration extends base_1.IntegrationBase {
67
83
  });
68
84
  }
69
85
  toBananaReporterObj(rawData, _index) {
86
+ const description = `${rawData.commitMessage} branch:${rawData.branch} git:${rawData.commit.slice(0, 7)}`;
70
87
  return {
71
88
  id: rawData.commit,
72
89
  date: dayjs.unix(rawData.dateUnix).toISOString(),
73
- description: rawData.commitMessage,
90
+ description: description,
74
91
  projectName: rawData.projectName,
75
92
  type: GitCliIntegration.type,
76
93
  __raw: this.bananaReporterConfig.includeRawObject ? rawData : undefined,
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.4.2",
2
+ "version": "0.4.4",
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.4.2",
3
+ "version": "0.4.4",
4
4
  "description": "Easily generate a report from multiple sources",
5
5
  "author": "nya1",
6
6
  "bin": {