@airscript/ghitgud 1.0.3 → 2.0.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 +104 -18
- package/VERSION +1 -1
- package/dist/index.js +793 -0
- package/dist/templates/base.json +12 -0
- package/dist/templates/conventional.json +52 -0
- package/dist/templates/github.json +47 -0
- package/package.json +59 -36
- package/templates/base.json +1 -1
- package/templates/conventional.json +51 -52
- package/templates/github.json +1 -1
- package/.env.base +0 -2
- package/.github/CODEOWNERS +0 -1
- package/.github/FUNDING.yml +0 -2
- package/.github/ISSUE_TEMPLATE/build.md +0 -9
- package/.github/ISSUE_TEMPLATE/chore.md +0 -9
- package/.github/ISSUE_TEMPLATE/ci.md +0 -9
- package/.github/ISSUE_TEMPLATE/documentation.md +0 -9
- package/.github/ISSUE_TEMPLATE/feature.md +0 -9
- package/.github/ISSUE_TEMPLATE/fix.md +0 -9
- package/.github/ISSUE_TEMPLATE/performance.md +0 -9
- package/.github/ISSUE_TEMPLATE/refactor.md +0 -9
- package/.github/ISSUE_TEMPLATE/style.md +0 -9
- package/.github/ISSUE_TEMPLATE/test.md +0 -9
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -28
- package/.github/workflows/tests.yml +0 -36
- package/CHANGELOG.md +0 -29
- package/CITATION.cff +0 -13
- package/CODE_OF_CONDUCT.md +0 -121
- package/CONTRIBUTING.md +0 -2
- package/SECURITY.md +0 -9
- package/app/api.ts +0 -136
- package/app/ascii.ts +0 -18
- package/app/commands.ts +0 -117
- package/app/config.ts +0 -9
- package/app/functions.ts +0 -43
- package/app/ghitgud.ts +0 -19
- package/app/library.ts +0 -157
- package/app/types.ts +0 -8
- package/dist/app/api.js +0 -127
- package/dist/app/ascii.js +0 -20
- package/dist/app/commands.js +0 -89
- package/dist/app/config.js +0 -12
- package/dist/app/functions.js +0 -37
- package/dist/app/ghitgud.js +0 -20
- package/dist/app/library.js +0 -122
- package/dist/app/types.js +0 -2
- package/dist/tests/library.test.js +0 -81
- package/scripts/clean.sh +0 -2
- package/tests/library.test.ts +0 -77
- package/tsconfig.json +0 -113
package/dist/index.js
ADDED
|
@@ -0,0 +1,793 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
//#region \0rolldown/runtime.js
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __esmMin = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
10
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
11
|
+
var __exportAll = (all, no_symbols) => {
|
|
12
|
+
let target = {};
|
|
13
|
+
for (var name in all) __defProp(target, name, {
|
|
14
|
+
get: all[name],
|
|
15
|
+
enumerable: true
|
|
16
|
+
});
|
|
17
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __copyProps = (to, from, except, desc) => {
|
|
21
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
22
|
+
key = keys[i];
|
|
23
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
24
|
+
get: ((k) => from[k]).bind(null, key),
|
|
25
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
return to;
|
|
29
|
+
};
|
|
30
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
31
|
+
value: mod,
|
|
32
|
+
enumerable: true
|
|
33
|
+
}) : target, mod));
|
|
34
|
+
var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
35
|
+
//#endregion
|
|
36
|
+
let process$1 = require("process");
|
|
37
|
+
process$1 = __toESM(process$1);
|
|
38
|
+
let commander = require("commander");
|
|
39
|
+
let figlet = require("figlet");
|
|
40
|
+
figlet = __toESM(figlet);
|
|
41
|
+
let consola = require("consola");
|
|
42
|
+
let path = require("path");
|
|
43
|
+
path = __toESM(path);
|
|
44
|
+
let fs = require("fs");
|
|
45
|
+
fs = __toESM(fs);
|
|
46
|
+
let os = require("os");
|
|
47
|
+
os = __toESM(os);
|
|
48
|
+
//#region src/cli/ascii.ts
|
|
49
|
+
var ascii = figlet.default.textSync("Ghitgud", {
|
|
50
|
+
font: "Standard",
|
|
51
|
+
width: 80,
|
|
52
|
+
verticalLayout: "default",
|
|
53
|
+
whitespaceBreak: true,
|
|
54
|
+
horizontalLayout: "default"
|
|
55
|
+
});
|
|
56
|
+
//#endregion
|
|
57
|
+
//#region src/core/logger.ts
|
|
58
|
+
var logger = (0, consola.createConsola)({ defaults: { tag: "ghitgud" } });
|
|
59
|
+
//#endregion
|
|
60
|
+
//#region src/core/constants.ts
|
|
61
|
+
var GHITGUD_FOLDER = path.default.join(os.default.homedir(), ".config", "ghitgud");
|
|
62
|
+
var CREDENTIALS_FILE = "credentials.json";
|
|
63
|
+
var METADATA_FILE = "labels.json";
|
|
64
|
+
var ENCODING = "utf8";
|
|
65
|
+
var CREDENTIALS_PATH = path.default.join(GHITGUD_FOLDER, CREDENTIALS_FILE);
|
|
66
|
+
var METADATA_FILE_PATH = path.default.join(GHITGUD_FOLDER, METADATA_FILE);
|
|
67
|
+
var TEMPLATES_DIR = path.default.join(__dirname, "templates");
|
|
68
|
+
var GITHUB_API_VERSION = "2022-11-28";
|
|
69
|
+
var GITHUB_API_BASE_URL = "https://api.github.com";
|
|
70
|
+
var GITHUB_API_ACCEPT = "application/vnd.github+json";
|
|
71
|
+
var ERROR_UNAUTHORIZED = "Unauthorized.";
|
|
72
|
+
var ERROR_NOT_FOUND = "Resource not found.";
|
|
73
|
+
var ERROR_UNPROCESSABLE = "Content is unprocessable.";
|
|
74
|
+
var ERROR_UNEXPECTED = "Unexpected status code.";
|
|
75
|
+
var ERROR_NO_REPO = "Repository not configured. Set it with: ghitgud config set repo owner/repo.";
|
|
76
|
+
var ERROR_NO_TOKEN = "Token not configured. Set it with: ghitgud config set token <your-token>.";
|
|
77
|
+
var ERROR_UNSUPPORTED_KEY = "Trying to set unsupported key.";
|
|
78
|
+
var ERROR_NO_METADATA = "No metadata file found.";
|
|
79
|
+
var PING_RESPONSE = "pong";
|
|
80
|
+
var SUPPORTED_CONFIG_KEYS = ["token", "repo"];
|
|
81
|
+
//#endregion
|
|
82
|
+
//#region src/core/io.ts
|
|
83
|
+
var readJsonFile = (filePath) => {
|
|
84
|
+
const data = fs.default.readFileSync(filePath, ENCODING);
|
|
85
|
+
return JSON.parse(data);
|
|
86
|
+
};
|
|
87
|
+
var writeJsonFile = (filePath, data) => {
|
|
88
|
+
fs.default.writeFileSync(filePath, JSON.stringify(data, null, 2), ENCODING);
|
|
89
|
+
};
|
|
90
|
+
var fileExists = (filePath) => {
|
|
91
|
+
return fs.default.existsSync(filePath);
|
|
92
|
+
};
|
|
93
|
+
var ensureDir = (dirPath) => {
|
|
94
|
+
fs.default.mkdirSync(dirPath, { recursive: true });
|
|
95
|
+
};
|
|
96
|
+
var io_default = {
|
|
97
|
+
readJsonFile,
|
|
98
|
+
writeJsonFile,
|
|
99
|
+
fileExists,
|
|
100
|
+
ensureDir
|
|
101
|
+
};
|
|
102
|
+
//#endregion
|
|
103
|
+
//#region node_modules/.pnpm/dotenv@16.5.0/node_modules/dotenv/package.json
|
|
104
|
+
var package_exports = /* @__PURE__ */ __exportAll({
|
|
105
|
+
browser: () => browser,
|
|
106
|
+
default: () => package_default,
|
|
107
|
+
description: () => description,
|
|
108
|
+
devDependencies: () => devDependencies,
|
|
109
|
+
engines: () => engines,
|
|
110
|
+
exports: () => exports$1,
|
|
111
|
+
funding: () => funding,
|
|
112
|
+
homepage: () => homepage,
|
|
113
|
+
keywords: () => keywords,
|
|
114
|
+
license: () => license,
|
|
115
|
+
main: () => main,
|
|
116
|
+
name: () => name,
|
|
117
|
+
readmeFilename: () => readmeFilename,
|
|
118
|
+
repository: () => repository,
|
|
119
|
+
scripts: () => scripts,
|
|
120
|
+
types: () => types,
|
|
121
|
+
version: () => version
|
|
122
|
+
});
|
|
123
|
+
var name, version, description, main, types, exports$1, scripts, repository, homepage, funding, keywords, readmeFilename, license, devDependencies, engines, browser, package_default;
|
|
124
|
+
var init_package = __esmMin((() => {
|
|
125
|
+
name = "dotenv";
|
|
126
|
+
version = "16.5.0";
|
|
127
|
+
description = "Loads environment variables from .env file";
|
|
128
|
+
main = "lib/main.js";
|
|
129
|
+
types = "lib/main.d.ts";
|
|
130
|
+
exports$1 = {
|
|
131
|
+
".": {
|
|
132
|
+
"types": "./lib/main.d.ts",
|
|
133
|
+
"require": "./lib/main.js",
|
|
134
|
+
"default": "./lib/main.js"
|
|
135
|
+
},
|
|
136
|
+
"./config": "./config.js",
|
|
137
|
+
"./config.js": "./config.js",
|
|
138
|
+
"./lib/env-options": "./lib/env-options.js",
|
|
139
|
+
"./lib/env-options.js": "./lib/env-options.js",
|
|
140
|
+
"./lib/cli-options": "./lib/cli-options.js",
|
|
141
|
+
"./lib/cli-options.js": "./lib/cli-options.js",
|
|
142
|
+
"./package.json": "./package.json"
|
|
143
|
+
};
|
|
144
|
+
scripts = {
|
|
145
|
+
"dts-check": "tsc --project tests/types/tsconfig.json",
|
|
146
|
+
"lint": "standard",
|
|
147
|
+
"pretest": "npm run lint && npm run dts-check",
|
|
148
|
+
"test": "tap run --allow-empty-coverage --disable-coverage --timeout=60000",
|
|
149
|
+
"test:coverage": "tap run --show-full-coverage --timeout=60000 --coverage-report=lcov",
|
|
150
|
+
"prerelease": "npm test",
|
|
151
|
+
"release": "standard-version"
|
|
152
|
+
};
|
|
153
|
+
repository = {
|
|
154
|
+
"type": "git",
|
|
155
|
+
"url": "git://github.com/motdotla/dotenv.git"
|
|
156
|
+
};
|
|
157
|
+
homepage = "https://github.com/motdotla/dotenv#readme";
|
|
158
|
+
funding = "https://dotenvx.com";
|
|
159
|
+
keywords = [
|
|
160
|
+
"dotenv",
|
|
161
|
+
"env",
|
|
162
|
+
".env",
|
|
163
|
+
"environment",
|
|
164
|
+
"variables",
|
|
165
|
+
"config",
|
|
166
|
+
"settings"
|
|
167
|
+
];
|
|
168
|
+
readmeFilename = "README.md";
|
|
169
|
+
license = "BSD-2-Clause";
|
|
170
|
+
devDependencies = {
|
|
171
|
+
"@types/node": "^18.11.3",
|
|
172
|
+
"decache": "^4.6.2",
|
|
173
|
+
"sinon": "^14.0.1",
|
|
174
|
+
"standard": "^17.0.0",
|
|
175
|
+
"standard-version": "^9.5.0",
|
|
176
|
+
"tap": "^19.2.0",
|
|
177
|
+
"typescript": "^4.8.4"
|
|
178
|
+
};
|
|
179
|
+
engines = { "node": ">=12" };
|
|
180
|
+
browser = { "fs": false };
|
|
181
|
+
package_default = {
|
|
182
|
+
name,
|
|
183
|
+
version,
|
|
184
|
+
description,
|
|
185
|
+
main,
|
|
186
|
+
types,
|
|
187
|
+
exports: exports$1,
|
|
188
|
+
scripts,
|
|
189
|
+
repository,
|
|
190
|
+
homepage,
|
|
191
|
+
funding,
|
|
192
|
+
keywords,
|
|
193
|
+
readmeFilename,
|
|
194
|
+
license,
|
|
195
|
+
devDependencies,
|
|
196
|
+
engines,
|
|
197
|
+
browser
|
|
198
|
+
};
|
|
199
|
+
}));
|
|
200
|
+
//#endregion
|
|
201
|
+
//#region node_modules/.pnpm/dotenv@16.5.0/node_modules/dotenv/lib/main.js
|
|
202
|
+
var require_main = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
203
|
+
var fs$2 = require("fs");
|
|
204
|
+
var path$2 = require("path");
|
|
205
|
+
var os$1 = require("os");
|
|
206
|
+
var crypto = require("crypto");
|
|
207
|
+
var version = (init_package(), __toCommonJS(package_exports).default).version;
|
|
208
|
+
var LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;
|
|
209
|
+
function parse(src) {
|
|
210
|
+
const obj = {};
|
|
211
|
+
let lines = src.toString();
|
|
212
|
+
lines = lines.replace(/\r\n?/gm, "\n");
|
|
213
|
+
let match;
|
|
214
|
+
while ((match = LINE.exec(lines)) != null) {
|
|
215
|
+
const key = match[1];
|
|
216
|
+
let value = match[2] || "";
|
|
217
|
+
value = value.trim();
|
|
218
|
+
const maybeQuote = value[0];
|
|
219
|
+
value = value.replace(/^(['"`])([\s\S]*)\1$/gm, "$2");
|
|
220
|
+
if (maybeQuote === "\"") {
|
|
221
|
+
value = value.replace(/\\n/g, "\n");
|
|
222
|
+
value = value.replace(/\\r/g, "\r");
|
|
223
|
+
}
|
|
224
|
+
obj[key] = value;
|
|
225
|
+
}
|
|
226
|
+
return obj;
|
|
227
|
+
}
|
|
228
|
+
function _parseVault(options) {
|
|
229
|
+
const vaultPath = _vaultPath(options);
|
|
230
|
+
const result = DotenvModule.configDotenv({ path: vaultPath });
|
|
231
|
+
if (!result.parsed) {
|
|
232
|
+
const err = /* @__PURE__ */ new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`);
|
|
233
|
+
err.code = "MISSING_DATA";
|
|
234
|
+
throw err;
|
|
235
|
+
}
|
|
236
|
+
const keys = _dotenvKey(options).split(",");
|
|
237
|
+
const length = keys.length;
|
|
238
|
+
let decrypted;
|
|
239
|
+
for (let i = 0; i < length; i++) try {
|
|
240
|
+
const attrs = _instructions(result, keys[i].trim());
|
|
241
|
+
decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key);
|
|
242
|
+
break;
|
|
243
|
+
} catch (error) {
|
|
244
|
+
if (i + 1 >= length) throw error;
|
|
245
|
+
}
|
|
246
|
+
return DotenvModule.parse(decrypted);
|
|
247
|
+
}
|
|
248
|
+
function _warn(message) {
|
|
249
|
+
console.log(`[dotenv@${version}][WARN] ${message}`);
|
|
250
|
+
}
|
|
251
|
+
function _debug(message) {
|
|
252
|
+
console.log(`[dotenv@${version}][DEBUG] ${message}`);
|
|
253
|
+
}
|
|
254
|
+
function _dotenvKey(options) {
|
|
255
|
+
if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) return options.DOTENV_KEY;
|
|
256
|
+
if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) return process.env.DOTENV_KEY;
|
|
257
|
+
return "";
|
|
258
|
+
}
|
|
259
|
+
function _instructions(result, dotenvKey) {
|
|
260
|
+
let uri;
|
|
261
|
+
try {
|
|
262
|
+
uri = new URL(dotenvKey);
|
|
263
|
+
} catch (error) {
|
|
264
|
+
if (error.code === "ERR_INVALID_URL") {
|
|
265
|
+
const err = /* @__PURE__ */ new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");
|
|
266
|
+
err.code = "INVALID_DOTENV_KEY";
|
|
267
|
+
throw err;
|
|
268
|
+
}
|
|
269
|
+
throw error;
|
|
270
|
+
}
|
|
271
|
+
const key = uri.password;
|
|
272
|
+
if (!key) {
|
|
273
|
+
const err = /* @__PURE__ */ new Error("INVALID_DOTENV_KEY: Missing key part");
|
|
274
|
+
err.code = "INVALID_DOTENV_KEY";
|
|
275
|
+
throw err;
|
|
276
|
+
}
|
|
277
|
+
const environment = uri.searchParams.get("environment");
|
|
278
|
+
if (!environment) {
|
|
279
|
+
const err = /* @__PURE__ */ new Error("INVALID_DOTENV_KEY: Missing environment part");
|
|
280
|
+
err.code = "INVALID_DOTENV_KEY";
|
|
281
|
+
throw err;
|
|
282
|
+
}
|
|
283
|
+
const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`;
|
|
284
|
+
const ciphertext = result.parsed[environmentKey];
|
|
285
|
+
if (!ciphertext) {
|
|
286
|
+
const err = /* @__PURE__ */ new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`);
|
|
287
|
+
err.code = "NOT_FOUND_DOTENV_ENVIRONMENT";
|
|
288
|
+
throw err;
|
|
289
|
+
}
|
|
290
|
+
return {
|
|
291
|
+
ciphertext,
|
|
292
|
+
key
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
function _vaultPath(options) {
|
|
296
|
+
let possibleVaultPath = null;
|
|
297
|
+
if (options && options.path && options.path.length > 0) if (Array.isArray(options.path)) {
|
|
298
|
+
for (const filepath of options.path) if (fs$2.existsSync(filepath)) possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`;
|
|
299
|
+
} else possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
|
|
300
|
+
else possibleVaultPath = path$2.resolve(process.cwd(), ".env.vault");
|
|
301
|
+
if (fs$2.existsSync(possibleVaultPath)) return possibleVaultPath;
|
|
302
|
+
return null;
|
|
303
|
+
}
|
|
304
|
+
function _resolveHome(envPath) {
|
|
305
|
+
return envPath[0] === "~" ? path$2.join(os$1.homedir(), envPath.slice(1)) : envPath;
|
|
306
|
+
}
|
|
307
|
+
function _configVault(options) {
|
|
308
|
+
if (Boolean(options && options.debug)) _debug("Loading env from encrypted .env.vault");
|
|
309
|
+
const parsed = DotenvModule._parseVault(options);
|
|
310
|
+
let processEnv = process.env;
|
|
311
|
+
if (options && options.processEnv != null) processEnv = options.processEnv;
|
|
312
|
+
DotenvModule.populate(processEnv, parsed, options);
|
|
313
|
+
return { parsed };
|
|
314
|
+
}
|
|
315
|
+
function configDotenv(options) {
|
|
316
|
+
const dotenvPath = path$2.resolve(process.cwd(), ".env");
|
|
317
|
+
let encoding = "utf8";
|
|
318
|
+
const debug = Boolean(options && options.debug);
|
|
319
|
+
if (options && options.encoding) encoding = options.encoding;
|
|
320
|
+
else if (debug) _debug("No encoding is specified. UTF-8 is used by default");
|
|
321
|
+
let optionPaths = [dotenvPath];
|
|
322
|
+
if (options && options.path) if (!Array.isArray(options.path)) optionPaths = [_resolveHome(options.path)];
|
|
323
|
+
else {
|
|
324
|
+
optionPaths = [];
|
|
325
|
+
for (const filepath of options.path) optionPaths.push(_resolveHome(filepath));
|
|
326
|
+
}
|
|
327
|
+
let lastError;
|
|
328
|
+
const parsedAll = {};
|
|
329
|
+
for (const path$4 of optionPaths) try {
|
|
330
|
+
const parsed = DotenvModule.parse(fs$2.readFileSync(path$4, { encoding }));
|
|
331
|
+
DotenvModule.populate(parsedAll, parsed, options);
|
|
332
|
+
} catch (e) {
|
|
333
|
+
if (debug) _debug(`Failed to load ${path$4} ${e.message}`);
|
|
334
|
+
lastError = e;
|
|
335
|
+
}
|
|
336
|
+
let processEnv = process.env;
|
|
337
|
+
if (options && options.processEnv != null) processEnv = options.processEnv;
|
|
338
|
+
DotenvModule.populate(processEnv, parsedAll, options);
|
|
339
|
+
if (lastError) return {
|
|
340
|
+
parsed: parsedAll,
|
|
341
|
+
error: lastError
|
|
342
|
+
};
|
|
343
|
+
else return { parsed: parsedAll };
|
|
344
|
+
}
|
|
345
|
+
function config(options) {
|
|
346
|
+
if (_dotenvKey(options).length === 0) return DotenvModule.configDotenv(options);
|
|
347
|
+
const vaultPath = _vaultPath(options);
|
|
348
|
+
if (!vaultPath) {
|
|
349
|
+
_warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`);
|
|
350
|
+
return DotenvModule.configDotenv(options);
|
|
351
|
+
}
|
|
352
|
+
return DotenvModule._configVault(options);
|
|
353
|
+
}
|
|
354
|
+
function decrypt(encrypted, keyStr) {
|
|
355
|
+
const key = Buffer.from(keyStr.slice(-64), "hex");
|
|
356
|
+
let ciphertext = Buffer.from(encrypted, "base64");
|
|
357
|
+
const nonce = ciphertext.subarray(0, 12);
|
|
358
|
+
const authTag = ciphertext.subarray(-16);
|
|
359
|
+
ciphertext = ciphertext.subarray(12, -16);
|
|
360
|
+
try {
|
|
361
|
+
const aesgcm = crypto.createDecipheriv("aes-256-gcm", key, nonce);
|
|
362
|
+
aesgcm.setAuthTag(authTag);
|
|
363
|
+
return `${aesgcm.update(ciphertext)}${aesgcm.final()}`;
|
|
364
|
+
} catch (error) {
|
|
365
|
+
const isRange = error instanceof RangeError;
|
|
366
|
+
const invalidKeyLength = error.message === "Invalid key length";
|
|
367
|
+
const decryptionFailed = error.message === "Unsupported state or unable to authenticate data";
|
|
368
|
+
if (isRange || invalidKeyLength) {
|
|
369
|
+
const err = /* @__PURE__ */ new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");
|
|
370
|
+
err.code = "INVALID_DOTENV_KEY";
|
|
371
|
+
throw err;
|
|
372
|
+
} else if (decryptionFailed) {
|
|
373
|
+
const err = /* @__PURE__ */ new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");
|
|
374
|
+
err.code = "DECRYPTION_FAILED";
|
|
375
|
+
throw err;
|
|
376
|
+
} else throw error;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
function populate(processEnv, parsed, options = {}) {
|
|
380
|
+
const debug = Boolean(options && options.debug);
|
|
381
|
+
const override = Boolean(options && options.override);
|
|
382
|
+
if (typeof parsed !== "object") {
|
|
383
|
+
const err = /* @__PURE__ */ new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");
|
|
384
|
+
err.code = "OBJECT_REQUIRED";
|
|
385
|
+
throw err;
|
|
386
|
+
}
|
|
387
|
+
for (const key of Object.keys(parsed)) if (Object.prototype.hasOwnProperty.call(processEnv, key)) {
|
|
388
|
+
if (override === true) processEnv[key] = parsed[key];
|
|
389
|
+
if (debug) if (override === true) _debug(`"${key}" is already defined and WAS overwritten`);
|
|
390
|
+
else _debug(`"${key}" is already defined and was NOT overwritten`);
|
|
391
|
+
} else processEnv[key] = parsed[key];
|
|
392
|
+
}
|
|
393
|
+
var DotenvModule = {
|
|
394
|
+
configDotenv,
|
|
395
|
+
_configVault,
|
|
396
|
+
_parseVault,
|
|
397
|
+
config,
|
|
398
|
+
decrypt,
|
|
399
|
+
parse,
|
|
400
|
+
populate
|
|
401
|
+
};
|
|
402
|
+
module.exports.configDotenv = DotenvModule.configDotenv;
|
|
403
|
+
module.exports._configVault = DotenvModule._configVault;
|
|
404
|
+
module.exports._parseVault = DotenvModule._parseVault;
|
|
405
|
+
module.exports.config = DotenvModule.config;
|
|
406
|
+
module.exports.decrypt = DotenvModule.decrypt;
|
|
407
|
+
module.exports.parse = DotenvModule.parse;
|
|
408
|
+
module.exports.populate = DotenvModule.populate;
|
|
409
|
+
module.exports = DotenvModule;
|
|
410
|
+
}));
|
|
411
|
+
//#endregion
|
|
412
|
+
//#region node_modules/.pnpm/dotenv@16.5.0/node_modules/dotenv/lib/env-options.js
|
|
413
|
+
var require_env_options = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
414
|
+
var options = {};
|
|
415
|
+
if (process.env.DOTENV_CONFIG_ENCODING != null) options.encoding = process.env.DOTENV_CONFIG_ENCODING;
|
|
416
|
+
if (process.env.DOTENV_CONFIG_PATH != null) options.path = process.env.DOTENV_CONFIG_PATH;
|
|
417
|
+
if (process.env.DOTENV_CONFIG_DEBUG != null) options.debug = process.env.DOTENV_CONFIG_DEBUG;
|
|
418
|
+
if (process.env.DOTENV_CONFIG_OVERRIDE != null) options.override = process.env.DOTENV_CONFIG_OVERRIDE;
|
|
419
|
+
if (process.env.DOTENV_CONFIG_DOTENV_KEY != null) options.DOTENV_KEY = process.env.DOTENV_CONFIG_DOTENV_KEY;
|
|
420
|
+
module.exports = options;
|
|
421
|
+
}));
|
|
422
|
+
//#endregion
|
|
423
|
+
//#region node_modules/.pnpm/dotenv@16.5.0/node_modules/dotenv/lib/cli-options.js
|
|
424
|
+
var require_cli_options = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
425
|
+
var re = /^dotenv_config_(encoding|path|debug|override|DOTENV_KEY)=(.+)$/;
|
|
426
|
+
module.exports = function optionMatcher(args) {
|
|
427
|
+
return args.reduce(function(acc, cur) {
|
|
428
|
+
const matches = cur.match(re);
|
|
429
|
+
if (matches) acc[matches[1]] = matches[2];
|
|
430
|
+
return acc;
|
|
431
|
+
}, {});
|
|
432
|
+
};
|
|
433
|
+
}));
|
|
434
|
+
//#endregion
|
|
435
|
+
//#region node_modules/.pnpm/dotenv@16.5.0/node_modules/dotenv/config.js
|
|
436
|
+
(function() {
|
|
437
|
+
require_main().config(Object.assign({}, require_env_options(), require_cli_options()(process.argv)));
|
|
438
|
+
})();
|
|
439
|
+
//#endregion
|
|
440
|
+
//#region src/core/errors.ts
|
|
441
|
+
var GhitgudError = class extends Error {
|
|
442
|
+
constructor(message) {
|
|
443
|
+
super(message);
|
|
444
|
+
this.name = "GhitgudError";
|
|
445
|
+
}
|
|
446
|
+
};
|
|
447
|
+
var AuthError = class extends GhitgudError {
|
|
448
|
+
constructor(message) {
|
|
449
|
+
super(message);
|
|
450
|
+
this.name = "AuthError";
|
|
451
|
+
}
|
|
452
|
+
};
|
|
453
|
+
var ConfigError = class extends GhitgudError {
|
|
454
|
+
constructor(message) {
|
|
455
|
+
super(message);
|
|
456
|
+
this.name = "ConfigError";
|
|
457
|
+
}
|
|
458
|
+
};
|
|
459
|
+
var NotFoundError = class extends GhitgudError {
|
|
460
|
+
constructor(message) {
|
|
461
|
+
super(message);
|
|
462
|
+
this.name = "NotFoundError";
|
|
463
|
+
}
|
|
464
|
+
};
|
|
465
|
+
var UnprocessableError = class extends GhitgudError {
|
|
466
|
+
constructor(message) {
|
|
467
|
+
super(message);
|
|
468
|
+
this.name = "UnprocessableError";
|
|
469
|
+
}
|
|
470
|
+
};
|
|
471
|
+
//#endregion
|
|
472
|
+
//#region src/core/config.ts
|
|
473
|
+
function readCredentialsFile() {
|
|
474
|
+
if (!fs.default.existsSync(CREDENTIALS_PATH)) return null;
|
|
475
|
+
const data = fs.default.readFileSync(CREDENTIALS_PATH, ENCODING);
|
|
476
|
+
return JSON.parse(data);
|
|
477
|
+
}
|
|
478
|
+
function resolve(key, envVar) {
|
|
479
|
+
const envValue = process$1.default.env[envVar];
|
|
480
|
+
if (envValue) return envValue;
|
|
481
|
+
const credentials = readCredentialsFile();
|
|
482
|
+
if (credentials && credentials[key]) return credentials[key];
|
|
483
|
+
throw new ConfigError(key === "repo" ? ERROR_NO_REPO : ERROR_NO_TOKEN);
|
|
484
|
+
}
|
|
485
|
+
function read(key) {
|
|
486
|
+
const credentials = readCredentialsFile();
|
|
487
|
+
if (credentials && credentials[key]) return credentials[key];
|
|
488
|
+
return null;
|
|
489
|
+
}
|
|
490
|
+
function has(key) {
|
|
491
|
+
if (!!process$1.default.env[key === "repo" ? "GHITGUD_GITHUB_REPO" : "GHITGUD_GITHUB_TOKEN"]) return true;
|
|
492
|
+
return !!readCredentialsFile()?.[key];
|
|
493
|
+
}
|
|
494
|
+
function write(key, value) {
|
|
495
|
+
let credentials = {};
|
|
496
|
+
if (fs.default.existsSync(CREDENTIALS_PATH)) {
|
|
497
|
+
const data = fs.default.readFileSync(CREDENTIALS_PATH, ENCODING);
|
|
498
|
+
credentials = JSON.parse(data);
|
|
499
|
+
} else fs.default.mkdirSync(GHITGUD_FOLDER, { recursive: true });
|
|
500
|
+
credentials[key] = value;
|
|
501
|
+
fs.default.writeFileSync(CREDENTIALS_PATH, JSON.stringify(credentials, null, 2), ENCODING);
|
|
502
|
+
}
|
|
503
|
+
function getRepo() {
|
|
504
|
+
return resolve("repo", "GHITGUD_GITHUB_REPO");
|
|
505
|
+
}
|
|
506
|
+
function getToken() {
|
|
507
|
+
return resolve("token", "GHITGUD_GITHUB_TOKEN");
|
|
508
|
+
}
|
|
509
|
+
var config = {
|
|
510
|
+
getRepo,
|
|
511
|
+
getToken,
|
|
512
|
+
read,
|
|
513
|
+
write,
|
|
514
|
+
has
|
|
515
|
+
};
|
|
516
|
+
//#endregion
|
|
517
|
+
//#region src/api/client.ts
|
|
518
|
+
var ERROR_MAP = {
|
|
519
|
+
[401]: AuthError,
|
|
520
|
+
[404]: NotFoundError,
|
|
521
|
+
[422]: UnprocessableError
|
|
522
|
+
};
|
|
523
|
+
var ERROR_MESSAGES = {
|
|
524
|
+
[401]: ERROR_UNAUTHORIZED,
|
|
525
|
+
[404]: ERROR_NOT_FOUND,
|
|
526
|
+
[422]: ERROR_UNPROCESSABLE
|
|
527
|
+
};
|
|
528
|
+
function buildHeaders() {
|
|
529
|
+
return {
|
|
530
|
+
Accept: GITHUB_API_ACCEPT,
|
|
531
|
+
Authorization: `Bearer ${config.getToken()}`,
|
|
532
|
+
"X-GitHub-Api-Version": GITHUB_API_VERSION
|
|
533
|
+
};
|
|
534
|
+
}
|
|
535
|
+
function handleError(status) {
|
|
536
|
+
const ErrorClass = ERROR_MAP[status];
|
|
537
|
+
if (ErrorClass) throw new ErrorClass(ERROR_MESSAGES[status]);
|
|
538
|
+
throw new GhitgudError(`${ERROR_UNEXPECTED}: ${status}`);
|
|
539
|
+
}
|
|
540
|
+
function isSuccessful(status) {
|
|
541
|
+
return status >= 200 && status <= 299;
|
|
542
|
+
}
|
|
543
|
+
async function request(endpoint, options = {}) {
|
|
544
|
+
const url = `${GITHUB_API_BASE_URL}${endpoint}`;
|
|
545
|
+
const headers = buildHeaders();
|
|
546
|
+
const fetchOptions = {
|
|
547
|
+
method: options.method || "GET",
|
|
548
|
+
headers
|
|
549
|
+
};
|
|
550
|
+
if (options.body) fetchOptions.body = JSON.stringify(options.body);
|
|
551
|
+
const response = await fetch(url, fetchOptions);
|
|
552
|
+
if (isSuccessful(response.status)) return response;
|
|
553
|
+
handleError(response.status);
|
|
554
|
+
}
|
|
555
|
+
var client = {
|
|
556
|
+
get: (endpoint) => request(endpoint),
|
|
557
|
+
post: (endpoint, body) => request(endpoint, {
|
|
558
|
+
method: "POST",
|
|
559
|
+
body
|
|
560
|
+
}),
|
|
561
|
+
patch: (endpoint, body) => request(endpoint, {
|
|
562
|
+
method: "PATCH",
|
|
563
|
+
body
|
|
564
|
+
}),
|
|
565
|
+
getRepo: () => config.getRepo(),
|
|
566
|
+
isOk: (status) => isSuccessful(status),
|
|
567
|
+
isNotFound: (status) => status === 404,
|
|
568
|
+
delete: (endpoint) => request(endpoint, { method: "DELETE" })
|
|
569
|
+
};
|
|
570
|
+
//#endregion
|
|
571
|
+
//#region src/api/labels.ts
|
|
572
|
+
var labels = {
|
|
573
|
+
fetch: async () => {
|
|
574
|
+
const repo = client.getRepo();
|
|
575
|
+
return client.get(`/repos/${repo}/labels`);
|
|
576
|
+
},
|
|
577
|
+
get: async (name) => {
|
|
578
|
+
const repo = client.getRepo();
|
|
579
|
+
return client.get(`/repos/${repo}/labels/${name}`);
|
|
580
|
+
},
|
|
581
|
+
create: async (label) => {
|
|
582
|
+
const repo = client.getRepo();
|
|
583
|
+
return client.post(`/repos/${repo}/labels`, {
|
|
584
|
+
name: label.name,
|
|
585
|
+
color: label.color,
|
|
586
|
+
description: label.description
|
|
587
|
+
});
|
|
588
|
+
},
|
|
589
|
+
patch: async (label) => {
|
|
590
|
+
const repo = client.getRepo();
|
|
591
|
+
return client.patch(`/repos/${repo}/labels/${label.name}`, {
|
|
592
|
+
color: label.color,
|
|
593
|
+
description: label.description,
|
|
594
|
+
new_name: label.newName || label.name
|
|
595
|
+
});
|
|
596
|
+
},
|
|
597
|
+
delete: async (name) => {
|
|
598
|
+
const repo = client.getRepo();
|
|
599
|
+
return client.delete(`/repos/${repo}/labels/${name}`);
|
|
600
|
+
}
|
|
601
|
+
};
|
|
602
|
+
//#endregion
|
|
603
|
+
//#region src/types/index.ts
|
|
604
|
+
var normalizeLabel = (label) => ({
|
|
605
|
+
name: label.name,
|
|
606
|
+
color: label.color,
|
|
607
|
+
description: label.description
|
|
608
|
+
});
|
|
609
|
+
//#endregion
|
|
610
|
+
//#region src/services/labels.ts
|
|
611
|
+
var formatLabels = (labels) => {
|
|
612
|
+
const rows = labels.map((label) => ({
|
|
613
|
+
name: label.name,
|
|
614
|
+
color: label.color,
|
|
615
|
+
description: label.description
|
|
616
|
+
}));
|
|
617
|
+
console.log();
|
|
618
|
+
console.table(rows);
|
|
619
|
+
};
|
|
620
|
+
var ping = () => {
|
|
621
|
+
logger.success(PING_RESPONSE + ".");
|
|
622
|
+
return {
|
|
623
|
+
success: true,
|
|
624
|
+
message: PING_RESPONSE
|
|
625
|
+
};
|
|
626
|
+
};
|
|
627
|
+
var list = async () => {
|
|
628
|
+
logger.info("Fetching labels from repository.");
|
|
629
|
+
const labels$1 = (await (await labels.fetch()).json()).map((label) => normalizeLabel(label));
|
|
630
|
+
formatLabels(labels$1);
|
|
631
|
+
return {
|
|
632
|
+
success: true,
|
|
633
|
+
metadata: labels$1
|
|
634
|
+
};
|
|
635
|
+
};
|
|
636
|
+
var pull = async () => {
|
|
637
|
+
logger.info("Pulling labels from repository.");
|
|
638
|
+
const labels$2 = (await (await labels.fetch()).json()).map((label) => normalizeLabel(label));
|
|
639
|
+
io_default.ensureDir(GHITGUD_FOLDER);
|
|
640
|
+
io_default.writeJsonFile(METADATA_FILE_PATH, labels$2);
|
|
641
|
+
logger.success("Labels pulled successfully.");
|
|
642
|
+
return {
|
|
643
|
+
success: true,
|
|
644
|
+
metadata: labels$2
|
|
645
|
+
};
|
|
646
|
+
};
|
|
647
|
+
var pullTemplate = async (templateName, templatesDir) => {
|
|
648
|
+
logger.info(`Pulling labels from template "${templateName}".`);
|
|
649
|
+
const templatePath = path.default.join(templatesDir, `${templateName}.json`);
|
|
650
|
+
if (!io_default.fileExists(templatePath)) throw new Error(`Template "${templateName}" not found at ${templatePath}.`);
|
|
651
|
+
const labels = io_default.readJsonFile(templatePath);
|
|
652
|
+
io_default.ensureDir(GHITGUD_FOLDER);
|
|
653
|
+
io_default.writeJsonFile(METADATA_FILE_PATH, labels);
|
|
654
|
+
formatLabels(labels);
|
|
655
|
+
logger.success(`Labels pulled from template "${templateName}".`);
|
|
656
|
+
return {
|
|
657
|
+
success: true,
|
|
658
|
+
metadata: labels
|
|
659
|
+
};
|
|
660
|
+
};
|
|
661
|
+
var upsertLabels = async (labels$3) => {
|
|
662
|
+
logger.info(`Upserting ${labels$3.length} label(s).`);
|
|
663
|
+
await Promise.all(labels$3.map(async (label) => {
|
|
664
|
+
try {
|
|
665
|
+
await labels.get(label.name);
|
|
666
|
+
await labels.patch(label);
|
|
667
|
+
} catch (error) {
|
|
668
|
+
if (error instanceof NotFoundError) await labels.create(label);
|
|
669
|
+
else throw error;
|
|
670
|
+
}
|
|
671
|
+
}));
|
|
672
|
+
};
|
|
673
|
+
var push = async () => {
|
|
674
|
+
if (!io_default.fileExists(METADATA_FILE_PATH)) throw new Error(ERROR_NO_METADATA);
|
|
675
|
+
logger.info("Pushing labels to repository.");
|
|
676
|
+
await upsertLabels(io_default.readJsonFile(METADATA_FILE_PATH));
|
|
677
|
+
logger.success("Labels pushed successfully.");
|
|
678
|
+
return { success: true };
|
|
679
|
+
};
|
|
680
|
+
var pushTemplate = async (templateName, templatesDir) => {
|
|
681
|
+
logger.info(`Pushing labels from template "${templateName}".`);
|
|
682
|
+
const templatePath = path.default.join(templatesDir, `${templateName}.json`);
|
|
683
|
+
if (!io_default.fileExists(templatePath)) throw new Error(`Template "${templateName}" not found at ${templatePath}.`);
|
|
684
|
+
await upsertLabels(io_default.readJsonFile(templatePath));
|
|
685
|
+
logger.success(`Labels pushed from template "${templateName}".`);
|
|
686
|
+
return { success: true };
|
|
687
|
+
};
|
|
688
|
+
var prune = async () => {
|
|
689
|
+
if (!io_default.fileExists(METADATA_FILE_PATH)) throw new Error(ERROR_NO_METADATA);
|
|
690
|
+
const labels$4 = io_default.readJsonFile(METADATA_FILE_PATH);
|
|
691
|
+
logger.info(`Pruning ${labels$4.length} label(s) from repository.`);
|
|
692
|
+
await Promise.all(labels$4.map(async (label) => {
|
|
693
|
+
await labels.delete(label.name);
|
|
694
|
+
}));
|
|
695
|
+
logger.success("Labels pruned successfully.");
|
|
696
|
+
return { success: true };
|
|
697
|
+
};
|
|
698
|
+
var labels_default$1 = {
|
|
699
|
+
ping,
|
|
700
|
+
list,
|
|
701
|
+
pull,
|
|
702
|
+
pullTemplate,
|
|
703
|
+
push,
|
|
704
|
+
pushTemplate,
|
|
705
|
+
prune
|
|
706
|
+
};
|
|
707
|
+
//#endregion
|
|
708
|
+
//#region src/commands/ping.ts
|
|
709
|
+
var register$2 = (program) => {
|
|
710
|
+
program.command("ping").description("Check if the CLI is working.").action(() => void labels_default$1.ping());
|
|
711
|
+
};
|
|
712
|
+
var ping_default = { register: register$2 };
|
|
713
|
+
//#endregion
|
|
714
|
+
//#region src/commands/labels.ts
|
|
715
|
+
var register$1 = (program) => {
|
|
716
|
+
const labels = program.command("labels").description("Manage labels for a repository.");
|
|
717
|
+
labels.command("list").description("List all labels for a repository.").action(() => void labels_default$1.list());
|
|
718
|
+
labels.command("pull").description("Pull all related labels for a repository.").option("-t, --template <name>", "Pull from a built-in template instead of the remote repository").action(async (options) => {
|
|
719
|
+
if (options.template) await labels_default$1.pullTemplate(options.template, TEMPLATES_DIR);
|
|
720
|
+
else await labels_default$1.pull();
|
|
721
|
+
});
|
|
722
|
+
labels.command("push").description("Push all related labels for a repository.").option("-t, --template <name>", "Push from a built-in template instead of the local metadata file").action(async (options) => {
|
|
723
|
+
if (options.template) await labels_default$1.pushTemplate(options.template, TEMPLATES_DIR);
|
|
724
|
+
else await labels_default$1.push();
|
|
725
|
+
});
|
|
726
|
+
labels.command("prune").description("Prune all related labels for a repository.").action(() => void labels_default$1.prune());
|
|
727
|
+
};
|
|
728
|
+
var labels_default = { register: register$1 };
|
|
729
|
+
//#endregion
|
|
730
|
+
//#region src/services/config.ts
|
|
731
|
+
var validateKey = (key) => {
|
|
732
|
+
if (!SUPPORTED_CONFIG_KEYS.includes(key)) throw new ConfigError(ERROR_UNSUPPORTED_KEY);
|
|
733
|
+
return key;
|
|
734
|
+
};
|
|
735
|
+
var set = (key, value) => {
|
|
736
|
+
validateKey(key);
|
|
737
|
+
logger.info(`Setting config "${key}".`);
|
|
738
|
+
config.write(key, value);
|
|
739
|
+
logger.success(`Config "${key}" set successfully.`);
|
|
740
|
+
return { success: true };
|
|
741
|
+
};
|
|
742
|
+
var get = (key) => {
|
|
743
|
+
validateKey(key);
|
|
744
|
+
const value = config.read(key);
|
|
745
|
+
logger.info(`${key}: ${value ?? "(not set)"}.`);
|
|
746
|
+
return {
|
|
747
|
+
success: true,
|
|
748
|
+
key,
|
|
749
|
+
value: value || null
|
|
750
|
+
};
|
|
751
|
+
};
|
|
752
|
+
var config_default$1 = {
|
|
753
|
+
set,
|
|
754
|
+
get
|
|
755
|
+
};
|
|
756
|
+
//#endregion
|
|
757
|
+
//#region src/commands/config.ts
|
|
758
|
+
var register = (program) => {
|
|
759
|
+
const config = program.command("config").description("Set CLI configurations.");
|
|
760
|
+
config.command("set").description("Set configuration.").arguments("<key> <value>").action((key, value) => {
|
|
761
|
+
config_default$1.set(key, value);
|
|
762
|
+
});
|
|
763
|
+
config.command("get").description("Get configuration value.").arguments("<key>").action((key) => {
|
|
764
|
+
config_default$1.get(key);
|
|
765
|
+
});
|
|
766
|
+
};
|
|
767
|
+
var config_default = { register };
|
|
768
|
+
//#endregion
|
|
769
|
+
//#region src/cli/index.ts
|
|
770
|
+
commander.program.name("ghitgud").description("A simple CLI to give superpowers to GitHub.").version("2.0.0");
|
|
771
|
+
ping_default.register(commander.program);
|
|
772
|
+
labels_default.register(commander.program);
|
|
773
|
+
config_default.register(commander.program);
|
|
774
|
+
commander.program.addHelpText("before", ascii);
|
|
775
|
+
commander.program.exitOverride();
|
|
776
|
+
try {
|
|
777
|
+
commander.program.parse(process$1.default.argv);
|
|
778
|
+
} catch (error) {
|
|
779
|
+
if (error instanceof GhitgudError) {
|
|
780
|
+
logger.error(error.message);
|
|
781
|
+
process$1.default.exit(1);
|
|
782
|
+
}
|
|
783
|
+
if (error.exitCode === 0) process$1.default.exit(0);
|
|
784
|
+
throw error;
|
|
785
|
+
}
|
|
786
|
+
process$1.default.on("unhandledRejection", (error) => {
|
|
787
|
+
if (error instanceof GhitgudError) {
|
|
788
|
+
logger.error(error.message);
|
|
789
|
+
process$1.default.exit(1);
|
|
790
|
+
}
|
|
791
|
+
throw error;
|
|
792
|
+
});
|
|
793
|
+
//#endregion
|