@herodevs/cli 0.2.1 → 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.
Files changed (37) hide show
  1. package/main.js +959 -0
  2. package/package.json +14 -112
  3. package/README.md +0 -35
  4. package/bin/dev +0 -17
  5. package/bin/dev.cmd +0 -3
  6. package/bin/run +0 -5
  7. package/bin/run.cmd +0 -3
  8. package/dist/commands/report/committers.d.ts +0 -19
  9. package/dist/commands/report/committers.js +0 -190
  10. package/dist/index.d.ts +0 -1
  11. package/dist/index.js +0 -5
  12. package/dist/package.json +0 -117
  13. package/dist/shared/command/base-command.d.ts +0 -22
  14. package/dist/shared/command/base-command.js +0 -47
  15. package/dist/shared/command/index.d.ts +0 -1
  16. package/dist/shared/command/index.js +0 -4
  17. package/dist/shared/config/environment.d.ts +0 -4
  18. package/dist/shared/config/environment.js +0 -10
  19. package/dist/shared/config/index.d.ts +0 -1
  20. package/dist/shared/config/index.js +0 -4
  21. package/dist/shared/enums/index.d.ts +0 -1
  22. package/dist/shared/enums/index.js +0 -4
  23. package/dist/shared/enums/log-colors.d.ts +0 -28
  24. package/dist/shared/enums/log-colors.js +0 -9
  25. package/dist/shared/index.d.ts +0 -4
  26. package/dist/shared/index.js +0 -7
  27. package/dist/shared/lib/index.d.ts +0 -2
  28. package/dist/shared/lib/index.js +0 -5
  29. package/dist/shared/lib/shell.d.ts +0 -7
  30. package/dist/shared/lib/shell.js +0 -34
  31. package/dist/shared/lib/version-update.d.ts +0 -3
  32. package/dist/shared/lib/version-update.js +0 -52
  33. package/dist/shared/types/flags.type.d.ts +0 -4
  34. package/dist/shared/types/flags.type.js +0 -2
  35. package/dist/shared/types/index.d.ts +0 -1
  36. package/dist/shared/types/index.js +0 -4
  37. package/oclif.manifest.json +0 -75
@@ -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;
@@ -1,4 +0,0 @@
1
- export * from './config';
2
- export * from './command';
3
- export * from './types';
4
- export * from './lib';
@@ -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);
@@ -1,2 +0,0 @@
1
- export * from './shell';
2
- export * from './version-update';
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./shell"), exports);
5
- tslib_1.__exportStar(require("./version-update"), exports);
@@ -1,7 +0,0 @@
1
- interface shellOptions {
2
- returnCode: boolean;
3
- suppressExit: boolean;
4
- suppressStdOut: boolean;
5
- }
6
- export declare function run<T>(command: string, config?: Partial<shellOptions>): Promise<T>;
7
- export {};
@@ -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,3 +0,0 @@
1
- import { Command } from '@oclif/core';
2
- export declare function isVersionUpToDate(command: Command, quietIfSuccessful?: boolean): Promise<boolean>;
3
- export declare function ensureVersionIsUpToDate(command: Command): Promise<void>;
@@ -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,4 +0,0 @@
1
- import { Command, Interfaces } from "@oclif/core";
2
- import { BaseCommand } from "../command";
3
- export type Flags<T extends typeof Command> = Interfaces.InferredFlags<typeof BaseCommand['baseFlags'] & T['flags']>;
4
- export type Args<T extends typeof Command> = Interfaces.InferredArgs<T['args']>;
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1 +0,0 @@
1
- export * from './flags.type';
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./flags.type"), exports);
@@ -1,75 +0,0 @@
1
- {
2
- "version": "0.2.1",
3
- "commands": {
4
- "report:committers": {
5
- "id": "report:committers",
6
- "summary": "Get Committers Between Two Dates",
7
- "strict": true,
8
- "usage": "<%= command.id %> [flags [-s][-e][-x]]",
9
- "pluginName": "@herodevs/cli",
10
- "pluginAlias": "@herodevs/cli",
11
- "pluginType": "core",
12
- "aliases": [],
13
- "examples": [
14
- "<%= config.bin %> <%= command.id %>"
15
- ],
16
- "flags": {
17
- "json": {
18
- "name": "json",
19
- "type": "boolean",
20
- "description": "Format output as json.",
21
- "helpGroup": "GLOBAL",
22
- "allowNo": false
23
- },
24
- "log-level": {
25
- "name": "log-level",
26
- "type": "option",
27
- "summary": "Specify level for logging.",
28
- "helpGroup": "GLOBAL",
29
- "multiple": false,
30
- "options": [
31
- "debug",
32
- "info",
33
- "warn",
34
- "error"
35
- ]
36
- },
37
- "startDate": {
38
- "name": "startDate",
39
- "type": "option",
40
- "char": "s",
41
- "summary": "Start Date (format: yyyy-MM-dd)",
42
- "required": false,
43
- "multiple": false,
44
- "default": "2024-03-01"
45
- },
46
- "endDate": {
47
- "name": "endDate",
48
- "type": "option",
49
- "char": "e",
50
- "summary": "End Date (format: yyyy-MM-dd)",
51
- "required": false,
52
- "multiple": false,
53
- "default": "2023-03-01"
54
- },
55
- "exclude": {
56
- "name": "exclude",
57
- "type": "option",
58
- "char": "x",
59
- "summary": "Path Exclusions (eg -x=\"./src/bin\" -x=\"./dist\")",
60
- "required": false,
61
- "multiple": true
62
- },
63
- "monthly": {
64
- "name": "monthly",
65
- "type": "boolean",
66
- "char": "m",
67
- "summary": "Break down by calendar month, rather than by committer. (eg -m)",
68
- "required": false,
69
- "allowNo": false
70
- }
71
- },
72
- "args": {}
73
- }
74
- }
75
- }