@herodevs/cli 0.1.16 → 0.2.0
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 +16 -330
- package/dist/commands/{committer/get-all.d.ts → report/committers.d.ts} +3 -3
- package/dist/commands/{committer/get-all.js → report/committers.js} +16 -25
- package/dist/commands/tracker/init.d.ts +8 -0
- package/dist/commands/tracker/init.js +16 -0
- package/dist/commands/tracker/run.d.ts +13 -0
- package/dist/commands/tracker/run.js +38 -0
- package/dist/package.json +25 -10
- package/dist/shared/command/base-command.d.ts +1 -1
- package/dist/shared/lib/version-update.js +11 -6
- package/dist/shared/tracker/default-config.d.ts +3 -0
- package/dist/shared/tracker/default-config.js +19 -0
- package/dist/shared/tracker/initialize.d.ts +1 -0
- package/dist/shared/tracker/initialize.js +15 -0
- package/dist/shared/tracker/models/aggregate-result.d.ts +4 -0
- package/dist/shared/tracker/models/aggregate-result.js +2 -0
- package/dist/shared/tracker/models/category-result.d.ts +7 -0
- package/dist/shared/tracker/models/category-result.js +2 -0
- package/dist/shared/tracker/models/category.d.ts +9 -0
- package/dist/shared/tracker/models/category.js +2 -0
- package/dist/shared/tracker/models/chart-config.d.ts +24 -0
- package/dist/shared/tracker/models/chart-config.js +81 -0
- package/dist/shared/tracker/models/config.d.ts +8 -0
- package/dist/shared/tracker/models/config.js +2 -0
- package/dist/shared/tracker/models/file-result.d.ts +5 -0
- package/dist/shared/tracker/models/file-result.js +2 -0
- package/dist/shared/tracker/models/process-result.d.ts +6 -0
- package/dist/shared/tracker/models/process-result.js +2 -0
- package/dist/shared/tracker/models/result.d.ts +11 -0
- package/dist/shared/tracker/models/result.js +2 -0
- package/dist/shared/tracker/models/total-result.d.ts +4 -0
- package/dist/shared/tracker/models/total-result.js +2 -0
- package/dist/shared/tracker/models/viz-dataset.d.ts +4 -0
- package/dist/shared/tracker/models/viz-dataset.js +2 -0
- package/dist/shared/tracker/models/viz-labels-datasets.d.ts +5 -0
- package/dist/shared/tracker/models/viz-labels-datasets.js +2 -0
- package/dist/shared/tracker/process-category.d.ts +3 -0
- package/dist/shared/tracker/process-category.js +155 -0
- package/dist/shared/tracker/process-config.d.ts +3 -0
- package/dist/shared/tracker/process-config.js +16 -0
- package/dist/shared/tracker/tracker-chart.d.ts +14 -0
- package/dist/shared/tracker/tracker-chart.js +158 -0
- package/dist/shared/tracker/util.d.ts +20 -0
- package/dist/shared/tracker/util.js +92 -0
- package/oclif.manifest.json +41 -31
- package/package.json +25 -10
- package/dist/commands/committer/index.d.ts +0 -9
- package/dist/commands/committer/index.js +0 -15
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.saveResults = exports.readConfig = exports.getTheRootDirectory = exports.getGitCommit = exports.getData = exports.createDataVizIn = void 0;
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
const fs_1 = require("fs");
|
|
6
|
+
const date_fns_1 = require("date-fns");
|
|
7
|
+
const git_last_commit_1 = require("git-last-commit");
|
|
8
|
+
const tracker_chart_1 = require("./tracker-chart");
|
|
9
|
+
const DATE_FORMAT = 'yyyy-MM-dd-HH-mm-ss-SSS';
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
*
|
|
13
|
+
*
|
|
14
|
+
* internal alphabetized helper functions ->
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
function formatDate(date) {
|
|
18
|
+
return (0, date_fns_1.format)(date, DATE_FORMAT);
|
|
19
|
+
}
|
|
20
|
+
function getDataFilePath(localRootDir, outputDir) {
|
|
21
|
+
return (0, path_1.resolve)((0, path_1.join)(localRootDir, outputDir, 'data.json'));
|
|
22
|
+
}
|
|
23
|
+
function getGitDate(date) {
|
|
24
|
+
return new Date(+date * 1000);
|
|
25
|
+
}
|
|
26
|
+
function getLastCommitAsPromise() {
|
|
27
|
+
return new Promise((resolve, reject) => {
|
|
28
|
+
(0, git_last_commit_1.getLastCommit)((err, commit) => {
|
|
29
|
+
if (err) {
|
|
30
|
+
reject(err);
|
|
31
|
+
}
|
|
32
|
+
resolve(commit);
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
*
|
|
38
|
+
*
|
|
39
|
+
*
|
|
40
|
+
* exported alphabetized util functions ->
|
|
41
|
+
*
|
|
42
|
+
*/
|
|
43
|
+
async function createDataVizIn(chartConfig, parentDirectory, allJsonData, graphablePropertyName = 'total') {
|
|
44
|
+
const chart = new tracker_chart_1.TrackerChart(chartConfig, allJsonData, DATE_FORMAT);
|
|
45
|
+
return chart.writeTo(parentDirectory, graphablePropertyName);
|
|
46
|
+
}
|
|
47
|
+
exports.createDataVizIn = createDataVizIn;
|
|
48
|
+
function getData(localRootDir, outputDir) {
|
|
49
|
+
const outputPath = getDataFilePath(localRootDir, outputDir);
|
|
50
|
+
let contents = '';
|
|
51
|
+
if ((0, fs_1.existsSync)(outputPath)) {
|
|
52
|
+
contents = (0, fs_1.readFileSync)(outputPath).toString('utf-8');
|
|
53
|
+
}
|
|
54
|
+
return contents === '' ? [] : JSON.parse(contents);
|
|
55
|
+
}
|
|
56
|
+
exports.getData = getData;
|
|
57
|
+
async function getGitCommit() {
|
|
58
|
+
const commit = await getLastCommitAsPromise();
|
|
59
|
+
return {
|
|
60
|
+
hash: commit.hash,
|
|
61
|
+
timestamp: formatDate(getGitDate(commit.committedOn)),
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
exports.getGitCommit = getGitCommit;
|
|
65
|
+
function getTheRootDirectory(directory) {
|
|
66
|
+
if ((0, fs_1.existsSync)((0, path_1.join)(directory, 'package.json'))) {
|
|
67
|
+
return directory;
|
|
68
|
+
}
|
|
69
|
+
return getTheRootDirectory((0, path_1.resolve)((0, path_1.join)(directory, '..')));
|
|
70
|
+
}
|
|
71
|
+
exports.getTheRootDirectory = getTheRootDirectory;
|
|
72
|
+
function readConfig(rootDirectory, optionsPath) {
|
|
73
|
+
const path = optionsPath && (0, fs_1.existsSync)((0, path_1.join)(rootDirectory, optionsPath))
|
|
74
|
+
? (0, path_1.join)(rootDirectory, optionsPath)
|
|
75
|
+
: (0, path_1.join)(rootDirectory, 'hd-tracker', 'config.json');
|
|
76
|
+
const contents = (0, fs_1.readFileSync)(path).toString('utf-8');
|
|
77
|
+
return JSON.parse(contents);
|
|
78
|
+
}
|
|
79
|
+
exports.readConfig = readConfig;
|
|
80
|
+
function saveResults(localRootDir, outputDir, results) {
|
|
81
|
+
console.log('Outputting file');
|
|
82
|
+
const output = getData(localRootDir, outputDir);
|
|
83
|
+
if (!Array.isArray(output)) {
|
|
84
|
+
console.error('Invalid output file format');
|
|
85
|
+
}
|
|
86
|
+
output.push(results);
|
|
87
|
+
const outputPath = getDataFilePath(localRootDir, outputDir);
|
|
88
|
+
const outputText = JSON.stringify(output, null, 2);
|
|
89
|
+
(0, fs_1.writeFileSync)(outputPath, outputText);
|
|
90
|
+
console.log(`Output written to: ${outputPath}`);
|
|
91
|
+
}
|
|
92
|
+
exports.saveResults = saveResults;
|
package/oclif.manifest.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
2
|
+
"version": "0.2.0",
|
|
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-02-27"
|
|
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-02-27"
|
|
54
54
|
},
|
|
55
55
|
"exclude": {
|
|
56
56
|
"name": "exclude",
|
|
@@ -63,44 +63,54 @@
|
|
|
63
63
|
},
|
|
64
64
|
"args": {}
|
|
65
65
|
},
|
|
66
|
-
"
|
|
67
|
-
"id": "
|
|
68
|
-
"description": "
|
|
66
|
+
"tracker:init": {
|
|
67
|
+
"id": "tracker:init",
|
|
68
|
+
"description": "Initialize the tracker configuration",
|
|
69
69
|
"strict": true,
|
|
70
70
|
"pluginName": "@herodevs/cli",
|
|
71
71
|
"pluginAlias": "@herodevs/cli",
|
|
72
72
|
"pluginType": "core",
|
|
73
73
|
"aliases": [],
|
|
74
74
|
"examples": [
|
|
75
|
-
"
|
|
75
|
+
"<%= config.bin %> <%= command.id %>"
|
|
76
|
+
],
|
|
77
|
+
"flags": {},
|
|
78
|
+
"args": {}
|
|
79
|
+
},
|
|
80
|
+
"tracker:run": {
|
|
81
|
+
"id": "tracker:run",
|
|
82
|
+
"description": "Run the tracker",
|
|
83
|
+
"strict": true,
|
|
84
|
+
"pluginName": "@herodevs/cli",
|
|
85
|
+
"pluginAlias": "@herodevs/cli",
|
|
86
|
+
"pluginType": "core",
|
|
87
|
+
"aliases": [],
|
|
88
|
+
"examples": [
|
|
89
|
+
"<%= config.bin %> <%= command.id %>"
|
|
76
90
|
],
|
|
77
91
|
"flags": {
|
|
78
|
-
"
|
|
79
|
-
"name": "
|
|
80
|
-
"type": "
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"
|
|
92
|
+
"root": {
|
|
93
|
+
"name": "root",
|
|
94
|
+
"type": "option",
|
|
95
|
+
"char": "r",
|
|
96
|
+
"description": "root dir of the project",
|
|
97
|
+
"multiple": false
|
|
84
98
|
},
|
|
85
|
-
"
|
|
86
|
-
"name": "
|
|
99
|
+
"config": {
|
|
100
|
+
"name": "config",
|
|
87
101
|
"type": "option",
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
"multiple": false
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
102
|
+
"char": "c",
|
|
103
|
+
"description": "path to config file",
|
|
104
|
+
"multiple": false
|
|
105
|
+
},
|
|
106
|
+
"chart": {
|
|
107
|
+
"name": "chart",
|
|
108
|
+
"type": "option",
|
|
109
|
+
"description": "chart configuration",
|
|
110
|
+
"multiple": false
|
|
97
111
|
}
|
|
98
112
|
},
|
|
99
|
-
"args": {
|
|
100
|
-
"get-all": {
|
|
101
|
-
"name": "get-all"
|
|
102
|
-
}
|
|
103
|
-
}
|
|
113
|
+
"args": {}
|
|
104
114
|
}
|
|
105
115
|
}
|
|
106
116
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@herodevs/cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "HeroDevs
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "HeroDevs CLI",
|
|
5
5
|
"author": "@herodevs",
|
|
6
6
|
"bin": {
|
|
7
7
|
"@herodevs/cli": "./bin/run",
|
|
@@ -19,13 +19,20 @@
|
|
|
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",
|
|
25
|
+
"chart.js": "^3.9.1",
|
|
26
|
+
"chart.js-image": "^6.1.3",
|
|
27
|
+
"chartjs-node-canvas": "^4.1.6",
|
|
28
|
+
"chartjs-plugin-autocolors": "^0.2.2",
|
|
29
|
+
"chartjs-plugin-datalabels": "^2.2.0",
|
|
26
30
|
"date-fns": "^2.30.0",
|
|
31
|
+
"get-json": "^1.0.1",
|
|
32
|
+
"git-last-commit": "^1.0.1",
|
|
27
33
|
"module-alias": "^2.2.3",
|
|
28
|
-
"shelljs": "^0.8.5"
|
|
34
|
+
"shelljs": "^0.8.5",
|
|
35
|
+
"sloc": "^0.2.1"
|
|
29
36
|
},
|
|
30
37
|
"devDependencies": {
|
|
31
38
|
"@oclif/test": "^2.4.4",
|
|
@@ -48,13 +55,15 @@
|
|
|
48
55
|
"dirname": "@herodevs/cli",
|
|
49
56
|
"commands": "./dist/commands",
|
|
50
57
|
"plugins": [
|
|
51
|
-
"@oclif/plugin-help"
|
|
52
|
-
"@oclif/plugin-plugins"
|
|
58
|
+
"@oclif/plugin-help"
|
|
53
59
|
],
|
|
54
60
|
"topicSeparator": " ",
|
|
55
61
|
"topics": {
|
|
56
|
-
"
|
|
57
|
-
"description": "
|
|
62
|
+
"report": {
|
|
63
|
+
"description": "Run reports for the current project (commands: committers)"
|
|
64
|
+
},
|
|
65
|
+
"tracker": {
|
|
66
|
+
"description": "Track project progress based upon lines of code (commands: init, run)"
|
|
58
67
|
}
|
|
59
68
|
}
|
|
60
69
|
},
|
|
@@ -68,7 +77,7 @@
|
|
|
68
77
|
"build": "shx rm -rf dist && tsc -b && shx cp package.json dist/package.json",
|
|
69
78
|
"lint": "eslint . --ext .ts --config .eslintrc",
|
|
70
79
|
"postpack": "shx rm -f oclif.manifest.json",
|
|
71
|
-
"
|
|
80
|
+
"posttestXXX": "npm run lint",
|
|
72
81
|
"prepack": "npm run build && oclif manifest && oclif readme",
|
|
73
82
|
"test": "mocha --forbid-only \"test/**/*.test.ts\"",
|
|
74
83
|
"version": "oclif readme && git add README.md",
|
|
@@ -106,5 +115,11 @@
|
|
|
106
115
|
"keywords": [
|
|
107
116
|
"oclif"
|
|
108
117
|
],
|
|
109
|
-
"types": "dist/index.d.ts"
|
|
118
|
+
"types": "dist/index.d.ts",
|
|
119
|
+
"prettier": {
|
|
120
|
+
"singleQuote": true,
|
|
121
|
+
"trailingComma": "es5",
|
|
122
|
+
"bracketSpacing": true,
|
|
123
|
+
"printWidth": 100
|
|
124
|
+
}
|
|
110
125
|
}
|
|
@@ -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
|
-
};
|