@herodevs/cli 0.2.2 → 0.2.3-rc1
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/main.js +959 -0
- package/package.json +14 -115
- package/README.md +0 -35
- package/bin/dev +0 -17
- package/bin/dev.cmd +0 -3
- package/bin/run +0 -5
- package/bin/run.cmd +0 -3
- package/dist/commands/report/committers.d.ts +0 -19
- package/dist/commands/report/committers.js +0 -190
- package/dist/commands/tracker/init.d.ts +0 -8
- package/dist/commands/tracker/init.js +0 -16
- package/dist/commands/tracker/run.d.ts +0 -11
- package/dist/commands/tracker/run.js +0 -37
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -5
- package/dist/package.json +0 -120
- package/dist/shared/command/base-command.d.ts +0 -22
- package/dist/shared/command/base-command.js +0 -47
- package/dist/shared/command/index.d.ts +0 -1
- package/dist/shared/command/index.js +0 -4
- package/dist/shared/config/environment.d.ts +0 -4
- package/dist/shared/config/environment.js +0 -10
- package/dist/shared/config/index.d.ts +0 -1
- package/dist/shared/config/index.js +0 -4
- package/dist/shared/enums/index.d.ts +0 -1
- package/dist/shared/enums/index.js +0 -4
- package/dist/shared/enums/log-colors.d.ts +0 -28
- package/dist/shared/enums/log-colors.js +0 -9
- package/dist/shared/index.d.ts +0 -4
- package/dist/shared/index.js +0 -7
- package/dist/shared/lib/index.d.ts +0 -2
- package/dist/shared/lib/index.js +0 -5
- package/dist/shared/lib/shell.d.ts +0 -7
- package/dist/shared/lib/shell.js +0 -34
- package/dist/shared/lib/version-update.d.ts +0 -3
- package/dist/shared/lib/version-update.js +0 -52
- package/dist/shared/tracker/default-config.d.ts +0 -3
- package/dist/shared/tracker/default-config.js +0 -19
- package/dist/shared/tracker/initialize.d.ts +0 -1
- package/dist/shared/tracker/initialize.js +0 -15
- package/dist/shared/tracker/models/aggregate-result.d.ts +0 -4
- package/dist/shared/tracker/models/aggregate-result.js +0 -2
- package/dist/shared/tracker/models/category-result.d.ts +0 -7
- package/dist/shared/tracker/models/category-result.js +0 -2
- package/dist/shared/tracker/models/category.d.ts +0 -9
- package/dist/shared/tracker/models/category.js +0 -2
- package/dist/shared/tracker/models/chart-config.d.ts +0 -24
- package/dist/shared/tracker/models/chart-config.js +0 -65
- package/dist/shared/tracker/models/config.d.ts +0 -8
- package/dist/shared/tracker/models/config.js +0 -2
- package/dist/shared/tracker/models/file-result.d.ts +0 -5
- package/dist/shared/tracker/models/file-result.js +0 -2
- package/dist/shared/tracker/models/process-result.d.ts +0 -6
- package/dist/shared/tracker/models/process-result.js +0 -2
- package/dist/shared/tracker/models/result.d.ts +0 -11
- package/dist/shared/tracker/models/result.js +0 -2
- package/dist/shared/tracker/models/total-result.d.ts +0 -4
- package/dist/shared/tracker/models/total-result.js +0 -2
- package/dist/shared/tracker/models/viz-dataset.d.ts +0 -4
- package/dist/shared/tracker/models/viz-dataset.js +0 -2
- package/dist/shared/tracker/models/viz-labels-datasets.d.ts +0 -5
- package/dist/shared/tracker/models/viz-labels-datasets.js +0 -2
- package/dist/shared/tracker/process-category.d.ts +0 -3
- package/dist/shared/tracker/process-category.js +0 -155
- package/dist/shared/tracker/process-config.d.ts +0 -3
- package/dist/shared/tracker/process-config.js +0 -16
- package/dist/shared/tracker/tracker-chart.d.ts +0 -0
- package/dist/shared/tracker/tracker-chart.js +0 -156
- package/dist/shared/tracker/util.d.ts +0 -17
- package/dist/shared/tracker/util.js +0 -98
- package/dist/shared/types/flags.type.d.ts +0 -4
- package/dist/shared/types/flags.type.js +0 -2
- package/dist/shared/types/index.d.ts +0 -1
- package/dist/shared/types/index.js +0 -4
- package/oclif.manifest.json +0 -118
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BaseCommand = void 0;
|
|
4
|
-
const core_1 = require("@oclif/core");
|
|
5
|
-
const lib_1 = require("../lib");
|
|
6
|
-
var LogLevel;
|
|
7
|
-
(function (LogLevel) {
|
|
8
|
-
LogLevel["debug"] = "debug";
|
|
9
|
-
LogLevel["info"] = "info";
|
|
10
|
-
LogLevel["warn"] = "warn";
|
|
11
|
-
LogLevel["error"] = "error";
|
|
12
|
-
})(LogLevel || (LogLevel = {}));
|
|
13
|
-
class BaseCommand extends core_1.Command {
|
|
14
|
-
async init() {
|
|
15
|
-
await super.init();
|
|
16
|
-
const { args, flags } = await this.parse({
|
|
17
|
-
flags: this.ctor.flags,
|
|
18
|
-
baseFlags: (super.ctor.baseFlags),
|
|
19
|
-
args: this.ctor.args,
|
|
20
|
-
strict: this.ctor.strict,
|
|
21
|
-
});
|
|
22
|
-
this.flags = flags;
|
|
23
|
-
this.args = args;
|
|
24
|
-
await (0, lib_1.ensureVersionIsUpToDate)(this);
|
|
25
|
-
}
|
|
26
|
-
async catch(err) {
|
|
27
|
-
// add any custom logic to handle errors from the command
|
|
28
|
-
// or simply return the parent class error handling
|
|
29
|
-
this.logToStderr(JSON.stringify(err));
|
|
30
|
-
return super.catch(err);
|
|
31
|
-
}
|
|
32
|
-
async finally(_) {
|
|
33
|
-
// called after run and catch regardless of whether or not the command errored
|
|
34
|
-
return super.finally(_);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
exports.BaseCommand = BaseCommand;
|
|
38
|
-
// add the --json flag
|
|
39
|
-
BaseCommand.enableJsonFlag = true;
|
|
40
|
-
// define flags that can be inherited by any command that extends BaseCommand
|
|
41
|
-
BaseCommand.baseFlags = {
|
|
42
|
-
'log-level': core_1.Flags.custom({
|
|
43
|
-
summary: 'Specify level for logging.',
|
|
44
|
-
options: Object.values(LogLevel),
|
|
45
|
-
helpGroup: 'GLOBAL',
|
|
46
|
-
})(),
|
|
47
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './base-command';
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.env = void 0;
|
|
4
|
-
const path = require('path');
|
|
5
|
-
const packageJsonPath = path.join(__dirname, '../../../package.json');
|
|
6
|
-
const packageJson = require(packageJsonPath);
|
|
7
|
-
exports.env = {
|
|
8
|
-
packageVersion: packageJson.version,
|
|
9
|
-
packageName: packageJson.name,
|
|
10
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './environment';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './log-colors';
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export declare const enum Color {
|
|
2
|
-
Reset = "\u001B[0m",
|
|
3
|
-
Bright = "\u001B[1m",
|
|
4
|
-
Dim = "\u001B[2m",
|
|
5
|
-
Underscore = "\u001B[4m",
|
|
6
|
-
Blink = "\u001B[5m",
|
|
7
|
-
Reverse = "\u001B[7m",
|
|
8
|
-
Hidden = "\u001B[8m",
|
|
9
|
-
FgBlack = "\u001B[30m",
|
|
10
|
-
FgRed = "\u001B[31m",
|
|
11
|
-
FgGreen = "\u001B[32m",
|
|
12
|
-
FgYellow = "\u001B[33m",
|
|
13
|
-
FgBlue = "\u001B[34m",
|
|
14
|
-
FgMagenta = "\u001B[35m",
|
|
15
|
-
FgCyan = "\u001B[36m",
|
|
16
|
-
FgWhite = "\u001B[37m",
|
|
17
|
-
FgGray = "\u001B[90m",
|
|
18
|
-
BgBlack = "\u001B[40m",
|
|
19
|
-
BgRed = "\u001B[41m",
|
|
20
|
-
BgGreen = "\u001B[42m",
|
|
21
|
-
BgYellow = "\u001B[43m",
|
|
22
|
-
BgBlue = "\u001B[44m",
|
|
23
|
-
BgMagenta = "\u001B[45m",
|
|
24
|
-
BgCyan = "\u001B[46m",
|
|
25
|
-
BgWhite = "\u001B[47m",
|
|
26
|
-
BgGray = "\u001B[100m"
|
|
27
|
-
}
|
|
28
|
-
export declare function color(color: Color): (...args: string[]) => string;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.color = void 0;
|
|
4
|
-
function color(color) {
|
|
5
|
-
return (...args) => {
|
|
6
|
-
return `${color}${args.join(` ${color}` /*reset color for nested color*/)}${"\u001B[0m" /* Color.Reset */}`;
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
exports.color = color;
|
package/dist/shared/index.d.ts
DELETED
package/dist/shared/index.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
tslib_1.__exportStar(require("./config"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./command"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./types"), exports);
|
|
7
|
-
tslib_1.__exportStar(require("./lib"), exports);
|
package/dist/shared/lib/index.js
DELETED
package/dist/shared/lib/shell.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.run = void 0;
|
|
4
|
-
const shelljs = require('shelljs');
|
|
5
|
-
;
|
|
6
|
-
const defaultRunOptions = {
|
|
7
|
-
returnCode: false,
|
|
8
|
-
suppressExit: true,
|
|
9
|
-
suppressStdOut: true,
|
|
10
|
-
};
|
|
11
|
-
function run(command, config = defaultRunOptions) {
|
|
12
|
-
const options = { ...defaultRunOptions, ...config };
|
|
13
|
-
return new Promise((resolve, reject) => {
|
|
14
|
-
if (options.suppressStdOut) {
|
|
15
|
-
shelljs.config.silent = true;
|
|
16
|
-
}
|
|
17
|
-
shelljs.exec(command, (code, stdout, stderr) => {
|
|
18
|
-
if (stderr) {
|
|
19
|
-
const errorOutput = options.returnCode ? code : stderr;
|
|
20
|
-
reject(errorOutput);
|
|
21
|
-
if (!options.suppressExit) {
|
|
22
|
-
process.exit(code);
|
|
23
|
-
}
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
const output = options.returnCode ? code : stdout;
|
|
27
|
-
if (!options.suppressStdOut) {
|
|
28
|
-
console.log(output);
|
|
29
|
-
}
|
|
30
|
-
resolve(output);
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
exports.run = run;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ensureVersionIsUpToDate = exports.isVersionUpToDate = void 0;
|
|
4
|
-
const config_1 = require("../config");
|
|
5
|
-
const getJson = require("get-json");
|
|
6
|
-
const enums_1 = require("../enums");
|
|
7
|
-
const red = (0, enums_1.color)("\u001B[31m" /* Color.FgRed */);
|
|
8
|
-
const yellow = (0, enums_1.color)("\u001B[33m" /* Color.FgYellow */);
|
|
9
|
-
function reconstituteCommandPositionalsAndFlags(command) {
|
|
10
|
-
var _a;
|
|
11
|
-
return [
|
|
12
|
-
...(_a = command.id) === null || _a === void 0 ? void 0 : _a.split(':'),
|
|
13
|
-
...Object.keys(command.flags).map((flag) => `--${flag}='${command.flags[flag]}'`),
|
|
14
|
-
].join(' ');
|
|
15
|
-
}
|
|
16
|
-
async function getLatestVersion(pkgName) {
|
|
17
|
-
return getJson(`https://registry.npmjs.org/${pkgName}`).then((packageData) => {
|
|
18
|
-
return packageData['dist-tags'].latest;
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
async function isVersionUpToDate(command, quietIfSuccessful = false) {
|
|
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) {
|
|
27
|
-
if (!quietIfSuccessful) {
|
|
28
|
-
command.log(`${config_1.env.packageName}@${latestVersion} is up to date`);
|
|
29
|
-
}
|
|
30
|
-
return true;
|
|
31
|
-
}
|
|
32
|
-
command.log(`${yellow('Your version:', red(`${config_1.env.packageName}@${config_1.env.packageVersion}`), `is not up to date`)}`);
|
|
33
|
-
command.log(`${yellow('Latest version:', red(`${config_1.env.packageName}@${latestVersion}`))}`);
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
exports.isVersionUpToDate = isVersionUpToDate;
|
|
37
|
-
async function ensureVersionIsUpToDate(command) {
|
|
38
|
-
const versionUpToDate = await isVersionUpToDate(command);
|
|
39
|
-
if (!versionUpToDate) {
|
|
40
|
-
// see `update-plugin-behavior` branch for previous implementation of auto-update
|
|
41
|
-
const commandAndPositionals = reconstituteCommandPositionalsAndFlags(command);
|
|
42
|
-
command.log([
|
|
43
|
-
`\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n\n`,
|
|
44
|
-
`${red(`ERROR:`)} Did not run command.\n\n`,
|
|
45
|
-
` - Rerun your command with the ${yellow('@latest')} tag to ensure correct output:\n\n\n`,
|
|
46
|
-
`\t${yellow(`npx ${config_1.env.packageName}@latest ${commandAndPositionals}`)}\n`,
|
|
47
|
-
`\n\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n`,
|
|
48
|
-
].join(' '));
|
|
49
|
-
return process.exit(1);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
exports.ensureVersionIsUpToDate = ensureVersionIsUpToDate;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const defaultConfig = {
|
|
4
|
-
categories: {
|
|
5
|
-
legacy: {
|
|
6
|
-
fileTypes: ['js', 'ts', 'html', 'css', 'scss', 'less'],
|
|
7
|
-
includes: ['./legacy'],
|
|
8
|
-
jsTsPairs: 'js',
|
|
9
|
-
},
|
|
10
|
-
modern: {
|
|
11
|
-
fileTypes: ['ts', 'html', 'css', 'scss', 'less'],
|
|
12
|
-
includes: ['./modern'],
|
|
13
|
-
jsTsPairs: 'ts',
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
ignorePatterns: ['node_modules'],
|
|
17
|
-
outputDir: 'hd-tracker',
|
|
18
|
-
};
|
|
19
|
-
exports.default = defaultConfig;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function initialize(rootDir: string): void;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.initialize = void 0;
|
|
4
|
-
const path_1 = require("path");
|
|
5
|
-
const fs_1 = require("fs");
|
|
6
|
-
const default_config_1 = require("./default-config");
|
|
7
|
-
function initialize(rootDir) {
|
|
8
|
-
const output = JSON.stringify(default_config_1.default, null, 2);
|
|
9
|
-
const dir = (0, path_1.join)(rootDir, 'hd-tracker');
|
|
10
|
-
if (!(0, fs_1.existsSync)(dir)) {
|
|
11
|
-
(0, fs_1.mkdirSync)(dir);
|
|
12
|
-
}
|
|
13
|
-
(0, fs_1.writeFileSync)((0, path_1.join)(dir, 'config.json'), output);
|
|
14
|
-
}
|
|
15
|
-
exports.initialize = initialize;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export declare class ChartConfig {
|
|
2
|
-
private _cliOptions;
|
|
3
|
-
private _perCategoryAndFileType;
|
|
4
|
-
private _perCategoryTotals;
|
|
5
|
-
private _width;
|
|
6
|
-
private _height;
|
|
7
|
-
private _bg;
|
|
8
|
-
private _title;
|
|
9
|
-
private _xAxisLabel;
|
|
10
|
-
private _yAxisLabel;
|
|
11
|
-
private _overwrite;
|
|
12
|
-
private _outFile;
|
|
13
|
-
get perCategoryAndFileType(): boolean;
|
|
14
|
-
get perCategoryTotals(): boolean;
|
|
15
|
-
get width(): number;
|
|
16
|
-
get height(): number;
|
|
17
|
-
get bg(): string;
|
|
18
|
-
get title(): string;
|
|
19
|
-
get xAxisLabel(): string;
|
|
20
|
-
get yAxisLabel(): string;
|
|
21
|
-
get overwrite(): boolean;
|
|
22
|
-
get outFile(): string;
|
|
23
|
-
constructor(_cliOptions?: ChartConfig);
|
|
24
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ChartConfig = void 0;
|
|
4
|
-
class ChartConfig {
|
|
5
|
-
get perCategoryAndFileType() {
|
|
6
|
-
// if false, use false; false !== undefined
|
|
7
|
-
return this._cliOptions.perCategoryAndFileType !== undefined
|
|
8
|
-
? this._cliOptions.perCategoryAndFileType
|
|
9
|
-
: this._perCategoryAndFileType;
|
|
10
|
-
}
|
|
11
|
-
get perCategoryTotals() {
|
|
12
|
-
// if false, use false; false !== undefined
|
|
13
|
-
return this._cliOptions.perCategoryTotals !== undefined
|
|
14
|
-
? this._cliOptions.perCategoryTotals
|
|
15
|
-
: this._perCategoryTotals;
|
|
16
|
-
}
|
|
17
|
-
get width() {
|
|
18
|
-
// if set and non-numeric
|
|
19
|
-
if (this._cliOptions.width !== undefined && isNaN(Number(this._cliOptions.width))) {
|
|
20
|
-
throw Error('--chart.width must be a number');
|
|
21
|
-
}
|
|
22
|
-
// if unset or numeric
|
|
23
|
-
return this._cliOptions.width !== undefined ? this._cliOptions.width : this._width;
|
|
24
|
-
}
|
|
25
|
-
get height() {
|
|
26
|
-
// if set and non-numeric
|
|
27
|
-
if (this._cliOptions.height !== undefined && isNaN(Number(this._cliOptions.height))) {
|
|
28
|
-
throw Error('--chart.height must be a number');
|
|
29
|
-
}
|
|
30
|
-
// if unset or numeric
|
|
31
|
-
return this._cliOptions.height !== undefined ? this._cliOptions.height : this._height;
|
|
32
|
-
}
|
|
33
|
-
get bg() {
|
|
34
|
-
return this._cliOptions.bg ? this._cliOptions.bg : this._bg;
|
|
35
|
-
}
|
|
36
|
-
get title() {
|
|
37
|
-
return this._cliOptions.title ? this._cliOptions.title : this._title;
|
|
38
|
-
}
|
|
39
|
-
get xAxisLabel() {
|
|
40
|
-
return this._cliOptions.xAxisLabel ? this._cliOptions.xAxisLabel : this._xAxisLabel;
|
|
41
|
-
}
|
|
42
|
-
get yAxisLabel() {
|
|
43
|
-
return this._cliOptions.yAxisLabel ? this._cliOptions.yAxisLabel : this._yAxisLabel;
|
|
44
|
-
}
|
|
45
|
-
get overwrite() {
|
|
46
|
-
return this._cliOptions.overwrite !== undefined ? this._cliOptions.overwrite : this._overwrite;
|
|
47
|
-
}
|
|
48
|
-
get outFile() {
|
|
49
|
-
return this._cliOptions.outFile ? this._cliOptions.outFile : this._outFile;
|
|
50
|
-
}
|
|
51
|
-
constructor(_cliOptions = {}) {
|
|
52
|
-
this._cliOptions = _cliOptions;
|
|
53
|
-
this._perCategoryAndFileType = false;
|
|
54
|
-
this._perCategoryTotals = true;
|
|
55
|
-
this._width = 1200;
|
|
56
|
-
this._height = 800;
|
|
57
|
-
this._bg = 'white';
|
|
58
|
-
this._title = 'Migration Progress LOC';
|
|
59
|
-
this._xAxisLabel = 'Date';
|
|
60
|
-
this._yAxisLabel = 'Totals';
|
|
61
|
-
this._overwrite = true;
|
|
62
|
-
this._outFile = 'viz.png';
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
exports.ChartConfig = ChartConfig;
|