@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
package/package.json CHANGED
@@ -1,117 +1,19 @@
1
1
  {
2
2
  "name": "@herodevs/cli",
3
- "version": "0.2.1",
4
- "description": "HeroDevs CLI",
5
- "author": "@herodevs",
6
- "bin": {
7
- "@herodevs/cli": "./bin/run",
8
- "hd": "./bin/run"
9
- },
10
- "homepage": "https://github.com/herodevs/cli",
11
- "license": "MIT",
12
- "main": "dist/index.js",
13
- "repository": "herodevs/cli",
14
- "files": [
15
- "/bin",
16
- "/dist",
17
- "/npm-shrinkwrap.json",
18
- "/oclif.manifest.json",
19
- "package.json"
20
- ],
3
+ "version": "0.2.3-rc1",
4
+ "bin": "./main.js",
21
5
  "dependencies": {
22
- "@oclif/core": "^2",
23
- "@oclif/plugin-help": "^5",
24
- "@oclif/plugin-plugins": "^3.2.0",
25
- "date-fns": "^2.30.0",
26
- "get-json": "^1.0.1",
27
- "git-last-commit": "^1.0.1",
28
- "module-alias": "^2.2.3",
29
- "shelljs": "^0.8.5",
30
- "sloc": "^0.3.2"
31
- },
32
- "devDependencies": {
33
- "@oclif/test": "^2.4.4",
34
- "@types/chai": "^4",
35
- "@types/mocha": "^9.0.0",
36
- "@types/node": "^16.18.40",
37
- "chai": "^4",
38
- "eslint": "^7.32.0",
39
- "eslint-config-oclif": "^4",
40
- "eslint-config-oclif-typescript": "^1.0.3",
41
- "mocha": "^9",
42
- "oclif": "^3.11.3",
43
- "shx": "^0.3.3",
44
- "ts-node": "^10.9.1",
45
- "tslib": "^2.6.1",
46
- "typescript": "^4.9.5"
47
- },
48
- "oclif": {
49
- "bin": "@herodevs/cli",
50
- "dirname": "@herodevs/cli",
51
- "commands": "./dist/commands",
52
- "plugins": [
53
- "@oclif/plugin-help"
54
- ],
55
- "topicSeparator": " ",
56
- "topics": {
57
- "report": {
58
- "description": "Run reports for the current project (commands: committers)"
59
- }
60
- }
61
- },
62
- "scripts": {
63
- "generate:command": "oclif generate command",
64
- "start": "npm run dev",
65
- "predev": "npm run build",
66
- "dev": "./bin/dev",
67
- "preprod": "npm run build",
68
- "prod": "./bin/run",
69
- "build": "shx rm -rf dist && tsc -b && shx cp package.json dist/package.json",
70
- "lint": "eslint . --ext .ts --config .eslintrc",
71
- "postpack": "shx rm -f oclif.manifest.json",
72
- "posttestXXX": "npm run lint",
73
- "prepack": "npm run build && oclif manifest && oclif readme",
74
- "test": "mocha --forbid-only \"test/**/*.test.ts\"",
75
- "version": "oclif readme && git add README.md",
76
- "amendCommit": "git add . -A && git commit --amend --no-edit",
77
- "version:branch": "npm version prerelease --preid $(git rev-parse --short=8 HEAD^) --no-git-tag",
78
- "prepublish:branch": "npm run version:branch",
79
- "publish:branch": "npm publish --tag $(git rev-parse --short=8 HEAD^) --access public",
80
- "postpublish:branch": "npm run amendCommit",
81
- "version:beta": "npm version prerelease --preid beta --no-git-tag",
82
- "prepublish:beta": "npm run version:beta",
83
- "publish:beta": "npm publish --tag beta --access public",
84
- "postpublish:beta": "npm run amendCommit",
85
- "version:major": "npm version major --no-git-tag",
86
- "prepublish:major": "npm run version:major",
87
- "publish:major": "npm publish --access public",
88
- "postpublish:major": "npm run amendCommit",
89
- "version:minor": "npm version minor --no-git-tag",
90
- "prepublish:minor": "npm run version:minor",
91
- "publish:minor": "npm publish --access public",
92
- "postpublish:minor": "npm run amendCommit",
93
- "version:patch": "npm version patch --no-git-tag",
94
- "prepublish:patch": "npm run version:patch",
95
- "publish:patch": "npm publish --access public",
96
- "postpublish:patch": "npm run amendCommit",
97
- "buildAndPublishBranch": "npm run build && npm run publish:branch",
98
- "buildAndPublishBeta": "npm run build && npm run publish:beta && npm dist-tag add @herodevs/cli@$(node -e \"console.log(require('./package.json').version)\") latest",
99
- "buildAndPublishMajor": "npm run build && npm run publish:major",
100
- "buildAndPublishMinor": "npm run build && npm run publish:minor",
101
- "buildAndPublishPatch": "npm run build && npm run publish:patch"
102
- },
103
- "engines": {
104
- "node": ">=12.0.0"
6
+ "@apollo/client": "3.10.4",
7
+ "@inquirer/prompts": "5.0.4",
8
+ "date-fns": "3.6.0",
9
+ "get-json": "1.0.1",
10
+ "git-last-commit": "1.0.1",
11
+ "ora": "5.3.0",
12
+ "sloc": "0.3.2",
13
+ "tslib": "^2.3.0",
14
+ "yargs": "17.7.2"
105
15
  },
106
- "bugs": "https://github.com/herodevs/cli/issues",
107
- "keywords": [
108
- "oclif"
109
- ],
110
- "types": "dist/index.d.ts",
111
- "prettier": {
112
- "singleQuote": true,
113
- "trailingComma": "es5",
114
- "bracketSpacing": true,
115
- "printWidth": 100
116
- }
16
+ "type": "module",
17
+ "main": "./main.js",
18
+ "module": "./main.js"
117
19
  }
package/README.md DELETED
@@ -1,35 +0,0 @@
1
- # HeroDevs CLI -- `@herodevs/cli`
2
-
3
- ## Installation
4
-
5
- ```
6
- npm install -g @herodevs/cli
7
- ```
8
-
9
- ## Usage
10
-
11
- after global installation
12
-
13
- ```
14
- @herodevs/cli ____
15
- ```
16
-
17
- or
18
-
19
- ```
20
- hd ____
21
- ```
22
-
23
- without installation:
24
-
25
- ```
26
- npx @herodevs/cli ____
27
- ```
28
-
29
- ## Commands
30
-
31
- Get a list of committers within a git repository
32
-
33
- ```
34
- hd report committers
35
- ```
package/bin/dev DELETED
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env node
2
- require('module-alias/register');
3
- const oclif = require('@oclif/core');
4
-
5
- const path = require('path');
6
- const project = path.join(__dirname, '..', 'tsconfig.json');
7
-
8
- // In dev mode -> use ts-node and dev plugins
9
- process.env.NODE_ENV = 'development';
10
-
11
- require('ts-node').register({project});
12
-
13
- // In dev mode, always show stack traces
14
- oclif.settings.debug = true;
15
-
16
- // Start the CLI
17
- oclif.run().then(oclif.flush).catch(oclif.Errors.handle);
package/bin/dev.cmd DELETED
@@ -1,3 +0,0 @@
1
- @echo off
2
-
3
- node "%~dp0\dev" %*
package/bin/run DELETED
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env node
2
- require('module-alias/register');
3
- const oclif = require('@oclif/core');
4
-
5
- oclif.run().then(require('@oclif/core/flush')).catch(require('@oclif/core/handle'));
package/bin/run.cmd DELETED
@@ -1,3 +0,0 @@
1
- @echo off
2
-
3
- node "%~dp0\run" %*
@@ -1,19 +0,0 @@
1
- import { BaseCommand } from '../../shared';
2
- export declare class ReportCommitters extends BaseCommand<typeof ReportCommitters> {
3
- static summary: string;
4
- static usage: string;
5
- static examples: string[];
6
- static flags: {
7
- startDate: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
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[], import("@oclif/core/lib/interfaces/parser").CustomOptions>;
10
- monthly: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
11
- };
12
- private _parseDateFlags;
13
- private _parseGitLogEntries;
14
- private _collapseAndSortCommitterInfo;
15
- private parseMonthly;
16
- private printCommitters;
17
- private printMonthly;
18
- run(): Promise<any>;
19
- }
@@ -1,190 +0,0 @@
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/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export { run } from '@oclif/core';
package/dist/index.js DELETED
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.run = void 0;
4
- var core_1 = require("@oclif/core");
5
- Object.defineProperty(exports, "run", { enumerable: true, get: function () { return core_1.run; } });
package/dist/package.json DELETED
@@ -1,117 +0,0 @@
1
- {
2
- "name": "@herodevs/cli",
3
- "version": "0.2.1",
4
- "description": "HeroDevs CLI",
5
- "author": "@herodevs",
6
- "bin": {
7
- "@herodevs/cli": "./bin/run",
8
- "hd": "./bin/run"
9
- },
10
- "homepage": "https://github.com/herodevs/cli",
11
- "license": "MIT",
12
- "main": "dist/index.js",
13
- "repository": "herodevs/cli",
14
- "files": [
15
- "/bin",
16
- "/dist",
17
- "/npm-shrinkwrap.json",
18
- "/oclif.manifest.json",
19
- "package.json"
20
- ],
21
- "dependencies": {
22
- "@oclif/core": "^2",
23
- "@oclif/plugin-help": "^5",
24
- "@oclif/plugin-plugins": "^3.2.0",
25
- "date-fns": "^2.30.0",
26
- "get-json": "^1.0.1",
27
- "git-last-commit": "^1.0.1",
28
- "module-alias": "^2.2.3",
29
- "shelljs": "^0.8.5",
30
- "sloc": "^0.3.2"
31
- },
32
- "devDependencies": {
33
- "@oclif/test": "^2.4.4",
34
- "@types/chai": "^4",
35
- "@types/mocha": "^9.0.0",
36
- "@types/node": "^16.18.40",
37
- "chai": "^4",
38
- "eslint": "^7.32.0",
39
- "eslint-config-oclif": "^4",
40
- "eslint-config-oclif-typescript": "^1.0.3",
41
- "mocha": "^9",
42
- "oclif": "^3.11.3",
43
- "shx": "^0.3.3",
44
- "ts-node": "^10.9.1",
45
- "tslib": "^2.6.1",
46
- "typescript": "^4.9.5"
47
- },
48
- "oclif": {
49
- "bin": "@herodevs/cli",
50
- "dirname": "@herodevs/cli",
51
- "commands": "./dist/commands",
52
- "plugins": [
53
- "@oclif/plugin-help"
54
- ],
55
- "topicSeparator": " ",
56
- "topics": {
57
- "report": {
58
- "description": "Run reports for the current project (commands: committers)"
59
- }
60
- }
61
- },
62
- "scripts": {
63
- "generate:command": "oclif generate command",
64
- "start": "npm run dev",
65
- "predev": "npm run build",
66
- "dev": "./bin/dev",
67
- "preprod": "npm run build",
68
- "prod": "./bin/run",
69
- "build": "shx rm -rf dist && tsc -b && shx cp package.json dist/package.json",
70
- "lint": "eslint . --ext .ts --config .eslintrc",
71
- "postpack": "shx rm -f oclif.manifest.json",
72
- "posttestXXX": "npm run lint",
73
- "prepack": "npm run build && oclif manifest && oclif readme",
74
- "test": "mocha --forbid-only \"test/**/*.test.ts\"",
75
- "version": "oclif readme && git add README.md",
76
- "amendCommit": "git add . -A && git commit --amend --no-edit",
77
- "version:branch": "npm version prerelease --preid $(git rev-parse --short=8 HEAD^) --no-git-tag",
78
- "prepublish:branch": "npm run version:branch",
79
- "publish:branch": "npm publish --tag $(git rev-parse --short=8 HEAD^) --access public",
80
- "postpublish:branch": "npm run amendCommit",
81
- "version:beta": "npm version prerelease --preid beta --no-git-tag",
82
- "prepublish:beta": "npm run version:beta",
83
- "publish:beta": "npm publish --tag beta --access public",
84
- "postpublish:beta": "npm run amendCommit",
85
- "version:major": "npm version major --no-git-tag",
86
- "prepublish:major": "npm run version:major",
87
- "publish:major": "npm publish --access public",
88
- "postpublish:major": "npm run amendCommit",
89
- "version:minor": "npm version minor --no-git-tag",
90
- "prepublish:minor": "npm run version:minor",
91
- "publish:minor": "npm publish --access public",
92
- "postpublish:minor": "npm run amendCommit",
93
- "version:patch": "npm version patch --no-git-tag",
94
- "prepublish:patch": "npm run version:patch",
95
- "publish:patch": "npm publish --access public",
96
- "postpublish:patch": "npm run amendCommit",
97
- "buildAndPublishBranch": "npm run build && npm run publish:branch",
98
- "buildAndPublishBeta": "npm run build && npm run publish:beta && npm dist-tag add @herodevs/cli@$(node -e \"console.log(require('./package.json').version)\") latest",
99
- "buildAndPublishMajor": "npm run build && npm run publish:major",
100
- "buildAndPublishMinor": "npm run build && npm run publish:minor",
101
- "buildAndPublishPatch": "npm run build && npm run publish:patch"
102
- },
103
- "engines": {
104
- "node": ">=12.0.0"
105
- },
106
- "bugs": "https://github.com/herodevs/cli/issues",
107
- "keywords": [
108
- "oclif"
109
- ],
110
- "types": "dist/index.d.ts",
111
- "prettier": {
112
- "singleQuote": true,
113
- "trailingComma": "es5",
114
- "bracketSpacing": true,
115
- "printWidth": 100
116
- }
117
- }
@@ -1,22 +0,0 @@
1
- import { Command } from '@oclif/core';
2
- import { Flags as flagType, Args as argType } from '../types';
3
- declare enum LogLevel {
4
- debug = "debug",
5
- info = "info",
6
- warn = "warn",
7
- error = "error"
8
- }
9
- export declare abstract class BaseCommand<T extends typeof Command> extends Command {
10
- static enableJsonFlag: boolean;
11
- static baseFlags: {
12
- 'log-level': import("@oclif/core/lib/interfaces").OptionFlag<LogLevel, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
13
- };
14
- protected flags: flagType<T>;
15
- protected args: argType<T>;
16
- init(): Promise<void>;
17
- protected catch(err: Error & {
18
- exitCode?: number;
19
- }): Promise<any>;
20
- protected finally(_: Error | undefined): Promise<any>;
21
- }
22
- export {};
@@ -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,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./base-command"), exports);
@@ -1,4 +0,0 @@
1
- export declare const env: {
2
- packageVersion: string;
3
- packageName: string;
4
- };
@@ -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,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./environment"), exports);
@@ -1 +0,0 @@
1
- export * from './log-colors';
@@ -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("./log-colors"), exports);