@twilio/flex-dev-utils 5.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.
Files changed (117) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +38 -0
  3. package/dist/axios.d.ts +6 -0
  4. package/dist/axios.js +18 -0
  5. package/dist/axios.js.map +1 -0
  6. package/dist/credentials.d.ts +40 -0
  7. package/dist/credentials.js +241 -0
  8. package/dist/credentials.js.map +1 -0
  9. package/dist/env.d.ts +1 -0
  10. package/dist/env.js +13 -0
  11. package/dist/env.js.map +1 -0
  12. package/dist/errors/index.d.ts +6 -0
  13. package/dist/errors/index.js +19 -0
  14. package/dist/errors/index.js.map +1 -0
  15. package/dist/errors/lib/FlexPluginError.d.ts +7 -0
  16. package/dist/errors/lib/FlexPluginError.js +54 -0
  17. package/dist/errors/lib/FlexPluginError.js.map +1 -0
  18. package/dist/errors/lib/UserActionError.d.ts +5 -0
  19. package/dist/errors/lib/UserActionError.js +35 -0
  20. package/dist/errors/lib/UserActionError.js.map +1 -0
  21. package/dist/errors/lib/ValidationError.d.ts +3 -0
  22. package/dist/errors/lib/ValidationError.js +30 -0
  23. package/dist/errors/lib/ValidationError.js.map +1 -0
  24. package/dist/exit.d.ts +8 -0
  25. package/dist/exit.js +18 -0
  26. package/dist/exit.js.map +1 -0
  27. package/dist/fs.d.ts +318 -0
  28. package/dist/fs.js +797 -0
  29. package/dist/fs.js.map +1 -0
  30. package/dist/http/index.d.ts +1 -0
  31. package/dist/http/index.js +10 -0
  32. package/dist/http/index.js.map +1 -0
  33. package/dist/http/lib/http.d.ts +114 -0
  34. package/dist/http/lib/http.js +337 -0
  35. package/dist/http/lib/http.js.map +1 -0
  36. package/dist/index.d.ts +25 -0
  37. package/dist/index.js +93 -0
  38. package/dist/index.js.map +1 -0
  39. package/dist/keychain.d.ts +25 -0
  40. package/dist/keychain.js +84 -0
  41. package/dist/keychain.js.map +1 -0
  42. package/dist/lodash.d.ts +13 -0
  43. package/dist/lodash.js +30 -0
  44. package/dist/lodash.js.map +1 -0
  45. package/dist/logger/index.d.ts +13 -0
  46. package/dist/logger/index.js +52 -0
  47. package/dist/logger/index.js.map +1 -0
  48. package/dist/logger/lib/boxen.d.ts +38 -0
  49. package/dist/logger/lib/boxen.js +85 -0
  50. package/dist/logger/lib/boxen.js.map +1 -0
  51. package/dist/logger/lib/columnify.d.ts +2 -0
  52. package/dist/logger/lib/columnify.js +8 -0
  53. package/dist/logger/lib/columnify.js.map +1 -0
  54. package/dist/logger/lib/logger.d.ts +157 -0
  55. package/dist/logger/lib/logger.js +354 -0
  56. package/dist/logger/lib/logger.js.map +1 -0
  57. package/dist/logger/lib/strings.d.ts +16 -0
  58. package/dist/logger/lib/strings.js +33 -0
  59. package/dist/logger/lib/strings.js.map +1 -0
  60. package/dist/logger/lib/table.d.ts +25 -0
  61. package/dist/logger/lib/table.js +75 -0
  62. package/dist/logger/lib/table.js.map +1 -0
  63. package/dist/open.d.ts +2 -0
  64. package/dist/open.js +9 -0
  65. package/dist/open.js.map +1 -0
  66. package/dist/prints.d.ts +11 -0
  67. package/dist/prints.js +47 -0
  68. package/dist/prints.js.map +1 -0
  69. package/dist/progress/index.d.ts +1 -0
  70. package/dist/progress/index.js +9 -0
  71. package/dist/progress/index.js.map +1 -0
  72. package/dist/progress/lib/progress.d.ts +21 -0
  73. package/dist/progress/lib/progress.js +118 -0
  74. package/dist/progress/lib/progress.js.map +1 -0
  75. package/dist/questions/index.d.ts +1 -0
  76. package/dist/questions/index.js +12 -0
  77. package/dist/questions/index.js.map +1 -0
  78. package/dist/questions/lib/inquirer.d.ts +39 -0
  79. package/dist/questions/lib/inquirer.js +136 -0
  80. package/dist/questions/lib/inquirer.js.map +1 -0
  81. package/dist/random.d.ts +15 -0
  82. package/dist/random.js +28 -0
  83. package/dist/random.js.map +1 -0
  84. package/dist/runner.d.ts +8 -0
  85. package/dist/runner.js +98 -0
  86. package/dist/runner.js.map +1 -0
  87. package/dist/semver.d.ts +9 -0
  88. package/dist/semver.js +36 -0
  89. package/dist/semver.js.map +1 -0
  90. package/dist/sids.d.ts +48 -0
  91. package/dist/sids.js +50 -0
  92. package/dist/sids.js.map +1 -0
  93. package/dist/spawn/index.d.ts +4 -0
  94. package/dist/spawn/index.js +15 -0
  95. package/dist/spawn/index.js.map +1 -0
  96. package/dist/spawn/lib/node.d.ts +9 -0
  97. package/dist/spawn/lib/node.js +74 -0
  98. package/dist/spawn/lib/node.js.map +1 -0
  99. package/dist/spawn/lib/npm.d.ts +9 -0
  100. package/dist/spawn/lib/npm.js +74 -0
  101. package/dist/spawn/lib/npm.js.map +1 -0
  102. package/dist/spawn/lib/spawn.d.ts +22 -0
  103. package/dist/spawn/lib/spawn.js +111 -0
  104. package/dist/spawn/lib/spawn.js.map +1 -0
  105. package/dist/spawn/lib/yarn.d.ts +9 -0
  106. package/dist/spawn/lib/yarn.js +74 -0
  107. package/dist/spawn/lib/yarn.js.map +1 -0
  108. package/dist/updateNotifier.d.ts +6 -0
  109. package/dist/updateNotifier.js +20 -0
  110. package/dist/updateNotifier.js.map +1 -0
  111. package/dist/urls.d.ts +28 -0
  112. package/dist/urls.js +147 -0
  113. package/dist/urls.js.map +1 -0
  114. package/dist/validators.d.ts +42 -0
  115. package/dist/validators.js +78 -0
  116. package/dist/validators.js.map +1 -0
  117. package/package.json +89 -0
@@ -0,0 +1,25 @@
1
+ export interface KeychainCredential {
2
+ account: string;
3
+ password: string;
4
+ }
5
+ export interface Keychain {
6
+ deletePassword: (account: string) => Promise<boolean>;
7
+ findCredentials: () => Promise<KeychainCredential[]>;
8
+ setPassword: (account: string, password: string) => Promise<void>;
9
+ }
10
+ interface Keytar {
11
+ deletePassword: (service: string, account: string) => Promise<boolean>;
12
+ findCredentials: (service: string) => Promise<KeychainCredential[]>;
13
+ setPassword: (service: string, account: string, password: string) => Promise<void>;
14
+ }
15
+ /**
16
+ * Keytar is required optionally and so may not exist.
17
+ * It will throw an error if a local installation is not found.
18
+ */
19
+ export declare const _getKeytar: () => Keytar;
20
+ /**
21
+ * main method that returns a keytar instance
22
+ * @param service
23
+ */
24
+ export default function keychain(service: string): Keychain;
25
+ export {};
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports._getKeytar = void 0;
40
+ /*
41
+ * Keytar is installed as an optional dependency
42
+ * Try to load it here but do not fail if it fails to be required
43
+ */
44
+ var _1 = require(".");
45
+ /**
46
+ * Keytar is required optionally and so may not exist.
47
+ * It will throw an error if a local installation is not found.
48
+ */
49
+ /* istanbul ignore next */
50
+ var _getKeytar = function () {
51
+ try {
52
+ // eslint-disable-next-line global-require, @typescript-eslint/no-require-imports
53
+ return require('keytar');
54
+ }
55
+ catch (e) {
56
+ /* istanbul ignore next */
57
+ if (!process.env.CI) {
58
+ _1.logger.debug('Failed to require keytar', e);
59
+ }
60
+ }
61
+ throw new Error('Optional dependency keytar was not installed');
62
+ };
63
+ exports._getKeytar = _getKeytar;
64
+ /**
65
+ * main method that returns a keytar instance
66
+ * @param service
67
+ */
68
+ function keychain(service) {
69
+ var _this = this;
70
+ var keytar = exports._getKeytar();
71
+ return {
72
+ deletePassword: function (account) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
73
+ return [2 /*return*/, keytar.deletePassword(service, account)];
74
+ }); }); },
75
+ findCredentials: function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
76
+ return [2 /*return*/, keytar.findCredentials(service)];
77
+ }); }); },
78
+ setPassword: function (account, password) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
79
+ return [2 /*return*/, keytar.setPassword(service, account, password)];
80
+ }); }); },
81
+ };
82
+ }
83
+ exports.default = keychain;
84
+ //# sourceMappingURL=keychain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keychain.js","sourceRoot":"","sources":["../src/keychain.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;GAGG;AACH,sBAA2B;AAmB3B;;;GAGG;AACH,0BAA0B;AACnB,IAAM,UAAU,GAAG;IACxB,IAAI;QACF,iFAAiF;QACjF,OAAO,OAAO,CAAC,QAAQ,CAAC,CAAC;KAC1B;IAAC,OAAO,CAAC,EAAE;QACV,0BAA0B;QAC1B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,EAAE;YACnB,SAAM,CAAC,KAAK,CAAC,0BAA0B,EAAE,CAAC,CAAC,CAAC;SAC7C;KACF;IAED,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;AAClE,CAAC,CAAC;AAZW,QAAA,UAAU,cAYrB;AAEF;;;GAGG;AACH,SAAwB,QAAQ,CAAC,OAAe;IAAhD,iBAQC;IAPC,IAAM,MAAM,GAAG,kBAAU,EAAE,CAAC;IAE5B,OAAO;QACL,cAAc,EAAE,UAAO,OAAe;YAAK,sBAAA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,EAAA;iBAAA;QAClF,eAAe,EAAE;YAAY,sBAAA,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,EAAA;iBAAA;QAC5D,WAAW,EAAE,UAAO,OAAe,EAAE,QAAgB;YAAK,sBAAA,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAA;iBAAA;KACzG,CAAC;AACJ,CAAC;AARD,2BAQC"}
@@ -0,0 +1,13 @@
1
+ import * as lodash from 'lodash';
2
+ export declare const camelCase: (string?: string | undefined) => string;
3
+ export declare const upperFirst: (string?: string | undefined) => string;
4
+ export declare const merge: {
5
+ <TObject, TSource>(object: TObject, source: TSource): TObject & TSource;
6
+ <TObject_1, TSource1, TSource2>(object: TObject_1, source1: TSource1, source2: TSource2): TObject_1 & TSource1 & TSource2;
7
+ <TObject_2, TSource1_1, TSource2_1, TSource3>(object: TObject_2, source1: TSource1_1, source2: TSource2_1, source3: TSource3): TObject_2 & TSource1_1 & TSource2_1 & TSource3;
8
+ <TObject_3, TSource1_2, TSource2_2, TSource3_1, TSource4>(object: TObject_3, source1: TSource1_2, source2: TSource2_2, source3: TSource3_1, source4: TSource4): TObject_3 & TSource1_2 & TSource2_2 & TSource3_1 & TSource4;
9
+ (object: any, ...otherArgs: any[]): any;
10
+ };
11
+ export declare const clone: <T>(value: T) => T;
12
+ export declare const cloneDeep: <T>(value: T) => T;
13
+ export default lodash;
package/dist/lodash.js ADDED
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.cloneDeep = exports.clone = exports.merge = exports.upperFirst = exports.camelCase = void 0;
23
+ var lodash = __importStar(require("lodash"));
24
+ exports.camelCase = lodash.camelCase;
25
+ exports.upperFirst = lodash.upperFirst;
26
+ exports.merge = lodash.merge;
27
+ exports.clone = lodash.clone;
28
+ exports.cloneDeep = lodash.cloneDeep;
29
+ exports.default = lodash;
30
+ //# sourceMappingURL=lodash.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lodash.js","sourceRoot":"","sources":["../src/lodash.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAiC;AAElB,QAAA,SAAS,GAAK,MAAM,WAAC;AACrB,QAAA,UAAU,GAAK,MAAM,YAAC;AACtB,QAAA,KAAK,GAAK,MAAM,OAAC;AACjB,QAAA,KAAK,GAAK,MAAM,OAAC;AACjB,QAAA,SAAS,GAAK,MAAM,WAAC;AAEpC,kBAAe,MAAM,CAAC"}
@@ -0,0 +1,13 @@
1
+ declare const boxen: {
2
+ error: (msg: string, showSymbol?: boolean) => void;
3
+ warning: (msg: string, showSymbol?: boolean) => void;
4
+ info: (msg: string, showSymbol?: boolean) => void;
5
+ print: (level: import("./lib/logger").LogLevels, msg: string) => void;
6
+ };
7
+ export { Logger, coloredStrings } from './lib/logger';
8
+ export { default as chalk } from 'chalk';
9
+ export { default as logger } from './lib/logger';
10
+ export { default as strings, multilineString, singleLineString } from './lib/strings';
11
+ export { default as table, printArray, printObjectArray } from './lib/table';
12
+ export { default as columnify } from './lib/columnify';
13
+ export { boxen };
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ /* eslint-disable import/no-unused-modules */
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
6
+ }) : (function(o, m, k, k2) {
7
+ if (k2 === undefined) k2 = k;
8
+ o[k2] = m[k];
9
+ }));
10
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
11
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
12
+ }) : function(o, v) {
13
+ o["default"] = v;
14
+ });
15
+ var __importStar = (this && this.__importStar) || function (mod) {
16
+ if (mod && mod.__esModule) return mod;
17
+ var result = {};
18
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
19
+ __setModuleDefault(result, mod);
20
+ return result;
21
+ };
22
+ var __importDefault = (this && this.__importDefault) || function (mod) {
23
+ return (mod && mod.__esModule) ? mod : { "default": mod };
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.boxen = exports.columnify = exports.printObjectArray = exports.printArray = exports.table = exports.singleLineString = exports.multilineString = exports.strings = exports.logger = exports.chalk = exports.coloredStrings = exports.Logger = void 0;
27
+ var _boxen = __importStar(require("./lib/boxen"));
28
+ var boxen = {
29
+ error: _boxen.error,
30
+ warning: _boxen.warning,
31
+ info: _boxen.info,
32
+ print: _boxen.print,
33
+ };
34
+ exports.boxen = boxen;
35
+ var logger_1 = require("./lib/logger");
36
+ Object.defineProperty(exports, "Logger", { enumerable: true, get: function () { return logger_1.Logger; } });
37
+ Object.defineProperty(exports, "coloredStrings", { enumerable: true, get: function () { return logger_1.coloredStrings; } });
38
+ var chalk_1 = require("chalk");
39
+ Object.defineProperty(exports, "chalk", { enumerable: true, get: function () { return __importDefault(chalk_1).default; } });
40
+ var logger_2 = require("./lib/logger");
41
+ Object.defineProperty(exports, "logger", { enumerable: true, get: function () { return __importDefault(logger_2).default; } });
42
+ var strings_1 = require("./lib/strings");
43
+ Object.defineProperty(exports, "strings", { enumerable: true, get: function () { return __importDefault(strings_1).default; } });
44
+ Object.defineProperty(exports, "multilineString", { enumerable: true, get: function () { return strings_1.multilineString; } });
45
+ Object.defineProperty(exports, "singleLineString", { enumerable: true, get: function () { return strings_1.singleLineString; } });
46
+ var table_1 = require("./lib/table");
47
+ Object.defineProperty(exports, "table", { enumerable: true, get: function () { return __importDefault(table_1).default; } });
48
+ Object.defineProperty(exports, "printArray", { enumerable: true, get: function () { return table_1.printArray; } });
49
+ Object.defineProperty(exports, "printObjectArray", { enumerable: true, get: function () { return table_1.printObjectArray; } });
50
+ var columnify_1 = require("./lib/columnify");
51
+ Object.defineProperty(exports, "columnify", { enumerable: true, get: function () { return __importDefault(columnify_1).default; } });
52
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/logger/index.ts"],"names":[],"mappings":";AAAA,6CAA6C;;;;;;;;;;;;;;;;;;;;;;;;;AAE7C,kDAAsC;AAEtC,IAAM,KAAK,GAAG;IACZ,KAAK,EAAE,MAAM,CAAC,KAAK;IACnB,OAAO,EAAE,MAAM,CAAC,OAAO;IACvB,IAAI,EAAE,MAAM,CAAC,IAAI;IACjB,KAAK,EAAE,MAAM,CAAC,KAAK;CACpB,CAAC;AAQO,sBAAK;AANd,uCAAsD;AAA7C,gGAAA,MAAM,OAAA;AAAE,wGAAA,cAAc,OAAA;AAC/B,+BAAyC;AAAhC,+GAAA,OAAO,OAAS;AACzB,uCAAiD;AAAxC,iHAAA,OAAO,OAAU;AAC1B,yCAAsF;AAA7E,mHAAA,OAAO,OAAW;AAAE,0GAAA,eAAe,OAAA;AAAE,2GAAA,gBAAgB,OAAA;AAC9D,qCAA6E;AAApE,+GAAA,OAAO,OAAS;AAAE,mGAAA,UAAU,OAAA;AAAE,yGAAA,gBAAgB,OAAA;AACvD,6CAAuD;AAA9C,uHAAA,OAAO,OAAa"}
@@ -0,0 +1,38 @@
1
+ import boxen from 'boxen';
2
+ import { LogLevels } from './logger';
3
+ export default boxen;
4
+ /**
5
+ * Prints the message inside a box
6
+ *
7
+ * @param level the log level to display the message as
8
+ * @param msg the message
9
+ */
10
+ export declare const print: (level: LogLevels, msg: string) => void;
11
+ /**
12
+ * Displays the message as a warning box
13
+ *
14
+ * @param msg the message to display
15
+ * @param showSymbol whether wrap the message in a warning symbol
16
+ */
17
+ export declare const warning: (msg: string, showSymbol?: boolean) => void;
18
+ /**
19
+ * Displays the message as an info box
20
+ *
21
+ * @param msg the message to display
22
+ * @param showSymbol whether wrap the message in an info symbol
23
+ */
24
+ export declare const info: (msg: string, showSymbol?: boolean) => void;
25
+ /**
26
+ * Displays the message as am error box
27
+ *
28
+ * @param msg the message to display
29
+ * @param showSymbol whether wrap the message in an error symbol
30
+ */
31
+ export declare const error: (msg: string, showSymbol?: boolean) => void;
32
+ /**
33
+ * Displays the message as a success box
34
+ *
35
+ * @param msg the message to display
36
+ * @param showSymbol whether wrap the message in a success symbol
37
+ */
38
+ export declare const success: (msg: string, showSymbol?: boolean) => void;
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.success = exports.error = exports.info = exports.warning = exports.print = void 0;
7
+ var boxen_1 = __importDefault(require("boxen"));
8
+ var log_symbols_1 = __importDefault(require("log-symbols"));
9
+ var logger_1 = __importDefault(require("./logger"));
10
+ exports.default = boxen_1.default;
11
+ /**
12
+ * Prints the message inside a box
13
+ *
14
+ * @param level the log level to display the message as
15
+ * @param msg the message
16
+ */
17
+ var print = function (level, msg) {
18
+ var boxed = boxen_1.default(msg, {
19
+ padding: 1,
20
+ margin: 1,
21
+ });
22
+ logger_1.default[level](boxed);
23
+ };
24
+ exports.print = print;
25
+ /**
26
+ * Displays the message as a warning box
27
+ *
28
+ * @param msg the message to display
29
+ * @param showSymbol whether wrap the message in a warning symbol
30
+ */
31
+ var warning = function (msg, showSymbol) {
32
+ if (showSymbol === void 0) { showSymbol = true; }
33
+ var sym = log_symbols_1.default.warning;
34
+ if (showSymbol) {
35
+ msg = sym + " " + msg + " " + sym;
36
+ }
37
+ exports.print('warning', msg);
38
+ };
39
+ exports.warning = warning;
40
+ /**
41
+ * Displays the message as an info box
42
+ *
43
+ * @param msg the message to display
44
+ * @param showSymbol whether wrap the message in an info symbol
45
+ */
46
+ var info = function (msg, showSymbol) {
47
+ if (showSymbol === void 0) { showSymbol = true; }
48
+ var sym = log_symbols_1.default.info;
49
+ if (showSymbol) {
50
+ msg = sym + " " + msg + " " + sym;
51
+ }
52
+ exports.print('info', msg);
53
+ };
54
+ exports.info = info;
55
+ /**
56
+ * Displays the message as am error box
57
+ *
58
+ * @param msg the message to display
59
+ * @param showSymbol whether wrap the message in an error symbol
60
+ */
61
+ var error = function (msg, showSymbol) {
62
+ if (showSymbol === void 0) { showSymbol = true; }
63
+ var sym = log_symbols_1.default.error;
64
+ if (showSymbol) {
65
+ msg = sym + " " + msg + " " + sym;
66
+ }
67
+ exports.print('error', msg);
68
+ };
69
+ exports.error = error;
70
+ /**
71
+ * Displays the message as a success box
72
+ *
73
+ * @param msg the message to display
74
+ * @param showSymbol whether wrap the message in a success symbol
75
+ */
76
+ var success = function (msg, showSymbol) {
77
+ if (showSymbol === void 0) { showSymbol = true; }
78
+ var sym = log_symbols_1.default.success;
79
+ if (showSymbol) {
80
+ msg = sym + " " + msg + " " + sym;
81
+ }
82
+ exports.print('success', msg);
83
+ };
84
+ exports.success = success;
85
+ //# sourceMappingURL=boxen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"boxen.js","sourceRoot":"","sources":["../../../src/logger/lib/boxen.ts"],"names":[],"mappings":";;;;;;AAAA,gDAA0B;AAC1B,4DAAqC;AAErC,oDAA6C;AAE7C,kBAAe,eAAK,CAAC;AAErB;;;;;GAKG;AACI,IAAM,KAAK,GAAG,UAAC,KAAgB,EAAE,GAAW;IACjD,IAAM,KAAK,GAAG,eAAK,CAAC,GAAG,EAAE;QACvB,OAAO,EAAE,CAAC;QACV,MAAM,EAAE,CAAC;KACV,CAAC,CAAC;IAEH,gBAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC,CAAC;AAPW,QAAA,KAAK,SAOhB;AAEF;;;;;GAKG;AACI,IAAM,OAAO,GAAG,UAAC,GAAW,EAAE,UAA0B;IAA1B,2BAAA,EAAA,iBAA0B;IAC7D,IAAM,GAAG,GAAG,qBAAU,CAAC,OAAO,CAAC;IAE/B,IAAI,UAAU,EAAE;QACd,GAAG,GAAM,GAAG,SAAI,GAAG,SAAI,GAAK,CAAC;KAC9B;IAED,aAAK,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;AACxB,CAAC,CAAC;AARW,QAAA,OAAO,WAQlB;AAEF;;;;;GAKG;AACI,IAAM,IAAI,GAAG,UAAC,GAAW,EAAE,UAA0B;IAA1B,2BAAA,EAAA,iBAA0B;IAC1D,IAAM,GAAG,GAAG,qBAAU,CAAC,IAAI,CAAC;IAE5B,IAAI,UAAU,EAAE;QACd,GAAG,GAAM,GAAG,SAAI,GAAG,SAAI,GAAK,CAAC;KAC9B;IAED,aAAK,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AACrB,CAAC,CAAC;AARW,QAAA,IAAI,QAQf;AAEF;;;;;GAKG;AACI,IAAM,KAAK,GAAG,UAAC,GAAW,EAAE,UAA0B;IAA1B,2BAAA,EAAA,iBAA0B;IAC3D,IAAM,GAAG,GAAG,qBAAU,CAAC,KAAK,CAAC;IAE7B,IAAI,UAAU,EAAE;QACd,GAAG,GAAM,GAAG,SAAI,GAAG,SAAI,GAAK,CAAC;KAC9B;IAED,aAAK,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AACtB,CAAC,CAAC;AARW,QAAA,KAAK,SAQhB;AAEF;;;;;GAKG;AACI,IAAM,OAAO,GAAG,UAAC,GAAW,EAAE,UAA0B;IAA1B,2BAAA,EAAA,iBAA0B;IAC7D,IAAM,GAAG,GAAG,qBAAU,CAAC,OAAO,CAAC;IAE/B,IAAI,UAAU,EAAE;QACd,GAAG,GAAM,GAAG,SAAI,GAAG,SAAI,GAAK,CAAC;KAC9B;IAED,aAAK,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;AACxB,CAAC,CAAC;AARW,QAAA,OAAO,WAQlB"}
@@ -0,0 +1,2 @@
1
+ import columnify from 'columnify';
2
+ export default columnify;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ var columnify_1 = __importDefault(require("columnify"));
7
+ exports.default = columnify_1.default;
8
+ //# sourceMappingURL=columnify.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"columnify.js","sourceRoot":"","sources":["../../../src/logger/lib/columnify.ts"],"names":[],"mappings":";;;;;AAAA,wDAAkC;AAElC,kBAAe,mBAAS,CAAC"}
@@ -0,0 +1,157 @@
1
+ import chalk from 'chalk';
2
+ interface ColumnsOptions {
3
+ indent?: boolean;
4
+ }
5
+ export declare type LogLevels = 'debug' | 'info' | 'warning' | 'error' | 'trace' | 'success';
6
+ interface LoggerOptions {
7
+ isQuiet?: boolean;
8
+ isDebug?: boolean;
9
+ isTrace?: boolean;
10
+ markdown?: boolean;
11
+ }
12
+ export declare const coloredStrings: {
13
+ dim: chalk.Chalk;
14
+ bold: chalk.Chalk;
15
+ italic: chalk.Chalk;
16
+ code: chalk.Chalk;
17
+ link: chalk.Chalk;
18
+ info: chalk.Chalk;
19
+ success: chalk.Chalk;
20
+ warning: chalk.Chalk;
21
+ error: chalk.Chalk;
22
+ headline: chalk.Chalk;
23
+ name: chalk.Chalk;
24
+ digit: chalk.Chalk;
25
+ };
26
+ /**
27
+ * The Logger class
28
+ */
29
+ export declare class Logger {
30
+ private static formatter;
31
+ private readonly options;
32
+ constructor(options?: LoggerOptions);
33
+ /**
34
+ * debug level log
35
+ * @param args
36
+ */
37
+ debug: (...args: any[]) => void;
38
+ /**
39
+ * trace level trace
40
+ * @param args
41
+ */
42
+ trace: (...args: any[]) => void;
43
+ /**
44
+ * info level log
45
+ * @param args
46
+ */
47
+ info: (...args: any[]) => void;
48
+ /**
49
+ * success level log
50
+ * @param args
51
+ */
52
+ success: (...args: any[]) => void;
53
+ /**
54
+ * error level log
55
+ * @param args
56
+ */
57
+ error: (...args: any[]) => void;
58
+ /**
59
+ * warning level log
60
+ * @param args
61
+ */
62
+ warning: (...args: any[]) => void;
63
+ /**
64
+ * Notice log is info level with a magenta color
65
+ * @param args
66
+ */
67
+ notice: (...args: any[]) => void;
68
+ /**
69
+ * Simple wrapper for column printing
70
+ * @param lines
71
+ * @param options
72
+ */
73
+ columns: (lines: string[][], options?: ColumnsOptions | undefined) => void;
74
+ /**
75
+ * Appends new line
76
+ * @param lines the number of lines to append
77
+ */
78
+ newline: (lines?: number) => void;
79
+ /**
80
+ * A wrapper for showing bash command information such as `npm install foo`
81
+ * @param command the bash command
82
+ * @param args the remaining arguments
83
+ */
84
+ installInfo: (command: string, ...args: string[]) => void;
85
+ /**
86
+ * Clears the terminal either if forced is provided, or if persist_terminal env is not set
87
+ */
88
+ clearTerminal: (forced?: boolean) => void;
89
+ /**
90
+ * Provides basic markdown support. Currently supported bold **bold** and italic *italic*
91
+ * @param msg
92
+ */
93
+ markdown: (msg?: string | undefined) => string | undefined;
94
+ /**
95
+ * The internal logger method
96
+ * @param args
97
+ * @private
98
+ */
99
+ private _log;
100
+ /**
101
+ * Checks whether the logger is set for debug mode
102
+ */
103
+ private isDebug;
104
+ /**
105
+ * Checks whether the logger is set for trace mode
106
+ */
107
+ private isTrace;
108
+ private isQuiet;
109
+ }
110
+ /**
111
+ * The default logger will use environment variables to determine behavior.
112
+ * You can create an instance to overwrite default behavior.
113
+ */
114
+ export declare const _logger: Logger;
115
+ declare const _default: {
116
+ debug: (...args: any[]) => void;
117
+ info: (...args: any[]) => void;
118
+ warning: (...args: any[]) => void;
119
+ error: (...args: any[]) => void;
120
+ trace: (...args: any[]) => void;
121
+ success: (...args: any[]) => void;
122
+ newline: (lines?: number) => void;
123
+ notice: (...args: any[]) => void;
124
+ installInfo: (command: string, ...args: string[]) => void;
125
+ clearTerminal: (forced?: boolean) => void;
126
+ markdown: (msg?: string | undefined) => string | undefined;
127
+ wrap: (input: string, columns: number, options?: {
128
+ hard: boolean;
129
+ }) => string;
130
+ columns: (lines: string[][], options?: ColumnsOptions | undefined) => void;
131
+ colors: chalk.Chalk & chalk.ChalkFunction & {
132
+ supportsColor: false | chalk.ColorSupport;
133
+ Level: chalk.Level;
134
+ Color: ("red" | "yellow" | "green" | "cyan" | "magenta" | "black" | "blue" | "white" | "gray" | "grey" | "blackBright" | "redBright" | "greenBright" | "yellowBright" | "blueBright" | "magentaBright" | "cyanBright" | "whiteBright") | ("bgBlack" | "bgRed" | "bgGreen" | "bgYellow" | "bgBlue" | "bgMagenta" | "bgCyan" | "bgWhite" | "bgGray" | "bgGrey" | "bgBlackBright" | "bgRedBright" | "bgGreenBright" | "bgYellowBright" | "bgBlueBright" | "bgMagentaBright" | "bgCyanBright" | "bgWhiteBright");
135
+ ForegroundColor: "red" | "yellow" | "green" | "cyan" | "magenta" | "black" | "blue" | "white" | "gray" | "grey" | "blackBright" | "redBright" | "greenBright" | "yellowBright" | "blueBright" | "magentaBright" | "cyanBright" | "whiteBright";
136
+ BackgroundColor: "bgBlack" | "bgRed" | "bgGreen" | "bgYellow" | "bgBlue" | "bgMagenta" | "bgCyan" | "bgWhite" | "bgGray" | "bgGrey" | "bgBlackBright" | "bgRedBright" | "bgGreenBright" | "bgYellowBright" | "bgBlueBright" | "bgMagentaBright" | "bgCyanBright" | "bgWhiteBright";
137
+ Modifiers: "bold" | "reset" | "dim" | "italic" | "underline" | "inverse" | "hidden" | "strikethrough" | "visible";
138
+ stderr: chalk.Chalk & {
139
+ supportsColor: false | chalk.ColorSupport;
140
+ };
141
+ };
142
+ coloredStrings: {
143
+ dim: chalk.Chalk;
144
+ bold: chalk.Chalk;
145
+ italic: chalk.Chalk;
146
+ code: chalk.Chalk;
147
+ link: chalk.Chalk;
148
+ info: chalk.Chalk;
149
+ success: chalk.Chalk;
150
+ warning: chalk.Chalk;
151
+ error: chalk.Chalk;
152
+ headline: chalk.Chalk;
153
+ name: chalk.Chalk;
154
+ digit: chalk.Chalk;
155
+ };
156
+ };
157
+ export default _default;