bananareporter 0.1.2 → 0.2.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 +29 -6
- package/dist/commands/run/index.d.ts +1 -0
- package/dist/commands/run/index.js +12 -0
- package/dist/core/index.d.ts +41 -69
- package/dist/integrations/github.d.ts +10 -10
- package/dist/integrations/gitlab.d.ts +13 -13
- package/dist/integrations/todotxt.d.ts +5 -5
- package/oclif.manifest.json +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
@@ -26,8 +26,8 @@
|
|
26
26
|
- **Multiple output formats**: output file can be a JSON, JSONL or CSV (via `--format`) _more coming soon_
|
27
27
|
- **Configurable**: data to be imported can be filtered using the configuration file and each option can be overridden per source
|
28
28
|
- **Sources Supported**
|
29
|
-
- GitLab: commits
|
30
|
-
- GitHub: commits
|
29
|
+
- [GitLab](./docs/sources/gitlab.md): commits
|
30
|
+
- [GitHub](./docs/sources/github.md): commits
|
31
31
|
- todo.txt: tasks
|
32
32
|
- **[Request a new source](https://github.com/nya1/bananareporter/issues/new?assignees=&labels=enhancement&template=new-source-request.md&title=)**
|
33
33
|
|
@@ -67,7 +67,30 @@ sources:
|
|
67
67
|
bananareporter --from 2023-01-01 --to 2023-03-01 -c bananareporter.yaml
|
68
68
|
```
|
69
69
|
|
70
|
-
In the current directory you will find the output as `bananareporter_$FROM__$TO.json
|
70
|
+
In the current directory you will find the output as `bananareporter_$FROM__$TO.json` (can be changed with `--out`)
|
71
|
+
|
72
|
+
Example of output (json) with gitlab and github sources:
|
73
|
+
|
74
|
+
```json
|
75
|
+
[
|
76
|
+
{
|
77
|
+
"date": "2023-01-13T07:51:21.730Z",
|
78
|
+
"username": "johndoe",
|
79
|
+
"description": "chore: update changelog and swagger branch:work git:aa33b04",
|
80
|
+
"projectId": "3318214",
|
81
|
+
"projectName": "awesome-frontend",
|
82
|
+
"type": "gitlab"
|
83
|
+
},
|
84
|
+
{
|
85
|
+
"date": "2023-01-14T10:50:10.230Z",
|
86
|
+
"username": "johndoe2",
|
87
|
+
"description": "refactor: compare date function branch:work git:ia1f241",
|
88
|
+
"projectId": "928544",
|
89
|
+
"projectName": "awesome-backend",
|
90
|
+
"type": "github"
|
91
|
+
}
|
92
|
+
]
|
93
|
+
```
|
71
94
|
|
72
95
|
|
73
96
|
# Usage
|
@@ -77,7 +100,7 @@ $ npm install -g bananareporter
|
|
77
100
|
$ bananareporter COMMAND
|
78
101
|
running command...
|
79
102
|
$ bananareporter (--version)
|
80
|
-
bananareporter/0.1
|
103
|
+
bananareporter/0.2.1 linux-x64 node-v18.14.2
|
81
104
|
$ bananareporter --help [COMMAND]
|
82
105
|
USAGE
|
83
106
|
$ bananareporter COMMAND
|
@@ -107,7 +130,7 @@ DESCRIPTION
|
|
107
130
|
Display help for bananareporter.
|
108
131
|
```
|
109
132
|
|
110
|
-
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v5.2.
|
133
|
+
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v5.2.8/src/commands/help.ts)_
|
111
134
|
|
112
135
|
## `bananareporter run`
|
113
136
|
|
@@ -136,5 +159,5 @@ EXAMPLES
|
|
136
159
|
report with 138 entries saved to ./bananareporter.json
|
137
160
|
```
|
138
161
|
|
139
|
-
_See code: [dist/commands/run/index.ts](https://github.com/nya1/bananareporter/blob/v0.1
|
162
|
+
_See code: [dist/commands/run/index.ts](https://github.com/nya1/bananareporter/blob/v0.2.1/dist/commands/run/index.ts)_
|
140
163
|
<!-- commandsstop -->
|
@@ -13,6 +13,7 @@ const lodash_1 = require("lodash");
|
|
13
13
|
const logger_1 = require("../../util/logger");
|
14
14
|
const github_1 = require("../../integrations/github");
|
15
15
|
const todotxt_1 = require("../../integrations/todotxt");
|
16
|
+
const zod_1 = require("zod");
|
16
17
|
class Run extends core_1.Command {
|
17
18
|
static dateStringValidation(input) {
|
18
19
|
if (!dayjs(input).isValid()) {
|
@@ -72,6 +73,10 @@ class Run extends core_1.Command {
|
|
72
73
|
this.warn('no entries found, make sure the date range provided and the sources are correct');
|
73
74
|
return;
|
74
75
|
}
|
76
|
+
// re order by date ASC
|
77
|
+
reportList.sort((a, b) => {
|
78
|
+
return dayjs(a.date).diff(b.date);
|
79
|
+
});
|
75
80
|
// output
|
76
81
|
let outputStr = '';
|
77
82
|
// eslint-disable-next-line unicorn/prefer-switch
|
@@ -110,6 +115,13 @@ class Run extends core_1.Command {
|
|
110
115
|
this.log(`report with ${reportList.length} entries saved to ${outFile}`);
|
111
116
|
// this.log(`run! ${flags.config} ${JSON.stringify(configContent)}`)
|
112
117
|
}
|
118
|
+
async catch(error) {
|
119
|
+
if (error instanceof zod_1.z.ZodError) {
|
120
|
+
const errMsg = error.issues.map(i => `${i.message}: ${i.path.join(', ')}`).join('\n');
|
121
|
+
throw new TypeError(`validation failed, ${errMsg}`);
|
122
|
+
}
|
123
|
+
throw error;
|
124
|
+
}
|
113
125
|
}
|
114
126
|
exports.default = Run;
|
115
127
|
Run.description = 'Run report';
|
package/dist/core/index.d.ts
CHANGED
@@ -24,15 +24,11 @@ export declare const BananaConfig: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
24
24
|
*/
|
25
25
|
sources: z.ZodArray<z.ZodObject<{
|
26
26
|
type: z.ZodEnum<["gitlab", "github", "todo.txt"]>;
|
27
|
-
}, "passthrough", z.ZodTypeAny, {
|
28
|
-
type: "gitlab"
|
29
|
-
}
|
30
|
-
|
31
|
-
},
|
32
|
-
type: "gitlab" | "github" | "todo.txt";
|
33
|
-
} & {
|
34
|
-
[k: string]: unknown;
|
35
|
-
}>, "atleastone">;
|
27
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
28
|
+
type: z.ZodEnum<["gitlab", "github", "todo.txt"]>;
|
29
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
30
|
+
type: z.ZodEnum<["gitlab", "github", "todo.txt"]>;
|
31
|
+
}, z.ZodTypeAny, "passthrough">>, "atleastone">;
|
36
32
|
}, "strip", z.ZodTypeAny, {
|
37
33
|
format: "json" | "csv" | "jsonl";
|
38
34
|
from: string;
|
@@ -41,32 +37,24 @@ export declare const BananaConfig: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
41
37
|
to: string;
|
42
38
|
configFileLocation: string;
|
43
39
|
delay: number;
|
44
|
-
sources: [{
|
45
|
-
type: "gitlab"
|
46
|
-
}
|
47
|
-
|
48
|
-
},
|
49
|
-
type: "gitlab" | "github" | "todo.txt";
|
50
|
-
} & {
|
51
|
-
[k: string]: unknown;
|
52
|
-
})[]];
|
40
|
+
sources: [z.objectOutputType<{
|
41
|
+
type: z.ZodEnum<["gitlab", "github", "todo.txt"]>;
|
42
|
+
}, z.ZodTypeAny, "passthrough">, ...z.objectOutputType<{
|
43
|
+
type: z.ZodEnum<["gitlab", "github", "todo.txt"]>;
|
44
|
+
}, z.ZodTypeAny, "passthrough">[]];
|
53
45
|
}, {
|
54
|
-
includeRawObject?: boolean | undefined;
|
55
|
-
delay?: number | undefined;
|
56
46
|
format: "json" | "csv" | "jsonl";
|
57
47
|
from: string;
|
58
48
|
out: string;
|
59
49
|
to: string;
|
60
50
|
configFileLocation: string;
|
61
|
-
sources: [{
|
62
|
-
type: "gitlab"
|
63
|
-
}
|
64
|
-
|
65
|
-
},
|
66
|
-
|
67
|
-
|
68
|
-
[k: string]: unknown;
|
69
|
-
})[]];
|
51
|
+
sources: [z.objectInputType<{
|
52
|
+
type: z.ZodEnum<["gitlab", "github", "todo.txt"]>;
|
53
|
+
}, z.ZodTypeAny, "passthrough">, ...z.objectInputType<{
|
54
|
+
type: z.ZodEnum<["gitlab", "github", "todo.txt"]>;
|
55
|
+
}, z.ZodTypeAny, "passthrough">[]];
|
56
|
+
includeRawObject?: boolean | undefined;
|
57
|
+
delay?: number | undefined;
|
70
58
|
}>, {
|
71
59
|
format: "json" | "csv" | "jsonl";
|
72
60
|
from: string;
|
@@ -75,32 +63,24 @@ export declare const BananaConfig: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
75
63
|
to: string;
|
76
64
|
configFileLocation: string;
|
77
65
|
delay: number;
|
78
|
-
sources: [{
|
79
|
-
type: "gitlab"
|
80
|
-
}
|
81
|
-
|
82
|
-
},
|
83
|
-
type: "gitlab" | "github" | "todo.txt";
|
84
|
-
} & {
|
85
|
-
[k: string]: unknown;
|
86
|
-
})[]];
|
66
|
+
sources: [z.objectOutputType<{
|
67
|
+
type: z.ZodEnum<["gitlab", "github", "todo.txt"]>;
|
68
|
+
}, z.ZodTypeAny, "passthrough">, ...z.objectOutputType<{
|
69
|
+
type: z.ZodEnum<["gitlab", "github", "todo.txt"]>;
|
70
|
+
}, z.ZodTypeAny, "passthrough">[]];
|
87
71
|
}, {
|
88
|
-
includeRawObject?: boolean | undefined;
|
89
|
-
delay?: number | undefined;
|
90
72
|
format: "json" | "csv" | "jsonl";
|
91
73
|
from: string;
|
92
74
|
out: string;
|
93
75
|
to: string;
|
94
76
|
configFileLocation: string;
|
95
|
-
sources: [{
|
96
|
-
type: "gitlab"
|
97
|
-
}
|
98
|
-
|
99
|
-
},
|
100
|
-
|
101
|
-
|
102
|
-
[k: string]: unknown;
|
103
|
-
})[]];
|
77
|
+
sources: [z.objectInputType<{
|
78
|
+
type: z.ZodEnum<["gitlab", "github", "todo.txt"]>;
|
79
|
+
}, z.ZodTypeAny, "passthrough">, ...z.objectInputType<{
|
80
|
+
type: z.ZodEnum<["gitlab", "github", "todo.txt"]>;
|
81
|
+
}, z.ZodTypeAny, "passthrough">[]];
|
82
|
+
includeRawObject?: boolean | undefined;
|
83
|
+
delay?: number | undefined;
|
104
84
|
}>, {
|
105
85
|
format: "json" | "csv" | "jsonl";
|
106
86
|
from: string;
|
@@ -109,32 +89,24 @@ export declare const BananaConfig: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
109
89
|
to: string;
|
110
90
|
configFileLocation: string;
|
111
91
|
delay: number;
|
112
|
-
sources: [{
|
113
|
-
type: "gitlab"
|
114
|
-
}
|
115
|
-
|
116
|
-
},
|
117
|
-
type: "gitlab" | "github" | "todo.txt";
|
118
|
-
} & {
|
119
|
-
[k: string]: unknown;
|
120
|
-
})[]];
|
92
|
+
sources: [z.objectOutputType<{
|
93
|
+
type: z.ZodEnum<["gitlab", "github", "todo.txt"]>;
|
94
|
+
}, z.ZodTypeAny, "passthrough">, ...z.objectOutputType<{
|
95
|
+
type: z.ZodEnum<["gitlab", "github", "todo.txt"]>;
|
96
|
+
}, z.ZodTypeAny, "passthrough">[]];
|
121
97
|
}, {
|
122
|
-
includeRawObject?: boolean | undefined;
|
123
|
-
delay?: number | undefined;
|
124
98
|
format: "json" | "csv" | "jsonl";
|
125
99
|
from: string;
|
126
100
|
out: string;
|
127
101
|
to: string;
|
128
102
|
configFileLocation: string;
|
129
|
-
sources: [{
|
130
|
-
type: "gitlab"
|
131
|
-
}
|
132
|
-
|
133
|
-
},
|
134
|
-
|
135
|
-
|
136
|
-
[k: string]: unknown;
|
137
|
-
})[]];
|
103
|
+
sources: [z.objectInputType<{
|
104
|
+
type: z.ZodEnum<["gitlab", "github", "todo.txt"]>;
|
105
|
+
}, z.ZodTypeAny, "passthrough">, ...z.objectInputType<{
|
106
|
+
type: z.ZodEnum<["gitlab", "github", "todo.txt"]>;
|
107
|
+
}, z.ZodTypeAny, "passthrough">[]];
|
108
|
+
includeRawObject?: boolean | undefined;
|
109
|
+
delay?: number | undefined;
|
138
110
|
}>;
|
139
111
|
export type BananaConfig = z.infer<typeof BananaConfig>;
|
140
112
|
export declare function loadAndValidateConfig(input: unknown): BananaConfig;
|
@@ -167,9 +167,10 @@ export declare const GithubConfig: z.ZodObject<{
|
|
167
167
|
to: z.ZodOptional<z.ZodString>;
|
168
168
|
delay: z.ZodOptional<z.ZodNumber>;
|
169
169
|
}, "strip", z.ZodTypeAny, {
|
170
|
-
|
171
|
-
|
172
|
-
|
170
|
+
protocol: "http" | "https";
|
171
|
+
committerUsername: string;
|
172
|
+
domain: string;
|
173
|
+
apiVersion: string;
|
173
174
|
token?: string | undefined;
|
174
175
|
filters?: [{
|
175
176
|
on: string;
|
@@ -178,15 +179,11 @@ export declare const GithubConfig: z.ZodObject<{
|
|
178
179
|
on: string;
|
179
180
|
regex: string;
|
180
181
|
}[]] | undefined;
|
181
|
-
protocol: "http" | "https";
|
182
|
-
committerUsername: string;
|
183
|
-
domain: string;
|
184
|
-
apiVersion: string;
|
185
|
-
}, {
|
186
182
|
from?: string | undefined;
|
187
|
-
protocol?: "http" | "https" | undefined;
|
188
183
|
to?: string | undefined;
|
189
184
|
delay?: number | undefined;
|
185
|
+
}, {
|
186
|
+
committerUsername: string;
|
190
187
|
token?: string | undefined;
|
191
188
|
filters?: [{
|
192
189
|
on: string;
|
@@ -197,7 +194,10 @@ export declare const GithubConfig: z.ZodObject<{
|
|
197
194
|
}[]] | undefined;
|
198
195
|
domain?: string | undefined;
|
199
196
|
apiVersion?: string | undefined;
|
200
|
-
|
197
|
+
protocol?: "http" | "https" | undefined;
|
198
|
+
from?: string | undefined;
|
199
|
+
to?: string | undefined;
|
200
|
+
delay?: number | undefined;
|
201
201
|
}>;
|
202
202
|
export declare class GithubIntegration extends IntegrationBase {
|
203
203
|
static type: "github";
|
@@ -54,9 +54,12 @@ export declare const GitlabConfig: z.ZodObject<{
|
|
54
54
|
to: z.ZodOptional<z.ZodString>;
|
55
55
|
delay: z.ZodOptional<z.ZodNumber>;
|
56
56
|
}, "strip", z.ZodTypeAny, {
|
57
|
-
|
58
|
-
|
59
|
-
|
57
|
+
protocol: "http" | "https";
|
58
|
+
committerUsername: string;
|
59
|
+
token: string;
|
60
|
+
domain: string;
|
61
|
+
apiVersion: string;
|
62
|
+
apiBasePath: string;
|
60
63
|
userId?: number | undefined;
|
61
64
|
filters?: [{
|
62
65
|
on: string;
|
@@ -65,17 +68,12 @@ export declare const GitlabConfig: z.ZodObject<{
|
|
65
68
|
on: string;
|
66
69
|
regex: string;
|
67
70
|
}[]] | undefined;
|
68
|
-
protocol: "http" | "https";
|
69
|
-
committerUsername: string;
|
70
|
-
token: string;
|
71
|
-
domain: string;
|
72
|
-
apiVersion: string;
|
73
|
-
apiBasePath: string;
|
74
|
-
}, {
|
75
71
|
from?: string | undefined;
|
76
|
-
protocol?: "http" | "https" | undefined;
|
77
72
|
to?: string | undefined;
|
78
73
|
delay?: number | undefined;
|
74
|
+
}, {
|
75
|
+
committerUsername: string;
|
76
|
+
token: string;
|
79
77
|
userId?: number | undefined;
|
80
78
|
filters?: [{
|
81
79
|
on: string;
|
@@ -86,9 +84,11 @@ export declare const GitlabConfig: z.ZodObject<{
|
|
86
84
|
}[]] | undefined;
|
87
85
|
domain?: string | undefined;
|
88
86
|
apiVersion?: string | undefined;
|
87
|
+
protocol?: "http" | "https" | undefined;
|
89
88
|
apiBasePath?: string | undefined;
|
90
|
-
|
91
|
-
|
89
|
+
from?: string | undefined;
|
90
|
+
to?: string | undefined;
|
91
|
+
delay?: number | undefined;
|
92
92
|
}>;
|
93
93
|
export declare class GitlabIntegration extends IntegrationBase {
|
94
94
|
static type: "gitlab";
|
@@ -18,8 +18,7 @@ export declare const TodoTxtConfig: z.ZodObject<{
|
|
18
18
|
from: z.ZodOptional<z.ZodString>;
|
19
19
|
to: z.ZodOptional<z.ZodString>;
|
20
20
|
}, "strip", z.ZodTypeAny, {
|
21
|
-
|
22
|
-
to?: string | undefined;
|
21
|
+
file: string;
|
23
22
|
filters?: [{
|
24
23
|
on: string;
|
25
24
|
regex: string;
|
@@ -27,11 +26,10 @@ export declare const TodoTxtConfig: z.ZodObject<{
|
|
27
26
|
on: string;
|
28
27
|
regex: string;
|
29
28
|
}[]] | undefined;
|
30
|
-
file: string;
|
31
|
-
}, {
|
32
|
-
file?: string | undefined;
|
33
29
|
from?: string | undefined;
|
34
30
|
to?: string | undefined;
|
31
|
+
}, {
|
32
|
+
file?: string | undefined;
|
35
33
|
filters?: [{
|
36
34
|
on: string;
|
37
35
|
regex: string;
|
@@ -39,6 +37,8 @@ export declare const TodoTxtConfig: z.ZodObject<{
|
|
39
37
|
on: string;
|
40
38
|
regex: string;
|
41
39
|
}[]] | undefined;
|
40
|
+
from?: string | undefined;
|
41
|
+
to?: string | undefined;
|
42
42
|
}>;
|
43
43
|
export declare class TodoTxtIntegration extends IntegrationBase {
|
44
44
|
static type: "todo.txt";
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "bananareporter",
|
3
|
-
"version": "0.1
|
3
|
+
"version": "0.2.1",
|
4
4
|
"description": "Easily generate a report from multiple sources",
|
5
5
|
"author": "nya1",
|
6
6
|
"bin": {
|
@@ -27,14 +27,14 @@
|
|
27
27
|
"object-path": "^0.11.8",
|
28
28
|
"papaparse": "^5.4.0",
|
29
29
|
"winston": "^3.8.2",
|
30
|
-
"zod": "^3.21.
|
30
|
+
"zod": "^3.21.4"
|
31
31
|
},
|
32
32
|
"devDependencies": {
|
33
|
-
"@oclif/test": "^2.3.
|
33
|
+
"@oclif/test": "^2.3.10",
|
34
34
|
"@types/chai": "^4",
|
35
35
|
"@types/js-yaml": "^4.0.5",
|
36
36
|
"@types/mocha": "^9.1.1",
|
37
|
-
"@types/node": "^18.
|
37
|
+
"@types/node": "^18.15.0",
|
38
38
|
"@types/node-fetch": "^2.6.2",
|
39
39
|
"@types/object-path": "^0.11.1",
|
40
40
|
"@types/papaparse": "^5.3.7",
|