@herodevs/cli 0.1.16 → 0.2.1-rc2
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 +13 -334
- package/dist/commands/{committer/get-all.d.ts → report/committers.d.ts} +8 -5
- package/dist/commands/report/committers.js +190 -0
- package/dist/package.json +17 -10
- package/dist/shared/command/base-command.d.ts +1 -1
- package/dist/shared/lib/version-update.js +14 -6
- package/oclif.manifest.json +12 -43
- package/package.json +17 -10
- package/dist/commands/committer/get-all.js +0 -96
- package/dist/commands/committer/index.d.ts +0 -9
- package/dist/commands/committer/index.js +0 -15
package/README.md
CHANGED
|
@@ -1,356 +1,35 @@
|
|
|
1
|
-
# HeroDevs
|
|
1
|
+
# HeroDevs CLI -- `@herodevs/cli`
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
[](https://circleci.com/gh/oclif/hello-world/tree/main)
|
|
5
|
-
[](https://github.com/oclif/hello-world/blob/main/LICENSE) -->
|
|
3
|
+
## Installation
|
|
6
4
|
|
|
7
|
-
<!-- toc -->
|
|
8
|
-
* [HeroDevs NES Developer Kit -- `@herodevs/cli`](#herodevs-nes-developer-kit----herodevscli)
|
|
9
|
-
* [Usage](#usage)
|
|
10
|
-
* [Commands](#commands)
|
|
11
|
-
<!-- tocstop -->
|
|
12
|
-
|
|
13
|
-
# Usage
|
|
14
|
-
|
|
15
|
-
<!-- usage -->
|
|
16
|
-
```sh-session
|
|
17
|
-
$ npm install -g @herodevs/cli
|
|
18
|
-
$ @herodevs/cli COMMAND
|
|
19
|
-
running command...
|
|
20
|
-
$ @herodevs/cli (--version)
|
|
21
|
-
@herodevs/cli/0.1.16 darwin-arm64 node-v18.17.1
|
|
22
|
-
$ @herodevs/cli --help [COMMAND]
|
|
23
|
-
USAGE
|
|
24
|
-
$ @herodevs/cli COMMAND
|
|
25
|
-
...
|
|
26
|
-
```
|
|
27
|
-
<!-- usagestop -->
|
|
28
|
-
|
|
29
|
-
# Commands
|
|
30
|
-
|
|
31
|
-
<!-- commands -->
|
|
32
|
-
* [`@herodevs/cli committer [GET-ALL]`](#herodevscli-committer-get-all)
|
|
33
|
-
* [`@herodevs/cli committer:get-all [flags [-s][-e][-x]]`](#herodevscli-committerget-all-flags--s-e-x)
|
|
34
|
-
* [`@herodevs/cli help [COMMANDS]`](#herodevscli-help-commands)
|
|
35
|
-
* [`@herodevs/cli plugins`](#herodevscli-plugins)
|
|
36
|
-
* [`@herodevs/cli plugins:install PLUGIN...`](#herodevscli-pluginsinstall-plugin)
|
|
37
|
-
* [`@herodevs/cli plugins:inspect PLUGIN...`](#herodevscli-pluginsinspect-plugin)
|
|
38
|
-
* [`@herodevs/cli plugins:install PLUGIN...`](#herodevscli-pluginsinstall-plugin-1)
|
|
39
|
-
* [`@herodevs/cli plugins:link PLUGIN`](#herodevscli-pluginslink-plugin)
|
|
40
|
-
* [`@herodevs/cli plugins:uninstall PLUGIN...`](#herodevscli-pluginsuninstall-plugin)
|
|
41
|
-
* [`@herodevs/cli plugins:uninstall PLUGIN...`](#herodevscli-pluginsuninstall-plugin-1)
|
|
42
|
-
* [`@herodevs/cli plugins:uninstall PLUGIN...`](#herodevscli-pluginsuninstall-plugin-2)
|
|
43
|
-
* [`@herodevs/cli plugins update`](#herodevscli-plugins-update)
|
|
44
|
-
|
|
45
|
-
## `@herodevs/cli committer [GET-ALL]`
|
|
46
|
-
|
|
47
|
-
Gets committer info
|
|
48
|
-
|
|
49
|
-
```
|
|
50
|
-
USAGE
|
|
51
|
-
$ @herodevs/cli committer [GET-ALL] [--json] [--log-level debug|info|warn|error]
|
|
52
|
-
|
|
53
|
-
GLOBAL FLAGS
|
|
54
|
-
--json Format output as json.
|
|
55
|
-
--log-level=<option> Specify level for logging.
|
|
56
|
-
<options: debug|info|warn|error>
|
|
57
|
-
|
|
58
|
-
DESCRIPTION
|
|
59
|
-
Gets committer info
|
|
60
|
-
|
|
61
|
-
EXAMPLES
|
|
62
|
-
$ @herodevs/cli committer
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
_See code: [dist/commands/committer/index.ts](https://github.com/herodevs/cli/blob/v0.1.16/dist/commands/committer/index.ts)_
|
|
66
|
-
|
|
67
|
-
## `@herodevs/cli committer:get-all [flags [-s][-e][-x]]`
|
|
68
|
-
|
|
69
|
-
Get Committers Between Two Dates
|
|
70
|
-
|
|
71
|
-
```
|
|
72
|
-
USAGE
|
|
73
|
-
$ @herodevs/cli committer get-all [flags [-s][-e][-x]]
|
|
74
|
-
|
|
75
|
-
FLAGS
|
|
76
|
-
-e, --endDate=<value> [default: 2022-09-01] End Date (format: yyyy-MM-dd)
|
|
77
|
-
-s, --startDate=<value> [default: 2023-09-01] Start Date (format: yyyy-MM-dd)
|
|
78
|
-
-x, --exclude=<value>... Path Exclusions (eg -x="./src/bin" -x="./dist")
|
|
79
|
-
|
|
80
|
-
GLOBAL FLAGS
|
|
81
|
-
--json Format output as json.
|
|
82
|
-
--log-level=<option> Specify level for logging.
|
|
83
|
-
<options: debug|info|warn|error>
|
|
84
|
-
|
|
85
|
-
EXAMPLES
|
|
86
|
-
$ @herodevs/cli committer get-all
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
_See code: [dist/commands/committer/get-all.ts](https://github.com/herodevs/cli/blob/v0.1.16/dist/commands/committer/get-all.ts)_
|
|
90
|
-
|
|
91
|
-
## `@herodevs/cli help [COMMANDS]`
|
|
92
|
-
|
|
93
|
-
Display help for @herodevs/cli.
|
|
94
|
-
|
|
95
|
-
```
|
|
96
|
-
USAGE
|
|
97
|
-
$ @herodevs/cli help [COMMANDS] [-n]
|
|
98
|
-
|
|
99
|
-
ARGUMENTS
|
|
100
|
-
COMMANDS Command to show help for.
|
|
101
|
-
|
|
102
|
-
FLAGS
|
|
103
|
-
-n, --nested-commands Include all nested commands in the output.
|
|
104
|
-
|
|
105
|
-
DESCRIPTION
|
|
106
|
-
Display help for @herodevs/cli.
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v5.2.16/src/commands/help.ts)_
|
|
110
|
-
|
|
111
|
-
## `@herodevs/cli plugins`
|
|
112
|
-
|
|
113
|
-
List installed plugins.
|
|
114
|
-
|
|
115
|
-
```
|
|
116
|
-
USAGE
|
|
117
|
-
$ @herodevs/cli plugins [--json] [--core]
|
|
118
|
-
|
|
119
|
-
FLAGS
|
|
120
|
-
--core Show core plugins.
|
|
121
|
-
|
|
122
|
-
GLOBAL FLAGS
|
|
123
|
-
--json Format output as json.
|
|
124
|
-
|
|
125
|
-
DESCRIPTION
|
|
126
|
-
List installed plugins.
|
|
127
|
-
|
|
128
|
-
EXAMPLES
|
|
129
|
-
$ @herodevs/cli plugins
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v3.2.5/src/commands/plugins/index.ts)_
|
|
133
|
-
|
|
134
|
-
## `@herodevs/cli plugins:install PLUGIN...`
|
|
135
|
-
|
|
136
|
-
Installs a plugin into the CLI.
|
|
137
|
-
|
|
138
|
-
```
|
|
139
|
-
USAGE
|
|
140
|
-
$ @herodevs/cli plugins:install PLUGIN...
|
|
141
|
-
|
|
142
|
-
ARGUMENTS
|
|
143
|
-
PLUGIN Plugin to install.
|
|
144
|
-
|
|
145
|
-
FLAGS
|
|
146
|
-
-f, --force Run yarn install with force flag.
|
|
147
|
-
-h, --help Show CLI help.
|
|
148
|
-
-v, --verbose
|
|
149
|
-
|
|
150
|
-
DESCRIPTION
|
|
151
|
-
Installs a plugin into the CLI.
|
|
152
|
-
Can be installed from npm or a git url.
|
|
153
|
-
|
|
154
|
-
Installation of a user-installed plugin will override a core plugin.
|
|
155
|
-
|
|
156
|
-
e.g. If you have a core plugin that has a 'hello' command, installing a user-installed plugin with a 'hello' command
|
|
157
|
-
will override the core plugin implementation. This is useful if a user needs to update core plugin functionality in
|
|
158
|
-
the CLI without the need to patch and update the whole CLI.
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
ALIASES
|
|
162
|
-
$ @herodevs/cli plugins add
|
|
163
|
-
|
|
164
|
-
EXAMPLES
|
|
165
|
-
$ @herodevs/cli plugins:install myplugin
|
|
166
|
-
|
|
167
|
-
$ @herodevs/cli plugins:install https://github.com/someuser/someplugin
|
|
168
|
-
|
|
169
|
-
$ @herodevs/cli plugins:install someuser/someplugin
|
|
170
5
|
```
|
|
171
|
-
|
|
172
|
-
## `@herodevs/cli plugins:inspect PLUGIN...`
|
|
173
|
-
|
|
174
|
-
Displays installation properties of a plugin.
|
|
175
|
-
|
|
176
|
-
```
|
|
177
|
-
USAGE
|
|
178
|
-
$ @herodevs/cli plugins:inspect PLUGIN...
|
|
179
|
-
|
|
180
|
-
ARGUMENTS
|
|
181
|
-
PLUGIN [default: .] Plugin to inspect.
|
|
182
|
-
|
|
183
|
-
FLAGS
|
|
184
|
-
-h, --help Show CLI help.
|
|
185
|
-
-v, --verbose
|
|
186
|
-
|
|
187
|
-
GLOBAL FLAGS
|
|
188
|
-
--json Format output as json.
|
|
189
|
-
|
|
190
|
-
DESCRIPTION
|
|
191
|
-
Displays installation properties of a plugin.
|
|
192
|
-
|
|
193
|
-
EXAMPLES
|
|
194
|
-
$ @herodevs/cli plugins:inspect myplugin
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v3.2.5/src/commands/plugins/inspect.ts)_
|
|
198
|
-
|
|
199
|
-
## `@herodevs/cli plugins:install PLUGIN...`
|
|
200
|
-
|
|
201
|
-
Installs a plugin into the CLI.
|
|
202
|
-
|
|
203
|
-
```
|
|
204
|
-
USAGE
|
|
205
|
-
$ @herodevs/cli plugins:install PLUGIN...
|
|
206
|
-
|
|
207
|
-
ARGUMENTS
|
|
208
|
-
PLUGIN Plugin to install.
|
|
209
|
-
|
|
210
|
-
FLAGS
|
|
211
|
-
-f, --force Run yarn install with force flag.
|
|
212
|
-
-h, --help Show CLI help.
|
|
213
|
-
-v, --verbose
|
|
214
|
-
|
|
215
|
-
DESCRIPTION
|
|
216
|
-
Installs a plugin into the CLI.
|
|
217
|
-
Can be installed from npm or a git url.
|
|
218
|
-
|
|
219
|
-
Installation of a user-installed plugin will override a core plugin.
|
|
220
|
-
|
|
221
|
-
e.g. If you have a core plugin that has a 'hello' command, installing a user-installed plugin with a 'hello' command
|
|
222
|
-
will override the core plugin implementation. This is useful if a user needs to update core plugin functionality in
|
|
223
|
-
the CLI without the need to patch and update the whole CLI.
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
ALIASES
|
|
227
|
-
$ @herodevs/cli plugins add
|
|
228
|
-
|
|
229
|
-
EXAMPLES
|
|
230
|
-
$ @herodevs/cli plugins:install myplugin
|
|
231
|
-
|
|
232
|
-
$ @herodevs/cli plugins:install https://github.com/someuser/someplugin
|
|
233
|
-
|
|
234
|
-
$ @herodevs/cli plugins:install someuser/someplugin
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v3.2.5/src/commands/plugins/install.ts)_
|
|
238
|
-
|
|
239
|
-
## `@herodevs/cli plugins:link PLUGIN`
|
|
240
|
-
|
|
241
|
-
Links a plugin into the CLI for development.
|
|
242
|
-
|
|
243
|
-
```
|
|
244
|
-
USAGE
|
|
245
|
-
$ @herodevs/cli plugins:link PLUGIN
|
|
246
|
-
|
|
247
|
-
ARGUMENTS
|
|
248
|
-
PATH [default: .] path to plugin
|
|
249
|
-
|
|
250
|
-
FLAGS
|
|
251
|
-
-h, --help Show CLI help.
|
|
252
|
-
-v, --verbose
|
|
253
|
-
|
|
254
|
-
DESCRIPTION
|
|
255
|
-
Links a plugin into the CLI for development.
|
|
256
|
-
Installation of a linked plugin will override a user-installed or core plugin.
|
|
257
|
-
|
|
258
|
-
e.g. If you have a user-installed or core plugin that has a 'hello' command, installing a linked plugin with a 'hello'
|
|
259
|
-
command will override the user-installed or core plugin implementation. This is useful for development work.
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
EXAMPLES
|
|
263
|
-
$ @herodevs/cli plugins:link myplugin
|
|
6
|
+
npm install -g @herodevs/cli
|
|
264
7
|
```
|
|
265
8
|
|
|
266
|
-
|
|
9
|
+
## Usage
|
|
267
10
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
Removes a plugin from the CLI.
|
|
11
|
+
after global installation
|
|
271
12
|
|
|
272
13
|
```
|
|
273
|
-
|
|
274
|
-
$ @herodevs/cli plugins:uninstall PLUGIN...
|
|
275
|
-
|
|
276
|
-
ARGUMENTS
|
|
277
|
-
PLUGIN plugin to uninstall
|
|
278
|
-
|
|
279
|
-
FLAGS
|
|
280
|
-
-h, --help Show CLI help.
|
|
281
|
-
-v, --verbose
|
|
282
|
-
|
|
283
|
-
DESCRIPTION
|
|
284
|
-
Removes a plugin from the CLI.
|
|
285
|
-
|
|
286
|
-
ALIASES
|
|
287
|
-
$ @herodevs/cli plugins unlink
|
|
288
|
-
$ @herodevs/cli plugins remove
|
|
14
|
+
@herodevs/cli ____
|
|
289
15
|
```
|
|
290
16
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
Removes a plugin from the CLI.
|
|
17
|
+
or
|
|
294
18
|
|
|
295
19
|
```
|
|
296
|
-
|
|
297
|
-
$ @herodevs/cli plugins:uninstall PLUGIN...
|
|
298
|
-
|
|
299
|
-
ARGUMENTS
|
|
300
|
-
PLUGIN plugin to uninstall
|
|
301
|
-
|
|
302
|
-
FLAGS
|
|
303
|
-
-h, --help Show CLI help.
|
|
304
|
-
-v, --verbose
|
|
305
|
-
|
|
306
|
-
DESCRIPTION
|
|
307
|
-
Removes a plugin from the CLI.
|
|
308
|
-
|
|
309
|
-
ALIASES
|
|
310
|
-
$ @herodevs/cli plugins unlink
|
|
311
|
-
$ @herodevs/cli plugins remove
|
|
20
|
+
hd ____
|
|
312
21
|
```
|
|
313
22
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
## `@herodevs/cli plugins:uninstall PLUGIN...`
|
|
317
|
-
|
|
318
|
-
Removes a plugin from the CLI.
|
|
23
|
+
without installation:
|
|
319
24
|
|
|
320
25
|
```
|
|
321
|
-
|
|
322
|
-
$ @herodevs/cli plugins:uninstall PLUGIN...
|
|
323
|
-
|
|
324
|
-
ARGUMENTS
|
|
325
|
-
PLUGIN plugin to uninstall
|
|
326
|
-
|
|
327
|
-
FLAGS
|
|
328
|
-
-h, --help Show CLI help.
|
|
329
|
-
-v, --verbose
|
|
330
|
-
|
|
331
|
-
DESCRIPTION
|
|
332
|
-
Removes a plugin from the CLI.
|
|
333
|
-
|
|
334
|
-
ALIASES
|
|
335
|
-
$ @herodevs/cli plugins unlink
|
|
336
|
-
$ @herodevs/cli plugins remove
|
|
26
|
+
npx @herodevs/cli ____
|
|
337
27
|
```
|
|
338
28
|
|
|
339
|
-
##
|
|
29
|
+
## Commands
|
|
340
30
|
|
|
341
|
-
|
|
31
|
+
Get a list of committers within a git repository
|
|
342
32
|
|
|
343
33
|
```
|
|
344
|
-
|
|
345
|
-
$ @herodevs/cli plugins update [-h] [-v]
|
|
346
|
-
|
|
347
|
-
FLAGS
|
|
348
|
-
-h, --help Show CLI help.
|
|
349
|
-
-v, --verbose
|
|
350
|
-
|
|
351
|
-
DESCRIPTION
|
|
352
|
-
Update installed plugins.
|
|
34
|
+
hd report committers
|
|
353
35
|
```
|
|
354
|
-
|
|
355
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v3.2.5/src/commands/plugins/update.ts)_
|
|
356
|
-
<!-- commandsstop -->
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
import { BaseCommand
|
|
2
|
-
export declare class
|
|
1
|
+
import { BaseCommand } from '../../shared';
|
|
2
|
+
export declare class ReportCommitters extends BaseCommand<typeof ReportCommitters> {
|
|
3
3
|
static summary: string;
|
|
4
4
|
static usage: string;
|
|
5
5
|
static examples: string[];
|
|
6
6
|
static flags: {
|
|
7
7
|
startDate: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
8
8
|
endDate: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
9
|
-
exclude: import("@oclif/core/lib/interfaces").OptionFlag<string[]
|
|
9
|
+
exclude: import("@oclif/core/lib/interfaces").OptionFlag<string[], import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
10
|
+
monthly: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
10
11
|
};
|
|
11
12
|
private _parseDateFlags;
|
|
12
13
|
private _parseGitLogEntries;
|
|
13
14
|
private _collapseAndSortCommitterInfo;
|
|
14
|
-
private
|
|
15
|
-
|
|
15
|
+
private parseMonthly;
|
|
16
|
+
private printCommitters;
|
|
17
|
+
private printMonthly;
|
|
18
|
+
run(): Promise<any>;
|
|
16
19
|
}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReportCommitters = void 0;
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const shared_1 = require("../../shared");
|
|
6
|
+
const date_fns_1 = require("date-fns");
|
|
7
|
+
const gammaDelimiter = 'ΓΓΓΓ';
|
|
8
|
+
const monthsToSubtract = 12;
|
|
9
|
+
const dateFmt = 'yyyy-MM-dd';
|
|
10
|
+
const defaultStartDate = (0, date_fns_1.format)(new Date(), dateFmt);
|
|
11
|
+
const defaultEndDate = (0, date_fns_1.format)((0, date_fns_1.subMonths)(new Date(), monthsToSubtract), dateFmt);
|
|
12
|
+
const gitOutputFormat = `"${['%h', '%an', '%ad'].join(gammaDelimiter)}"`;
|
|
13
|
+
class ReportCommitters extends shared_1.BaseCommand {
|
|
14
|
+
_parseDateFlags(startDate, endDate) {
|
|
15
|
+
return [(0, date_fns_1.parse)(endDate, dateFmt, new Date()), (0, date_fns_1.parse)(startDate, dateFmt, new Date())];
|
|
16
|
+
}
|
|
17
|
+
_parseGitLogEntries(entries) {
|
|
18
|
+
return entries.map((entry) => {
|
|
19
|
+
const [commitHash, committer, date] = entry.split(gammaDelimiter);
|
|
20
|
+
return { commitHash, committer, date };
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
_collapseAndSortCommitterInfo(rawEntries) {
|
|
24
|
+
const entries = this._parseGitLogEntries(rawEntries);
|
|
25
|
+
const hash = {};
|
|
26
|
+
for (let i = 0; i < entries.length; i++) {
|
|
27
|
+
hash[entries[i].committer] = hash[entries[i].committer] || [];
|
|
28
|
+
hash[entries[i].committer].push([entries[i].commitHash, entries[i].date].join(' '));
|
|
29
|
+
}
|
|
30
|
+
const sortable = [];
|
|
31
|
+
Object.keys(hash).forEach((name) => {
|
|
32
|
+
sortable.push({ name, commits: hash[name] });
|
|
33
|
+
});
|
|
34
|
+
const committers = sortable.sort((a, b) => {
|
|
35
|
+
return b.commits.length - a.commits.length;
|
|
36
|
+
});
|
|
37
|
+
const monthly = this.parseMonthly(entries);
|
|
38
|
+
return { committers, monthly };
|
|
39
|
+
}
|
|
40
|
+
parseMonthly(entries) {
|
|
41
|
+
const monthly = [];
|
|
42
|
+
const dates = [new Date(this.flags.startDate), new Date(this.flags.endDate)];
|
|
43
|
+
const ival = {
|
|
44
|
+
start: (0, date_fns_1.min)(dates),
|
|
45
|
+
end: (0, date_fns_1.max)(dates)
|
|
46
|
+
};
|
|
47
|
+
const range = (0, date_fns_1.eachMonthOfInterval)(ival);
|
|
48
|
+
for (const idxr in range) {
|
|
49
|
+
const idx = parseInt(idxr);
|
|
50
|
+
if (idx + 1 >= range.length) {
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
const [start, end] = [range[idx], range[idx + 1]];
|
|
54
|
+
const month = {
|
|
55
|
+
name: (0, date_fns_1.format)(start, 'LLLL yyyy'),
|
|
56
|
+
start, end,
|
|
57
|
+
committers: {}
|
|
58
|
+
};
|
|
59
|
+
for (const rec of entries) {
|
|
60
|
+
if ((0, date_fns_1.isWithinInterval)(new Date(rec.date), { start, end })) {
|
|
61
|
+
month.committers[rec.committer] = month.committers[rec.committer] || [];
|
|
62
|
+
month.committers[rec.committer].push({ hash: rec.commitHash, date: rec.date });
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
if (Object.keys(month.committers).length > 0) {
|
|
66
|
+
monthly.push(month);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return monthly;
|
|
70
|
+
}
|
|
71
|
+
printCommitters(committers) {
|
|
72
|
+
if (!Object.keys(committers).length) {
|
|
73
|
+
this.log('NO COMMITTERS IN PERIOD');
|
|
74
|
+
}
|
|
75
|
+
this.log('\n--------------------COMMITTERS--------------------\n');
|
|
76
|
+
committers.forEach((committerCommit, i) => {
|
|
77
|
+
this.log(` ${i + 1}. ${committerCommit.name} (${committerCommit.commits.length})`);
|
|
78
|
+
committerCommit.commits.forEach((commitInfo) => {
|
|
79
|
+
this.log(` \t - ${commitInfo}`);
|
|
80
|
+
});
|
|
81
|
+
this.log('\n');
|
|
82
|
+
});
|
|
83
|
+
this.log('---------------------------------------------------\n');
|
|
84
|
+
}
|
|
85
|
+
printMonthly(md) {
|
|
86
|
+
if (!Object.keys(md).length) {
|
|
87
|
+
this.log('NO COMMITTERS IN PERIOD');
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
const rows = md
|
|
91
|
+
.flatMap(r => {
|
|
92
|
+
return Object
|
|
93
|
+
.entries(r.committers)
|
|
94
|
+
.flatMap(([committer, commits]) => commits.flatMap(commit => ({ month: r.name, committer, commit })));
|
|
95
|
+
}).map(r => ({ ...r, flags: { newMonth: true, newCommitter: true } }));
|
|
96
|
+
// ugly flag hack for now
|
|
97
|
+
rows.forEach((r, idx) => {
|
|
98
|
+
let newMonth = true;
|
|
99
|
+
let newCommitter = true;
|
|
100
|
+
if (idx == 0 || r.month !== rows[idx - 1].month) {
|
|
101
|
+
// first row / new month? always show both
|
|
102
|
+
}
|
|
103
|
+
else if (r.committer !== rows[idx - 1].committer) {
|
|
104
|
+
// month's same but new committer
|
|
105
|
+
newMonth = false;
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
// show both
|
|
109
|
+
newMonth = false;
|
|
110
|
+
newCommitter = false;
|
|
111
|
+
}
|
|
112
|
+
r.flags = { newMonth, newCommitter };
|
|
113
|
+
});
|
|
114
|
+
const distinctCommitters = rows.reduce((arr, row) => arr.includes(row.committer) ? arr : [...arr, row.committer], []);
|
|
115
|
+
this.log('\n');
|
|
116
|
+
core_1.ux.table(rows, {
|
|
117
|
+
month: {
|
|
118
|
+
header: 'Month',
|
|
119
|
+
minWidth: 20,
|
|
120
|
+
get: row => row.flags.newMonth ? row.month : ''
|
|
121
|
+
},
|
|
122
|
+
committer: {
|
|
123
|
+
header: 'Contributor',
|
|
124
|
+
minWidth: 25,
|
|
125
|
+
get: row => row.flags.newCommitter ? row.committer : ''
|
|
126
|
+
},
|
|
127
|
+
commit: {
|
|
128
|
+
header: 'Commit SHA',
|
|
129
|
+
get: row => row.commit.hash,
|
|
130
|
+
minWidth: 15,
|
|
131
|
+
},
|
|
132
|
+
date: {
|
|
133
|
+
header: 'Commit Date',
|
|
134
|
+
get: row => row.commit.date,
|
|
135
|
+
minWidth: 20
|
|
136
|
+
},
|
|
137
|
+
// flags: {}
|
|
138
|
+
});
|
|
139
|
+
const unique = distinctCommitters.sort();
|
|
140
|
+
this.log(`\n\n\nThere were ${unique.length} contributors reported: ${unique.join(', ')}\n`);
|
|
141
|
+
}
|
|
142
|
+
// public async run(): Promise<flagType<typeof ReportCommitters>> {
|
|
143
|
+
async run() {
|
|
144
|
+
const { flags } = this;
|
|
145
|
+
const dates = this._parseDateFlags(flags.startDate, flags.endDate);
|
|
146
|
+
const ignores = flags.exclude && flags.exclude.length ? `-- . "!(${flags.exclude.join('|')})"` : '';
|
|
147
|
+
const gitCommand = `git log --since "${dates[0]}" --until "${dates[1]}" --pretty=format:${gitOutputFormat} ${ignores}`;
|
|
148
|
+
const result = await (0, shared_1.run)(gitCommand);
|
|
149
|
+
const { committers, monthly } = this._collapseAndSortCommitterInfo(result.split('\n'));
|
|
150
|
+
if (flags.monthly) {
|
|
151
|
+
this.printMonthly(monthly);
|
|
152
|
+
return monthly;
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
this.printCommitters(committers);
|
|
156
|
+
return committers;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
exports.ReportCommitters = ReportCommitters;
|
|
161
|
+
ReportCommitters.summary = 'Get Committers Between Two Dates';
|
|
162
|
+
ReportCommitters.usage = '<%= command.id %> [flags [-s][-e][-x]]';
|
|
163
|
+
ReportCommitters.examples = [['<%= config.bin %> <%= command.id %>'].join('\n')];
|
|
164
|
+
ReportCommitters.flags = {
|
|
165
|
+
startDate: core_1.Flags.string({
|
|
166
|
+
char: 's',
|
|
167
|
+
summary: `Start Date (format: yyyy-MM-dd)`,
|
|
168
|
+
required: false,
|
|
169
|
+
default: () => defaultStartDate,
|
|
170
|
+
}),
|
|
171
|
+
endDate: core_1.Flags.string({
|
|
172
|
+
char: 'e',
|
|
173
|
+
summary: `End Date (format: yyyy-MM-dd)`,
|
|
174
|
+
required: false,
|
|
175
|
+
default: () => defaultEndDate,
|
|
176
|
+
}),
|
|
177
|
+
exclude: core_1.Flags.string({
|
|
178
|
+
char: 'x',
|
|
179
|
+
multiple: true,
|
|
180
|
+
summary: 'Path Exclusions (eg -x="./src/bin" -x="./dist")',
|
|
181
|
+
required: false,
|
|
182
|
+
// default: () => "" as any
|
|
183
|
+
}),
|
|
184
|
+
monthly: core_1.Flags.boolean({
|
|
185
|
+
char: 'm',
|
|
186
|
+
summary: 'Break down by calendar month, rather than by committer. (eg -m)',
|
|
187
|
+
required: false,
|
|
188
|
+
default: false
|
|
189
|
+
}),
|
|
190
|
+
};
|
package/dist/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@herodevs/cli",
|
|
3
|
-
"version": "0.1
|
|
4
|
-
"description": "HeroDevs
|
|
3
|
+
"version": "0.2.1-rc2",
|
|
4
|
+
"description": "HeroDevs CLI",
|
|
5
5
|
"author": "@herodevs",
|
|
6
6
|
"bin": {
|
|
7
7
|
"@herodevs/cli": "./bin/run",
|
|
@@ -19,13 +19,15 @@
|
|
|
19
19
|
"package.json"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@badisi/latest-version": "^6.1.10",
|
|
23
22
|
"@oclif/core": "^2",
|
|
24
23
|
"@oclif/plugin-help": "^5",
|
|
25
24
|
"@oclif/plugin-plugins": "^3.2.0",
|
|
26
25
|
"date-fns": "^2.30.0",
|
|
26
|
+
"get-json": "^1.0.1",
|
|
27
|
+
"git-last-commit": "^1.0.1",
|
|
27
28
|
"module-alias": "^2.2.3",
|
|
28
|
-
"shelljs": "^0.8.5"
|
|
29
|
+
"shelljs": "^0.8.5",
|
|
30
|
+
"sloc": "^0.3.2"
|
|
29
31
|
},
|
|
30
32
|
"devDependencies": {
|
|
31
33
|
"@oclif/test": "^2.4.4",
|
|
@@ -48,13 +50,12 @@
|
|
|
48
50
|
"dirname": "@herodevs/cli",
|
|
49
51
|
"commands": "./dist/commands",
|
|
50
52
|
"plugins": [
|
|
51
|
-
"@oclif/plugin-help"
|
|
52
|
-
"@oclif/plugin-plugins"
|
|
53
|
+
"@oclif/plugin-help"
|
|
53
54
|
],
|
|
54
55
|
"topicSeparator": " ",
|
|
55
56
|
"topics": {
|
|
56
|
-
"
|
|
57
|
-
"description": "
|
|
57
|
+
"report": {
|
|
58
|
+
"description": "Run reports for the current project (commands: committers)"
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
61
|
},
|
|
@@ -68,7 +69,7 @@
|
|
|
68
69
|
"build": "shx rm -rf dist && tsc -b && shx cp package.json dist/package.json",
|
|
69
70
|
"lint": "eslint . --ext .ts --config .eslintrc",
|
|
70
71
|
"postpack": "shx rm -f oclif.manifest.json",
|
|
71
|
-
"
|
|
72
|
+
"posttestXXX": "npm run lint",
|
|
72
73
|
"prepack": "npm run build && oclif manifest && oclif readme",
|
|
73
74
|
"test": "mocha --forbid-only \"test/**/*.test.ts\"",
|
|
74
75
|
"version": "oclif readme && git add README.md",
|
|
@@ -106,5 +107,11 @@
|
|
|
106
107
|
"keywords": [
|
|
107
108
|
"oclif"
|
|
108
109
|
],
|
|
109
|
-
"types": "dist/index.d.ts"
|
|
110
|
+
"types": "dist/index.d.ts",
|
|
111
|
+
"prettier": {
|
|
112
|
+
"singleQuote": true,
|
|
113
|
+
"trailingComma": "es5",
|
|
114
|
+
"bracketSpacing": true,
|
|
115
|
+
"printWidth": 100
|
|
116
|
+
}
|
|
110
117
|
}
|
|
@@ -9,7 +9,7 @@ declare enum LogLevel {
|
|
|
9
9
|
export declare abstract class BaseCommand<T extends typeof Command> extends Command {
|
|
10
10
|
static enableJsonFlag: boolean;
|
|
11
11
|
static baseFlags: {
|
|
12
|
-
'log-level': import("@oclif/core/lib/interfaces").OptionFlag<LogLevel
|
|
12
|
+
'log-level': import("@oclif/core/lib/interfaces").OptionFlag<LogLevel, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
13
13
|
};
|
|
14
14
|
protected flags: flagType<T>;
|
|
15
15
|
protected args: argType<T>;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ensureVersionIsUpToDate = exports.isVersionUpToDate = void 0;
|
|
4
4
|
const config_1 = require("../config");
|
|
5
|
-
const
|
|
5
|
+
const getJson = require("get-json");
|
|
6
6
|
const enums_1 = require("../enums");
|
|
7
7
|
const red = (0, enums_1.color)("\u001B[31m" /* Color.FgRed */);
|
|
8
8
|
const yellow = (0, enums_1.color)("\u001B[33m" /* Color.FgYellow */);
|
|
@@ -10,19 +10,27 @@ function reconstituteCommandPositionalsAndFlags(command) {
|
|
|
10
10
|
var _a;
|
|
11
11
|
return [
|
|
12
12
|
...(_a = command.id) === null || _a === void 0 ? void 0 : _a.split(':'),
|
|
13
|
-
...Object.keys(command.flags).map((flag) => `--${flag}='${command.flags[flag]}'`)
|
|
13
|
+
...Object.keys(command.flags).map((flag) => `--${flag}='${command.flags[flag]}'`),
|
|
14
14
|
].join(' ');
|
|
15
15
|
}
|
|
16
|
+
async function getLatestVersion(pkgName) {
|
|
17
|
+
return getJson(`https://registry.npmjs.org/${pkgName}`).then((packageData) => {
|
|
18
|
+
return packageData['dist-tags'].latest;
|
|
19
|
+
});
|
|
20
|
+
}
|
|
16
21
|
async function isVersionUpToDate(command, quietIfSuccessful = false) {
|
|
17
|
-
|
|
18
|
-
|
|
22
|
+
if (config_1.env.packageVersion === '0.0.0') {
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
const latestVersion = await getLatestVersion(config_1.env.packageName);
|
|
26
|
+
if (latestVersion === config_1.env.packageVersion) {
|
|
19
27
|
if (!quietIfSuccessful) {
|
|
20
|
-
command.log(`${config_1.env.packageName}@${
|
|
28
|
+
command.log(`${config_1.env.packageName}@${latestVersion} is up to date`);
|
|
21
29
|
}
|
|
22
30
|
return true;
|
|
23
31
|
}
|
|
24
32
|
command.log(`${yellow('Your version:', red(`${config_1.env.packageName}@${config_1.env.packageVersion}`), `is not up to date`)}`);
|
|
25
|
-
command.log(`${yellow('Latest version:', red(`${config_1.env.packageName}@${
|
|
33
|
+
command.log(`${yellow('Latest version:', red(`${config_1.env.packageName}@${latestVersion}`))}`);
|
|
26
34
|
return false;
|
|
27
35
|
}
|
|
28
36
|
exports.isVersionUpToDate = isVersionUpToDate;
|
package/oclif.manifest.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.1
|
|
2
|
+
"version": "0.2.1-rc2",
|
|
3
3
|
"commands": {
|
|
4
|
-
"
|
|
5
|
-
"id": "
|
|
4
|
+
"report:committers": {
|
|
5
|
+
"id": "report:committers",
|
|
6
6
|
"summary": "Get Committers Between Two Dates",
|
|
7
7
|
"strict": true,
|
|
8
8
|
"usage": "<%= command.id %> [flags [-s][-e][-x]]",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"summary": "Start Date (format: yyyy-MM-dd)",
|
|
42
42
|
"required": false,
|
|
43
43
|
"multiple": false,
|
|
44
|
-
"default": "
|
|
44
|
+
"default": "2024-03-01"
|
|
45
45
|
},
|
|
46
46
|
"endDate": {
|
|
47
47
|
"name": "endDate",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"summary": "End Date (format: yyyy-MM-dd)",
|
|
51
51
|
"required": false,
|
|
52
52
|
"multiple": false,
|
|
53
|
-
"default": "
|
|
53
|
+
"default": "2023-03-01"
|
|
54
54
|
},
|
|
55
55
|
"exclude": {
|
|
56
56
|
"name": "exclude",
|
|
@@ -59,48 +59,17 @@
|
|
|
59
59
|
"summary": "Path Exclusions (eg -x=\"./src/bin\" -x=\"./dist\")",
|
|
60
60
|
"required": false,
|
|
61
61
|
"multiple": true
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
},
|
|
66
|
-
"committer": {
|
|
67
|
-
"id": "committer",
|
|
68
|
-
"description": "Gets committer info",
|
|
69
|
-
"strict": true,
|
|
70
|
-
"pluginName": "@herodevs/cli",
|
|
71
|
-
"pluginAlias": "@herodevs/cli",
|
|
72
|
-
"pluginType": "core",
|
|
73
|
-
"aliases": [],
|
|
74
|
-
"examples": [
|
|
75
|
-
"$ @herodevs/cli committer"
|
|
76
|
-
],
|
|
77
|
-
"flags": {
|
|
78
|
-
"json": {
|
|
79
|
-
"name": "json",
|
|
62
|
+
},
|
|
63
|
+
"monthly": {
|
|
64
|
+
"name": "monthly",
|
|
80
65
|
"type": "boolean",
|
|
81
|
-
"
|
|
82
|
-
"
|
|
66
|
+
"char": "m",
|
|
67
|
+
"summary": "Break down by calendar month, rather than by committer. (eg -m)",
|
|
68
|
+
"required": false,
|
|
83
69
|
"allowNo": false
|
|
84
|
-
},
|
|
85
|
-
"log-level": {
|
|
86
|
-
"name": "log-level",
|
|
87
|
-
"type": "option",
|
|
88
|
-
"summary": "Specify level for logging.",
|
|
89
|
-
"helpGroup": "GLOBAL",
|
|
90
|
-
"multiple": false,
|
|
91
|
-
"options": [
|
|
92
|
-
"debug",
|
|
93
|
-
"info",
|
|
94
|
-
"warn",
|
|
95
|
-
"error"
|
|
96
|
-
]
|
|
97
70
|
}
|
|
98
71
|
},
|
|
99
|
-
"args": {
|
|
100
|
-
"get-all": {
|
|
101
|
-
"name": "get-all"
|
|
102
|
-
}
|
|
103
|
-
}
|
|
72
|
+
"args": {}
|
|
104
73
|
}
|
|
105
74
|
}
|
|
106
75
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@herodevs/cli",
|
|
3
|
-
"version": "0.1
|
|
4
|
-
"description": "HeroDevs
|
|
3
|
+
"version": "0.2.1-rc2",
|
|
4
|
+
"description": "HeroDevs CLI",
|
|
5
5
|
"author": "@herodevs",
|
|
6
6
|
"bin": {
|
|
7
7
|
"@herodevs/cli": "./bin/run",
|
|
@@ -19,13 +19,15 @@
|
|
|
19
19
|
"package.json"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@badisi/latest-version": "^6.1.10",
|
|
23
22
|
"@oclif/core": "^2",
|
|
24
23
|
"@oclif/plugin-help": "^5",
|
|
25
24
|
"@oclif/plugin-plugins": "^3.2.0",
|
|
26
25
|
"date-fns": "^2.30.0",
|
|
26
|
+
"get-json": "^1.0.1",
|
|
27
|
+
"git-last-commit": "^1.0.1",
|
|
27
28
|
"module-alias": "^2.2.3",
|
|
28
|
-
"shelljs": "^0.8.5"
|
|
29
|
+
"shelljs": "^0.8.5",
|
|
30
|
+
"sloc": "^0.3.2"
|
|
29
31
|
},
|
|
30
32
|
"devDependencies": {
|
|
31
33
|
"@oclif/test": "^2.4.4",
|
|
@@ -48,13 +50,12 @@
|
|
|
48
50
|
"dirname": "@herodevs/cli",
|
|
49
51
|
"commands": "./dist/commands",
|
|
50
52
|
"plugins": [
|
|
51
|
-
"@oclif/plugin-help"
|
|
52
|
-
"@oclif/plugin-plugins"
|
|
53
|
+
"@oclif/plugin-help"
|
|
53
54
|
],
|
|
54
55
|
"topicSeparator": " ",
|
|
55
56
|
"topics": {
|
|
56
|
-
"
|
|
57
|
-
"description": "
|
|
57
|
+
"report": {
|
|
58
|
+
"description": "Run reports for the current project (commands: committers)"
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
61
|
},
|
|
@@ -68,7 +69,7 @@
|
|
|
68
69
|
"build": "shx rm -rf dist && tsc -b && shx cp package.json dist/package.json",
|
|
69
70
|
"lint": "eslint . --ext .ts --config .eslintrc",
|
|
70
71
|
"postpack": "shx rm -f oclif.manifest.json",
|
|
71
|
-
"
|
|
72
|
+
"posttestXXX": "npm run lint",
|
|
72
73
|
"prepack": "npm run build && oclif manifest && oclif readme",
|
|
73
74
|
"test": "mocha --forbid-only \"test/**/*.test.ts\"",
|
|
74
75
|
"version": "oclif readme && git add README.md",
|
|
@@ -106,5 +107,11 @@
|
|
|
106
107
|
"keywords": [
|
|
107
108
|
"oclif"
|
|
108
109
|
],
|
|
109
|
-
"types": "dist/index.d.ts"
|
|
110
|
+
"types": "dist/index.d.ts",
|
|
111
|
+
"prettier": {
|
|
112
|
+
"singleQuote": true,
|
|
113
|
+
"trailingComma": "es5",
|
|
114
|
+
"bracketSpacing": true,
|
|
115
|
+
"printWidth": 100
|
|
116
|
+
}
|
|
110
117
|
}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CommitterGetAll = void 0;
|
|
4
|
-
const core_1 = require("@oclif/core");
|
|
5
|
-
const shared_1 = require("../../shared");
|
|
6
|
-
const date_fns_1 = require("date-fns");
|
|
7
|
-
const gammaDelimiter = 'ΓΓΓΓ';
|
|
8
|
-
const monthsToSubtract = 12;
|
|
9
|
-
const dateFmt = 'yyyy-MM-dd';
|
|
10
|
-
const defaultStartDate = (0, date_fns_1.format)(new Date(), dateFmt);
|
|
11
|
-
const defaultEndDate = (0, date_fns_1.format)((0, date_fns_1.subMonths)(new Date(), monthsToSubtract), dateFmt);
|
|
12
|
-
const gitOutputFormat = `"${[
|
|
13
|
-
'%h',
|
|
14
|
-
'%an',
|
|
15
|
-
'%ad'
|
|
16
|
-
].join(gammaDelimiter)}"`;
|
|
17
|
-
class CommitterGetAll extends shared_1.BaseCommand {
|
|
18
|
-
_parseDateFlags(startDate, endDate) {
|
|
19
|
-
return [
|
|
20
|
-
(0, date_fns_1.parse)(endDate, dateFmt, new Date()),
|
|
21
|
-
(0, date_fns_1.parse)(startDate, dateFmt, new Date()),
|
|
22
|
-
];
|
|
23
|
-
}
|
|
24
|
-
_parseGitLogEntries(entries) {
|
|
25
|
-
return entries.map((entry) => {
|
|
26
|
-
const [commitHash, committer, date] = entry.split(gammaDelimiter);
|
|
27
|
-
return { commitHash, committer, date };
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
_collapseAndSortCommitterInfo(rawEntries) {
|
|
31
|
-
const entries = this._parseGitLogEntries(rawEntries);
|
|
32
|
-
const hash = {};
|
|
33
|
-
for (let i = 0; i < entries.length; i++) {
|
|
34
|
-
hash[entries[i].committer] = hash[entries[i].committer] || [];
|
|
35
|
-
hash[entries[i].committer].push([entries[i].commitHash, entries[i].date].join(' '));
|
|
36
|
-
}
|
|
37
|
-
const sortable = [];
|
|
38
|
-
Object.keys(hash).forEach((name) => {
|
|
39
|
-
sortable.push({ name, commits: hash[name] });
|
|
40
|
-
});
|
|
41
|
-
return sortable.sort((a, b) => { return b.commits.length - a.commits.length; });
|
|
42
|
-
}
|
|
43
|
-
_printOutput(committers) {
|
|
44
|
-
if (!Object.keys(committers).length) {
|
|
45
|
-
this.log('NO COMMITTERS IN PERIOD');
|
|
46
|
-
}
|
|
47
|
-
this.log('\n--------------------COMMITTERS--------------------\n');
|
|
48
|
-
committers.forEach((committerCommit, i) => {
|
|
49
|
-
this.log(` ${i + 1}. ${committerCommit.name} (${committerCommit.commits.length})`);
|
|
50
|
-
committerCommit.commits.forEach((commitInfo) => {
|
|
51
|
-
this.log(` \t - ${commitInfo}`);
|
|
52
|
-
});
|
|
53
|
-
this.log('\n');
|
|
54
|
-
});
|
|
55
|
-
this.log('---------------------------------------------------\n');
|
|
56
|
-
}
|
|
57
|
-
async run() {
|
|
58
|
-
const { flags } = await this.parse(CommitterGetAll);
|
|
59
|
-
const dates = this._parseDateFlags(flags.startDate, flags.endDate);
|
|
60
|
-
const ignores = (flags.exclude && flags.exclude.length) ? `-- . "!(${flags.exclude.join('|')})"` : '';
|
|
61
|
-
const gitCommand = `git log --since "${dates[0]}" --until "${dates[1]}" --pretty=format:${gitOutputFormat} ${ignores}`;
|
|
62
|
-
const result = await (0, shared_1.run)(gitCommand);
|
|
63
|
-
const committers = this._collapseAndSortCommitterInfo(result.split('\n'));
|
|
64
|
-
this._printOutput(committers);
|
|
65
|
-
return Promise.resolve();
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
exports.CommitterGetAll = CommitterGetAll;
|
|
69
|
-
CommitterGetAll.summary = 'Get Committers Between Two Dates';
|
|
70
|
-
CommitterGetAll.usage = '<%= command.id %> [flags [-s][-e][-x]]';
|
|
71
|
-
CommitterGetAll.examples = [
|
|
72
|
-
[
|
|
73
|
-
'<%= config.bin %> <%= command.id %>',
|
|
74
|
-
].join('\n')
|
|
75
|
-
];
|
|
76
|
-
CommitterGetAll.flags = {
|
|
77
|
-
startDate: core_1.Flags.string({
|
|
78
|
-
char: 's',
|
|
79
|
-
summary: `Start Date (format: yyyy-MM-dd)`,
|
|
80
|
-
required: false,
|
|
81
|
-
default: () => defaultStartDate
|
|
82
|
-
}),
|
|
83
|
-
endDate: core_1.Flags.string({
|
|
84
|
-
char: 'e',
|
|
85
|
-
summary: `End Date (format: yyyy-MM-dd)`,
|
|
86
|
-
required: false,
|
|
87
|
-
default: () => defaultEndDate
|
|
88
|
-
}),
|
|
89
|
-
exclude: core_1.Flags.string({
|
|
90
|
-
char: 'x',
|
|
91
|
-
multiple: true,
|
|
92
|
-
summary: 'Path Exclusions (eg -x="./src/bin" -x="./dist")',
|
|
93
|
-
required: false,
|
|
94
|
-
// default: () => "" as any
|
|
95
|
-
}),
|
|
96
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { CommitterGetAll } from "./get-all";
|
|
2
|
-
import { BaseCommand } from "../../shared";
|
|
3
|
-
export default class Committer extends BaseCommand<typeof CommitterGetAll> {
|
|
4
|
-
static description: string;
|
|
5
|
-
static examples: string[];
|
|
6
|
-
static flags: {};
|
|
7
|
-
static args: any;
|
|
8
|
-
run(): Promise<void>;
|
|
9
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const get_all_1 = require("./get-all");
|
|
4
|
-
const shared_1 = require("../../shared");
|
|
5
|
-
class Committer extends shared_1.BaseCommand {
|
|
6
|
-
async run() {
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
exports.default = Committer;
|
|
10
|
-
Committer.description = "Gets committer info";
|
|
11
|
-
Committer.examples = [`$ @herodevs/cli committer`];
|
|
12
|
-
Committer.flags = {};
|
|
13
|
-
Committer.args = {
|
|
14
|
-
'get-all': get_all_1.CommitterGetAll.args
|
|
15
|
-
};
|