@sap-ux/environment-check 0.1.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 (61) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +60 -0
  3. package/bin/envcheck +3 -0
  4. package/dist/checks/destination.d.ts +30 -0
  5. package/dist/checks/destination.d.ts.map +1 -0
  6. package/dist/checks/destination.js +264 -0
  7. package/dist/checks/destination.js.map +1 -0
  8. package/dist/checks/environment.d.ts +18 -0
  9. package/dist/checks/environment.d.ts.map +1 -0
  10. package/dist/checks/environment.js +175 -0
  11. package/dist/checks/environment.js.map +1 -0
  12. package/dist/checks/index.d.ts +3 -0
  13. package/dist/checks/index.d.ts.map +1 -0
  14. package/dist/checks/index.js +11 -0
  15. package/dist/checks/index.js.map +1 -0
  16. package/dist/checks/project-utils.d.ts +17 -0
  17. package/dist/checks/project-utils.d.ts.map +1 -0
  18. package/dist/checks/project-utils.js +173 -0
  19. package/dist/checks/project-utils.js.map +1 -0
  20. package/dist/checks/workspace.d.ts +12 -0
  21. package/dist/checks/workspace.d.ts.map +1 -0
  22. package/dist/checks/workspace.js +91 -0
  23. package/dist/checks/workspace.js.map +1 -0
  24. package/dist/cli/index.d.ts +6 -0
  25. package/dist/cli/index.d.ts.map +1 -0
  26. package/dist/cli/index.js +181 -0
  27. package/dist/cli/index.js.map +1 -0
  28. package/dist/formatter.d.ts +16 -0
  29. package/dist/formatter.d.ts.map +1 -0
  30. package/dist/formatter.js +28 -0
  31. package/dist/formatter.js.map +1 -0
  32. package/dist/i18n.d.ts +14 -0
  33. package/dist/i18n.d.ts.map +1 -0
  34. package/dist/i18n.js +50 -0
  35. package/dist/i18n.js.map +1 -0
  36. package/dist/index.d.ts +4 -0
  37. package/dist/index.d.ts.map +1 -0
  38. package/dist/index.js +20 -0
  39. package/dist/index.js.map +1 -0
  40. package/dist/logger.d.ts +29 -0
  41. package/dist/logger.d.ts.map +1 -0
  42. package/dist/logger.js +49 -0
  43. package/dist/logger.js.map +1 -0
  44. package/dist/output/index.d.ts +3 -0
  45. package/dist/output/index.d.ts.map +1 -0
  46. package/dist/output/index.js +15 -0
  47. package/dist/output/index.js.map +1 -0
  48. package/dist/output/markdown.d.ts +9 -0
  49. package/dist/output/markdown.d.ts.map +1 -0
  50. package/dist/output/markdown.js +243 -0
  51. package/dist/output/markdown.js.map +1 -0
  52. package/dist/output/zip.d.ts +19 -0
  53. package/dist/output/zip.d.ts.map +1 -0
  54. package/dist/output/zip.js +137 -0
  55. package/dist/output/zip.js.map +1 -0
  56. package/dist/translations/env-check.i18n.json +70 -0
  57. package/dist/types.d.ts +109 -0
  58. package/dist/types.d.ts.map +1 -0
  59. package/dist/types.js +22 -0
  60. package/dist/types.js.map +1 -0
  61. package/package.json +49 -0
@@ -0,0 +1,181 @@
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 __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.cli = void 0;
16
+ const fs_1 = require("fs");
17
+ const i18n_1 = require("../i18n");
18
+ const minimist_1 = __importDefault(require("minimist"));
19
+ const prompts_1 = __importDefault(require("prompts"));
20
+ const types_1 = require("../types");
21
+ const markdown_1 = require("../output/markdown");
22
+ const environment_1 = require("../checks/environment");
23
+ const output_1 = require("../output");
24
+ /**
25
+ * Output usage information to console.
26
+ */
27
+ function showHelp() {
28
+ console.log(`
29
+ Usage: envcheck [<OPTIONS>] [<WORKSPACE_ROOT_A>] [<WORKSPACE_ROOT_..>]
30
+
31
+ Following <OPTIONS> are available:
32
+ --destination <DESTINATION> destination to perform deep check, multiple destionations can be passed
33
+ --output ${Object.values(types_1.OutputMode).join(' | ')} format for output, if not specified all messages except 'info' are shown
34
+
35
+ <WORKSPACE_ROOT*> path the root folder of a workspace. Multiple roots can be defined.
36
+ We search for apps with destinations in workspaces
37
+
38
+ `);
39
+ }
40
+ /**
41
+ * Convert command line arguments into environment check options.
42
+ *
43
+ * @param cliArgs - parsed command line arguments from minimist
44
+ * @returns - options to check enviroment
45
+ */
46
+ function getOptions(cliArgs) {
47
+ const options = {};
48
+ if (cliArgs._.length > 0) {
49
+ options.workspaceRoots = cliArgs._;
50
+ }
51
+ if (cliArgs.destination) {
52
+ options.destinations = Array.isArray(cliArgs.destination) ? cliArgs.destination : [cliArgs.destination];
53
+ }
54
+ return Object.keys(options).length > 0 ? options : undefined;
55
+ }
56
+ /**
57
+ * Writes to file.
58
+ *
59
+ * @param filename name of file
60
+ * @param content file content
61
+ */
62
+ function writeToFile(filename, content) {
63
+ return __awaiter(this, void 0, void 0, function* () {
64
+ return new Promise((resolve, reject) => {
65
+ fs_1.writeFile(filename, content, (error) => {
66
+ if (error) {
67
+ reject(error);
68
+ }
69
+ resolve();
70
+ });
71
+ });
72
+ });
73
+ }
74
+ /**
75
+ * Output the results according to the selected output method.
76
+ *
77
+ * @param result - the data structure containing the results
78
+ * @param mode output (JSON, markdown, zip)
79
+ */
80
+ function outputResults(result, mode) {
81
+ return __awaiter(this, void 0, void 0, function* () {
82
+ for (const message of result.messages || []) {
83
+ switch (message.severity) {
84
+ case "error" /* Error */: {
85
+ console.error(`🔴 ${message.text}`);
86
+ break;
87
+ }
88
+ case "warn" /* Warning */: {
89
+ console.warn(`🟡 ${message.text}`);
90
+ break;
91
+ }
92
+ case "debug" /* Debug */: {
93
+ if (mode === types_1.OutputMode.Verbose) {
94
+ console.info(`ℹ ${message.text}`);
95
+ }
96
+ break;
97
+ }
98
+ default: {
99
+ console.log(`🟢 ${message.text}`);
100
+ }
101
+ }
102
+ }
103
+ switch (mode) {
104
+ case types_1.OutputMode.Json: {
105
+ const filename = 'envcheck-results.json';
106
+ yield writeToFile(filename, JSON.stringify(result, null, 4));
107
+ console.log(i18n_1.t('info.jsonResults', { filename }));
108
+ break;
109
+ }
110
+ case types_1.OutputMode.Markdown: {
111
+ const markdown = markdown_1.convertResultsToMarkdown(result);
112
+ const filename = 'envcheck-results.md';
113
+ yield writeToFile(filename, markdown);
114
+ console.log(i18n_1.t('info.markdownResults', { filename }));
115
+ break;
116
+ }
117
+ case types_1.OutputMode.Zip: {
118
+ output_1.storeResultsZip(result);
119
+ break;
120
+ }
121
+ default: {
122
+ break;
123
+ }
124
+ }
125
+ });
126
+ }
127
+ /**
128
+ * Callback in case user credentials are required.
129
+ *
130
+ * @param destination - destination info with Name, Host, ...
131
+ * @returns user input for username and password
132
+ */
133
+ function credentialCallback(destination) {
134
+ return __awaiter(this, void 0, void 0, function* () {
135
+ console.log(i18n_1.t('info.authRequired', { destination: destination.Name }));
136
+ const { username, password } = yield prompts_1.default([
137
+ {
138
+ type: 'text',
139
+ name: 'username',
140
+ message: 'Username: '
141
+ },
142
+ {
143
+ type: 'password',
144
+ name: 'password',
145
+ message: 'Password: '
146
+ }
147
+ ]);
148
+ return { username, password };
149
+ });
150
+ }
151
+ /**
152
+ * Main function that checks command line arguments and calls environment check.
153
+ *
154
+ */
155
+ function cli() {
156
+ return __awaiter(this, void 0, void 0, function* () {
157
+ try {
158
+ const cliArgs = minimist_1.default(process.argv.slice(2));
159
+ if (cliArgs.h || cliArgs.help) {
160
+ showHelp();
161
+ return;
162
+ }
163
+ const options = getOptions(cliArgs) || {};
164
+ options.credentialCallback = credentialCallback;
165
+ const result = yield environment_1.checkEnvironment(options);
166
+ const outputMode = Object.keys(types_1.OutputMode).find((key) => types_1.OutputMode[key] === cliArgs.output)
167
+ ? cliArgs.output
168
+ : undefined;
169
+ yield outputResults(result, outputMode);
170
+ }
171
+ catch (error) {
172
+ console.error(i18n_1.t('error.checkingEnv', { error }));
173
+ }
174
+ });
175
+ }
176
+ exports.cli = cli;
177
+ /**
178
+ * Execute directly when this file is loaded.
179
+ */
180
+ cli();
181
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2BAA+B;AAC/B,kCAA4B;AAC5B,wDAAgC;AAChC,sDAA8B;AAE9B,oCAAgD;AAChD,iDAA8D;AAC9D,uDAAyD;AACzD,sCAA4C;AAE5C;;GAEG;AACH,SAAS,QAAQ;IACb,OAAO,CAAC,GAAG,CAAC;;;;;eAKD,MAAM,CAAC,MAAM,CAAC,kBAAU,CAAC,CAAC,IAAI,CACrC,KAAK,CACR;;;;;CAKJ,CAAC,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,SAAS,UAAU,CAAC,OAA4B;IAC5C,MAAM,OAAO,GAA4B,EAAE,CAAC;IAC5C,IAAI,OAAO,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;QACtB,OAAO,CAAC,cAAc,GAAG,OAAO,CAAC,CAAC,CAAC;KACtC;IACD,IAAI,OAAO,CAAC,WAAW,EAAE;QACrB,OAAO,CAAC,YAAY,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;KAC3G;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;AACjE,CAAC;AAED;;;;;GAKG;AACH,SAAe,WAAW,CAAC,QAAgB,EAAE,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AAC,IAAI,OAAO,CAAC,IAAI,EAAE;gBAC3B,QAAQ,EAAE,CAAC;gBACX,OAAO;aACV;YACD,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YAC1C,OAAO,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;YAChD,MAAM,MAAM,GAAG,MAAM,8BAAgB,CAAC,OAAO,CAAC,CAAC;YAC/C,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,kBAAU,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,kBAAU,CAAC,GAAG,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC;gBACxF,CAAC,CAAE,OAAO,CAAC,MAAqB;gBAChC,CAAC,CAAC,SAAS,CAAC;YAChB,MAAM,aAAa,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;SAC3C;QAAC,OAAO,KAAK,EAAE;YACZ,OAAO,CAAC,KAAK,CAAC,QAAC,CAAC,mBAAmB,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;SACpD;IACL,CAAC;CAAA;AAlBD,kBAkBC;AAED;;GAEG;AACH,GAAG,EAAE,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { ODataServiceInfo } from '@sap-ux/axios-extension';
2
+ /**
3
+ * Count the number of services from the result of a catalog call.
4
+ *
5
+ * @param catalogResult - V2 or V4 result of catalog call
6
+ * @returns - number of services
7
+ */
8
+ export declare function countNumberOfServices(catalogResult?: ODataServiceInfo[]): number;
9
+ /**
10
+ * Format string to write number of services, e.g. 1 service or 123 services.
11
+ *
12
+ * @param count - number of service
13
+ * @returns - string with number of services
14
+ */
15
+ export declare function getServiceCountText(count: number): string;
16
+ //# sourceMappingURL=formatter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatter.d.ts","sourceRoot":"","sources":["../src/formatter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,aAAa,CAAC,EAAE,gBAAgB,EAAE,GAAG,MAAM,CAMhF;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,UAEhD"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getServiceCountText = exports.countNumberOfServices = void 0;
4
+ /**
5
+ * Count the number of services from the result of a catalog call.
6
+ *
7
+ * @param catalogResult - V2 or V4 result of catalog call
8
+ * @returns - number of services
9
+ */
10
+ function countNumberOfServices(catalogResult) {
11
+ let numberServices = 0;
12
+ if (Array.isArray(catalogResult)) {
13
+ numberServices = catalogResult.length;
14
+ }
15
+ return numberServices;
16
+ }
17
+ exports.countNumberOfServices = countNumberOfServices;
18
+ /**
19
+ * Format string to write number of services, e.g. 1 service or 123 services.
20
+ *
21
+ * @param count - number of service
22
+ * @returns - string with number of services
23
+ */
24
+ function getServiceCountText(count) {
25
+ return count === 1 ? `${count} service` : `${count} services`;
26
+ }
27
+ exports.getServiceCountText = getServiceCountText;
28
+ //# sourceMappingURL=formatter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatter.js","sourceRoot":"","sources":["../src/formatter.ts"],"names":[],"mappings":";;;AAEA;;;;;GAKG;AACH,SAAgB,qBAAqB,CAAC,aAAkC;IACpE,IAAI,cAAc,GAAG,CAAC,CAAC;IACvB,IAAI,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE;QAC9B,cAAc,GAAG,aAAa,CAAC,MAAM,CAAC;KACzC;IACD,OAAO,cAAc,CAAC;AAC1B,CAAC;AAND,sDAMC;AAED;;;;;GAKG;AACH,SAAgB,mBAAmB,CAAC,KAAa;IAC7C,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,UAAU,CAAC,CAAC,CAAC,GAAG,KAAK,WAAW,CAAC;AAClE,CAAC;AAFD,kDAEC"}
package/dist/i18n.d.ts ADDED
@@ -0,0 +1,14 @@
1
+ import type { TOptions } from 'i18next';
2
+ /**
3
+ * Initialize i18next with the translations for this module.
4
+ */
5
+ export declare function initI18n(): Promise<void>;
6
+ /**
7
+ * Helper function facading the call call to i18next.
8
+ *
9
+ * @param key i18n key
10
+ * @param options additional options
11
+ * @returns {string} localized string stored for the given key
12
+ */
13
+ export declare function t(key: string, options?: TOptions): string;
14
+ //# sourceMappingURL=i18n.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../src/i18n.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAMxC;;GAEG;AACH,wBAAsB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAY9C;AAED;;;;;;GAMG;AACH,wBAAgB,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ,GAAG,MAAM,CAEzD"}
package/dist/i18n.js ADDED
@@ -0,0 +1,50 @@
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 __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.t = exports.initI18n = void 0;
16
+ const i18next_1 = __importDefault(require("i18next"));
17
+ const env_check_i18n_json_1 = __importDefault(require("./translations/env-check.i18n.json"));
18
+ const NS = 'environment-check';
19
+ /**
20
+ * Initialize i18next with the translations for this module.
21
+ */
22
+ function initI18n() {
23
+ return __awaiter(this, void 0, void 0, function* () {
24
+ yield i18next_1.default.init({
25
+ resources: {
26
+ en: {
27
+ [NS]: env_check_i18n_json_1.default
28
+ }
29
+ },
30
+ lng: 'en',
31
+ fallbackLng: 'en',
32
+ defaultNS: NS,
33
+ ns: [NS]
34
+ });
35
+ });
36
+ }
37
+ exports.initI18n = initI18n;
38
+ /**
39
+ * Helper function facading the call call to i18next.
40
+ *
41
+ * @param key i18n key
42
+ * @param options additional options
43
+ * @returns {string} localized string stored for the given key
44
+ */
45
+ function t(key, options) {
46
+ return i18next_1.default.t(key, options);
47
+ }
48
+ exports.t = t;
49
+ initI18n();
50
+ //# sourceMappingURL=i18n.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i18n.js","sourceRoot":"","sources":["../src/i18n.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,sDAA8B;AAC9B,6FAA8D;AAE9D,MAAM,EAAE,GAAG,mBAAmB,CAAC;AAE/B;;GAEG;AACH,SAAsB,QAAQ;;QAC1B,MAAM,iBAAO,CAAC,IAAI,CAAC;YACf,SAAS,EAAE;gBACP,EAAE,EAAE;oBACA,CAAC,EAAE,CAAC,EAAE,6BAAY;iBACrB;aACJ;YACD,GAAG,EAAE,IAAI;YACT,WAAW,EAAE,IAAI;YACjB,SAAS,EAAE,EAAE;YACb,EAAE,EAAE,CAAC,EAAE,CAAC;SACX,CAAC,CAAC;IACP,CAAC;CAAA;AAZD,4BAYC;AAED;;;;;;GAMG;AACH,SAAgB,CAAC,CAAC,GAAW,EAAE,OAAkB;IAC7C,OAAO,iBAAO,CAAC,CAAC,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AACnC,CAAC;AAFD,cAEC;AAED,QAAQ,EAAE,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from './types';
2
+ export * from './checks';
3
+ export { convertResultsToMarkdown, storeResultsZip, archiveProject } from './output';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,wBAAwB,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,20 @@
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.archiveProject = exports.storeResultsZip = exports.convertResultsToMarkdown = void 0;
14
+ __exportStar(require("./types"), exports);
15
+ __exportStar(require("./checks"), exports);
16
+ var output_1 = require("./output");
17
+ Object.defineProperty(exports, "convertResultsToMarkdown", { enumerable: true, get: function () { return output_1.convertResultsToMarkdown; } });
18
+ Object.defineProperty(exports, "storeResultsZip", { enumerable: true, get: function () { return output_1.storeResultsZip; } });
19
+ Object.defineProperty(exports, "archiveProject", { enumerable: true, get: function () { return output_1.archiveProject; } });
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,0CAAwB;AACxB,2CAAyB;AACzB,mCAAqF;AAA5E,kHAAA,wBAAwB,OAAA;AAAE,yGAAA,eAAe,OAAA;AAAE,wGAAA,cAAc,OAAA"}
@@ -0,0 +1,29 @@
1
+ import { ToolsLogger } from '@sap-ux/logger';
2
+ import type { ResultMessage } from './types';
3
+ /**
4
+ * Logger to collect messages while performing checks
5
+ */
6
+ declare class Logger extends ToolsLogger {
7
+ constructor();
8
+ /**
9
+ * Log multiple messages at once.
10
+ *
11
+ * @param newMessages - messages to be logged
12
+ */
13
+ push(...newMessages: ResultMessage[]): void;
14
+ /**
15
+ * Return all logged messages.
16
+ *
17
+ * @returns - messages with severity
18
+ */
19
+ getMessages(): ResultMessage[];
20
+ }
21
+ /**
22
+ * Return a logger to log messages. Once done adding messages, call getMessages()
23
+ * to retrive an array of logged messages.
24
+ *
25
+ * @returns logger to log messages
26
+ */
27
+ export declare function getLogger(): Logger;
28
+ export {};
29
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7D,OAAO,KAAK,EAAE,aAAa,EAAY,MAAM,SAAS,CAAC;AAEvD;;GAEG;AACH,cAAM,MAAO,SAAQ,WAAW;;IAK5B;;;;OAIG;IACH,IAAI,CAAC,GAAG,WAAW,EAAE,aAAa,EAAE,GAAG,IAAI;IAM3C;;;;OAIG;IACH,WAAW,IAAI,aAAa,EAAE;CAWjC;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,IAAI,MAAM,CAElC"}
package/dist/logger.js ADDED
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getLogger = void 0;
4
+ const logger_1 = require("@sap-ux/logger");
5
+ /**
6
+ * Logger to collect messages while performing checks
7
+ */
8
+ class Logger extends logger_1.ToolsLogger {
9
+ constructor() {
10
+ super({ transports: [new logger_1.ArrayTransport()] });
11
+ }
12
+ /**
13
+ * Log multiple messages at once.
14
+ *
15
+ * @param newMessages - messages to be logged
16
+ */
17
+ push(...newMessages) {
18
+ for (const message of newMessages) {
19
+ this[message.severity](message.text);
20
+ }
21
+ }
22
+ /**
23
+ * Return all logged messages.
24
+ *
25
+ * @returns - messages with severity
26
+ */
27
+ getMessages() {
28
+ let messages = [];
29
+ const transport = this.transports().find((t) => t instanceof logger_1.ArrayTransport);
30
+ if (transport instanceof logger_1.ArrayTransport) {
31
+ messages = transport.logs.map((message) => ({
32
+ severity: message.level,
33
+ text: message.message
34
+ }));
35
+ }
36
+ return messages;
37
+ }
38
+ }
39
+ /**
40
+ * Return a logger to log messages. Once done adding messages, call getMessages()
41
+ * to retrive an array of logged messages.
42
+ *
43
+ * @returns logger to log messages
44
+ */
45
+ function getLogger() {
46
+ return new Logger();
47
+ }
48
+ exports.getLogger = getLogger;
49
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":";;;AAAA,2CAA6D;AAI7D;;GAEG;AACH,MAAM,MAAO,SAAQ,oBAAW;IAC5B;QACI,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC,IAAI,uBAAc,EAAE,CAAC,EAAE,CAAC,CAAC;IAClD,CAAC;IAED;;;;OAIG;IACH,IAAI,CAAC,GAAG,WAA4B;QAChC,KAAK,MAAM,OAAO,IAAI,WAAW,EAAE;YAC/B,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;SACxC;IACL,CAAC;IAED;;;;OAIG;IACH,WAAW;QACP,IAAI,QAAQ,GAAoB,EAAE,CAAC;QACnC,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,YAAY,uBAAc,CAAC,CAAC;QAC7E,IAAI,SAAS,YAAY,uBAAc,EAAE;YACrC,QAAQ,GAAG,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAA+B,EAAE,EAAE,CAAC,CAAC;gBAChE,QAAQ,EAAE,OAAO,CAAC,KAAiB;gBACnC,IAAI,EAAE,OAAO,CAAC,OAAO;aACxB,CAAC,CAAC,CAAC;SACP;QACD,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ;AAED;;;;;GAKG;AACH,SAAgB,SAAS;IACrB,OAAO,IAAI,MAAM,EAAE,CAAC;AACxB,CAAC;AAFD,8BAEC"}
@@ -0,0 +1,3 @@
1
+ export * from './markdown';
2
+ export * from './zip';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/output/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC"}
@@ -0,0 +1,15 @@
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./markdown"), exports);
14
+ __exportStar(require("./zip"), exports);
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/output/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA2B;AAC3B,wCAAsB"}
@@ -0,0 +1,9 @@
1
+ import type { EnvironmentCheckResult } from '../types';
2
+ /**
3
+ * Converts the envcheck results to markdown report.
4
+ *
5
+ * @param results - envcheck results
6
+ * @returns - markdown report
7
+ */
8
+ export declare function convertResultsToMarkdown(results: EnvironmentCheckResult): string;
9
+ //# sourceMappingURL=markdown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../src/output/markdown.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAIR,sBAAsB,EAGzB,MAAM,UAAU,CAAC;AAmPlB;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,sBAAsB,GAAG,MAAM,CAchF"}