@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.
- package/LICENSE +201 -0
- package/README.md +60 -0
- package/bin/envcheck +3 -0
- package/dist/checks/destination.d.ts +30 -0
- package/dist/checks/destination.d.ts.map +1 -0
- package/dist/checks/destination.js +264 -0
- package/dist/checks/destination.js.map +1 -0
- package/dist/checks/environment.d.ts +18 -0
- package/dist/checks/environment.d.ts.map +1 -0
- package/dist/checks/environment.js +175 -0
- package/dist/checks/environment.js.map +1 -0
- package/dist/checks/index.d.ts +3 -0
- package/dist/checks/index.d.ts.map +1 -0
- package/dist/checks/index.js +11 -0
- package/dist/checks/index.js.map +1 -0
- package/dist/checks/project-utils.d.ts +17 -0
- package/dist/checks/project-utils.d.ts.map +1 -0
- package/dist/checks/project-utils.js +173 -0
- package/dist/checks/project-utils.js.map +1 -0
- package/dist/checks/workspace.d.ts +12 -0
- package/dist/checks/workspace.d.ts.map +1 -0
- package/dist/checks/workspace.js +91 -0
- package/dist/checks/workspace.js.map +1 -0
- package/dist/cli/index.d.ts +6 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +181 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/formatter.d.ts +16 -0
- package/dist/formatter.d.ts.map +1 -0
- package/dist/formatter.js +28 -0
- package/dist/formatter.js.map +1 -0
- package/dist/i18n.d.ts +14 -0
- package/dist/i18n.d.ts.map +1 -0
- package/dist/i18n.js +50 -0
- package/dist/i18n.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/logger.d.ts +29 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +49 -0
- package/dist/logger.js.map +1 -0
- package/dist/output/index.d.ts +3 -0
- package/dist/output/index.d.ts.map +1 -0
- package/dist/output/index.js +15 -0
- package/dist/output/index.js.map +1 -0
- package/dist/output/markdown.d.ts +9 -0
- package/dist/output/markdown.d.ts.map +1 -0
- package/dist/output/markdown.js +243 -0
- package/dist/output/markdown.js.map +1 -0
- package/dist/output/zip.d.ts +19 -0
- package/dist/output/zip.d.ts.map +1 -0
- package/dist/output/zip.js +137 -0
- package/dist/output/zip.js.map +1 -0
- package/dist/translations/env-check.i18n.json +70 -0
- package/dist/types.d.ts +109 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +22 -0
- package/dist/types.js.map +1 -0
- package/package.json +49 -0
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertResultsToMarkdown = void 0;
|
|
4
|
+
const formatter_1 = require("../formatter");
|
|
5
|
+
const i18n_1 = require("../i18n");
|
|
6
|
+
/**
|
|
7
|
+
* Output mapping from severity -> icon + text
|
|
8
|
+
*/
|
|
9
|
+
const severityMap = {
|
|
10
|
+
["error" /* Error */]: '🔴 Error',
|
|
11
|
+
["warn" /* Warning */]: '🟡 Warning',
|
|
12
|
+
["info" /* Info */]: '🟢 Info',
|
|
13
|
+
["debug" /* Debug */]: 'ℹ Debug'
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Column sequence of the destination table, first colun id, the column title
|
|
17
|
+
*/
|
|
18
|
+
const destinationTableFields = new Map([
|
|
19
|
+
['Name', 'Name'],
|
|
20
|
+
['Description', 'Description'],
|
|
21
|
+
['Host', 'Host'],
|
|
22
|
+
['sap-client', 'sap-client'],
|
|
23
|
+
['UrlServiceType', 'Fiori tools usage'],
|
|
24
|
+
['WebIDEUsage', 'WebIDEUsage'],
|
|
25
|
+
['WebIDEAdditionalData', 'WebIDEAdditionalData'],
|
|
26
|
+
['Type', 'Type'],
|
|
27
|
+
['Authentication', 'Authentication'],
|
|
28
|
+
['ProxyType', 'ProxyType'],
|
|
29
|
+
['HTML5.DynamicDestination', 'HTML5.DynamicDestination']
|
|
30
|
+
]);
|
|
31
|
+
/**
|
|
32
|
+
* Convert enum UrlServiceType to text.
|
|
33
|
+
*
|
|
34
|
+
* @param urlServiceType - classifaction of destination from getUrlServiceTypeForDest
|
|
35
|
+
* @returns - meaningful text
|
|
36
|
+
*/
|
|
37
|
+
const urlServiceTypeToText = (urlServiceType) => {
|
|
38
|
+
let text;
|
|
39
|
+
switch (urlServiceType) {
|
|
40
|
+
case "Full Service URL" /* FullServiceUrl */: {
|
|
41
|
+
text = i18n_1.t('markdownText.fullServiceUrlConfig');
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
case "Partial URL" /* PartialUrl */: {
|
|
45
|
+
text = i18n_1.t('markdownText.partialUrlConfig');
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
case "Catalog Service" /* CatalogServiceUrl */: {
|
|
49
|
+
text = i18n_1.t('markdownText.catalogServiceConfig');
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
default: {
|
|
53
|
+
text = i18n_1.t('markdownText.wrongConfig');
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return text;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Return a markdown writer objbect that allows to add captions, text, tables, etc.
|
|
60
|
+
*
|
|
61
|
+
* @returns markdown writer
|
|
62
|
+
*/
|
|
63
|
+
function getMarkdownWriter() {
|
|
64
|
+
let result = '';
|
|
65
|
+
return {
|
|
66
|
+
addH1: (text) => {
|
|
67
|
+
result += `\n# ${text}\n`;
|
|
68
|
+
},
|
|
69
|
+
addH2: (text) => {
|
|
70
|
+
result += `\n<br>\n\n## ${text}\n`;
|
|
71
|
+
},
|
|
72
|
+
addH3: (text) => {
|
|
73
|
+
result += `\n### ${text}\n`;
|
|
74
|
+
},
|
|
75
|
+
addLine: (line) => {
|
|
76
|
+
result += `${line}<br>\n`;
|
|
77
|
+
},
|
|
78
|
+
addDetails: (description, details) => {
|
|
79
|
+
result += `<details><summary>${description}</summary>\n<pre>\n${details}\n</pre></details>\n`;
|
|
80
|
+
},
|
|
81
|
+
addSub: (text) => {
|
|
82
|
+
result += `<sub>${text}</sub>\n`;
|
|
83
|
+
},
|
|
84
|
+
addTable: (table) => {
|
|
85
|
+
if (table.length > 0) {
|
|
86
|
+
const header = table.shift();
|
|
87
|
+
result += `|${header.join('|')}|\n`;
|
|
88
|
+
result += `|${'--|'.repeat(header.length)}\n`;
|
|
89
|
+
for (const row of table) {
|
|
90
|
+
result += `|${row.join('|')}|\n`;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
toString: () => result
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Write the results for environment check.
|
|
99
|
+
*
|
|
100
|
+
* @param writer - markdown writter
|
|
101
|
+
* @param environment - environment results, like development environment, node version, etc
|
|
102
|
+
*/
|
|
103
|
+
function writeEnvironment(writer, environment) {
|
|
104
|
+
writer.addH2(`Environment`);
|
|
105
|
+
if (environment) {
|
|
106
|
+
writer.addLine(i18n_1.t('markdownText.platform', { platform: environment.platform }));
|
|
107
|
+
writer.addLine(i18n_1.t('markdownText.devEnvironement', { devEnvironment: environment.developmentEnvironment }));
|
|
108
|
+
writer.addLine(i18n_1.t('markdownText.devSpaceType', { basDevSpace: environment.basDevSpace }));
|
|
109
|
+
writer.addDetails(`${i18n_1.t('markdownText.versions')}`, JSON.stringify(environment.versions, null, 4));
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
writer.addLine(i18n_1.t('markdownText.envNotChecked'));
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Write the details of one destination.
|
|
117
|
+
*
|
|
118
|
+
* @param writer - markdown writter
|
|
119
|
+
* @param destName - name of the destination
|
|
120
|
+
* @param destDetails - details, like V2/V4 catalog results
|
|
121
|
+
* @param urlServiceType - (optional) type of service
|
|
122
|
+
*/
|
|
123
|
+
function writeDestinationDetails(writer, destName, destDetails, urlServiceType) {
|
|
124
|
+
writer.addH3(i18n_1.t('markdownText.detailsFor', { destName }));
|
|
125
|
+
if (destDetails.v2 && Array.isArray(destDetails.v2.results)) {
|
|
126
|
+
writer.addLine(`✅ ${i18n_1.t('markdownText.v2CatalogReturned')} ${formatter_1.getServiceCountText(formatter_1.countNumberOfServices(destDetails.v2.results))}`);
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
writer.addLine(`🚫 ${i18n_1.t('markdownText.v2CatalogNotAvailable')}`);
|
|
130
|
+
}
|
|
131
|
+
if (destDetails.v4 && Array.isArray(destDetails.v4.results)) {
|
|
132
|
+
writer.addLine(`✅ ${i18n_1.t('markdownText.v4CatalogReturned')} ${formatter_1.getServiceCountText(formatter_1.countNumberOfServices(destDetails.v4.results))}`);
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
writer.addLine(`🚫 ${i18n_1.t('markdownText.v4CatalogNotAvailable')}`);
|
|
136
|
+
}
|
|
137
|
+
if (destDetails.HTML5DynamicDestination) {
|
|
138
|
+
writer.addLine(`✅ ${i18n_1.t('markdownText.html5DynamicDestTrue')}`);
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
writer.addLine(`🚫 ${i18n_1.t('markdownText.setHtml5DynamicDest')}`);
|
|
142
|
+
}
|
|
143
|
+
if (urlServiceType) {
|
|
144
|
+
writer.addLine(`${urlServiceType === "Invalid URL" /* InvalidUrl */ ? '🚫 ' : '✅ '} ${i18n_1.t('markdownText.sapFioriToolsUsage')}: ${urlServiceTypeToText(urlServiceType)}`);
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
writer.addLine(`🟡 ${i18n_1.t('markdownText.noUrlServiceType')}`);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Write the results for destination checks.
|
|
152
|
+
*
|
|
153
|
+
* @param writer - markdown writter
|
|
154
|
+
* @param destinationResults - results of destination checks that include the catalog services
|
|
155
|
+
* @param destinations - list of all destinations
|
|
156
|
+
*/
|
|
157
|
+
function writeDestinationResults(writer, destinationResults = {}, destinations = []) {
|
|
158
|
+
const numberOfDestDetails = Object.keys(destinationResults).length;
|
|
159
|
+
writer.addH2(`${i18n_1.t('markdownText.destinationDetails')} (${numberOfDestDetails})`);
|
|
160
|
+
if (numberOfDestDetails > 0) {
|
|
161
|
+
for (const destName of Object.keys(destinationResults)) {
|
|
162
|
+
const destination = destinations.find((d) => d.Name === destName);
|
|
163
|
+
writeDestinationDetails(writer, destName, destinationResults[destName], destination === null || destination === void 0 ? void 0 : destination.UrlServiceType);
|
|
164
|
+
const table = [
|
|
165
|
+
Array.from(destinationTableFields.values()),
|
|
166
|
+
Array.from(destinationTableFields.keys()).map((f) => destination === null || destination === void 0 ? void 0 : destination[f])
|
|
167
|
+
];
|
|
168
|
+
writer.addTable(table);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
writer.addLine(i18n_1.t('markdownText.noDestinationDetails'));
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Write the table of destinations.
|
|
177
|
+
*
|
|
178
|
+
* @param writer - markdown writer
|
|
179
|
+
* @param destinations - array of destinations
|
|
180
|
+
*/
|
|
181
|
+
function writeDestinations(writer, destinations = []) {
|
|
182
|
+
const numberOfDestinations = destinations.length || 0;
|
|
183
|
+
writer.addH2(i18n_1.t('markdownText.allDestinations', { numberOfDestinations }));
|
|
184
|
+
if (numberOfDestinations > 0) {
|
|
185
|
+
const table = [...destinations]
|
|
186
|
+
.sort((a, b) => {
|
|
187
|
+
if (a.Name > b.Name) {
|
|
188
|
+
return 1;
|
|
189
|
+
}
|
|
190
|
+
if (a.Name < b.Name) {
|
|
191
|
+
return -1;
|
|
192
|
+
}
|
|
193
|
+
return 0;
|
|
194
|
+
})
|
|
195
|
+
.map((d) => Array.from(destinationTableFields.keys()).map((f) => d[f]));
|
|
196
|
+
table.unshift(Array.from(destinationTableFields.values()));
|
|
197
|
+
writer.addTable(table);
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
writer.addLine(i18n_1.t('markdownText.noDestinations'));
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Write the messages that were collected during check.
|
|
205
|
+
*
|
|
206
|
+
* @param writer - markdown writter
|
|
207
|
+
* @param messages - array of messages
|
|
208
|
+
*/
|
|
209
|
+
function writeMessages(writer, messages = []) {
|
|
210
|
+
const numberOfMessages = messages.length || 0;
|
|
211
|
+
writer.addH2(i18n_1.t('markdownText.messages', { numberOfMessages }));
|
|
212
|
+
if (numberOfMessages > 0) {
|
|
213
|
+
for (const message of messages) {
|
|
214
|
+
if (message.severity === "debug" /* Debug */) {
|
|
215
|
+
writer.addDetails(severityMap[message.severity], message.text);
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
writer.addLine(`${severityMap[message.severity]}: ${message.text}`);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
writer.addLine(i18n_1.t('markdownText.noMessages'));
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Converts the envcheck results to markdown report.
|
|
228
|
+
*
|
|
229
|
+
* @param results - envcheck results
|
|
230
|
+
* @returns - markdown report
|
|
231
|
+
*/
|
|
232
|
+
function convertResultsToMarkdown(results) {
|
|
233
|
+
const writer = getMarkdownWriter();
|
|
234
|
+
writer.addH1(i18n_1.t('markdownText.envCheckTitle'));
|
|
235
|
+
writeEnvironment(writer, results.environment);
|
|
236
|
+
writeDestinationResults(writer, results.destinationResults, results.destinations);
|
|
237
|
+
writeDestinations(writer, results.destinations);
|
|
238
|
+
writeMessages(writer, results.messages);
|
|
239
|
+
writer.addSub(`${i18n_1.t('markdownText.createdAt')} ${new Date().toISOString().replace('T', ' ').substring(0, 19)} (UTC)`);
|
|
240
|
+
return writer.toString();
|
|
241
|
+
}
|
|
242
|
+
exports.convertResultsToMarkdown = convertResultsToMarkdown;
|
|
243
|
+
//# sourceMappingURL=markdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown.js","sourceRoot":"","sources":["../../src/output/markdown.ts"],"names":[],"mappings":";;;AAAA,4CAA0E;AAU1E,kCAA4B;AAC5B;;GAEG;AACH,MAAM,WAAW,GAAG;IAChB,qBAAgB,EAAE,iBAAiB;IACnC,sBAAkB,EAAE,mBAAmB;IACvC,mBAAe,EAAE,gBAAgB;IACjC,qBAAgB,EAAE,SAAS;CAC9B,CAAC;AAEF;;GAEG;AACH,MAAM,sBAAsB,GAAG,IAAI,GAAG,CAAiB;IACnD,CAAC,MAAM,EAAE,MAAM,CAAC;IAChB,CAAC,aAAa,EAAE,aAAa,CAAC;IAC9B,CAAC,MAAM,EAAE,MAAM,CAAC;IAChB,CAAC,YAAY,EAAE,YAAY,CAAC;IAC5B,CAAC,gBAAgB,EAAE,mBAAmB,CAAC;IACvC,CAAC,aAAa,EAAE,aAAa,CAAC;IAC9B,CAAC,sBAAsB,EAAE,sBAAsB,CAAC;IAChD,CAAC,MAAM,EAAE,MAAM,CAAC;IAChB,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IACpC,CAAC,WAAW,EAAE,WAAW,CAAC;IAC1B,CAAC,0BAA0B,EAAE,0BAA0B,CAAC;CAC3D,CAAC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,oBAAoB,GAAG,CAAC,cAA8B,EAAU,EAAE;IACpE,IAAI,IAAY,CAAC;IACjB,QAAQ,cAAc,EAAE;QACpB,4CAAkC,CAAC,CAAC;YAChC,IAAI,GAAG,QAAC,CAAC,mCAAmC,CAAC,CAAC;YAC9C,MAAM;SACT;QACD,mCAA8B,CAAC,CAAC;YAC5B,IAAI,GAAG,QAAC,CAAC,+BAA+B,CAAC,CAAC;YAC1C,MAAM;SACT;QACD,8CAAqC,CAAC,CAAC;YACnC,IAAI,GAAG,QAAC,CAAC,mCAAmC,CAAC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AC,OAAO,CAAC,QAAQ,CAAC,KAAK,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;aACvE;SACJ;KACJ;SAAM;QACH,MAAM,CAAC,OAAO,CAAC,QAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC;KAChD;AACL,CAAC;AAED;;;;;GAKG;AACH,SAAgB,wBAAwB,CAAC,OAA+B;IACpE,MAAM,MAAM,GAAG,iBAAiB,EAAE,CAAC;IAEnC,MAAM,CAAC,KAAK,CAAC,QAAC,CAAC,4BAA4B,CAAC,CAAC,CAAC;IAC9C,gBAAgB,CAAC,MAAM,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IAC9C,uBAAuB,CAAC,MAAM,EAAE,OAAO,CAAC,kBAAkB,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAClF,iBAAiB,CAAC,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAChD,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAExC,MAAM,CAAC,MAAM,CACT,GAAG,QAAC,CAAC,wBAAwB,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CACxG,CAAC;IAEF,OAAO,MAAM,CAAC,QAAQ,EAAE,CAAC;AAC7B,CAAC;AAdD,4DAcC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { EnvironmentCheckResult } from '..';
|
|
2
|
+
/**
|
|
3
|
+
* Store output results to zip archive. This includes the markdown report and the raw JSON.
|
|
4
|
+
*
|
|
5
|
+
* @param results - environment check results
|
|
6
|
+
* @param targetFile - path and filename of target zip archive. Default is 'envcheck-results.zip'.
|
|
7
|
+
*/
|
|
8
|
+
export declare function storeResultsZip(results: EnvironmentCheckResult, targetFile?: string): void;
|
|
9
|
+
/**
|
|
10
|
+
* Archive a project to zip file. Result file is written to parent of the project root folder.
|
|
11
|
+
*
|
|
12
|
+
* @param projectRoot - root of the project, where package.json is located
|
|
13
|
+
* @param targetFileName - optional file name, defaults to project folder + timestamp + .zip
|
|
14
|
+
*/
|
|
15
|
+
export declare function archiveProject(projectRoot: string, targetFileName?: string): Promise<{
|
|
16
|
+
path: string;
|
|
17
|
+
size: string;
|
|
18
|
+
}>;
|
|
19
|
+
//# sourceMappingURL=zip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zip.d.ts","sourceRoot":"","sources":["../../src/output/zip.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,IAAI,CAAC;AAmBjD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,sBAAsB,EAAE,UAAU,SAAyB,GAAG,IAAI,CA0B1G;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CAChC,WAAW,EAAE,MAAM,EACnB,cAAc,CAAC,EAAE,MAAM,GACxB,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CA2CzC"}
|
|
@@ -0,0 +1,137 @@
|
|
|
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
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
22
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
23
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
24
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
25
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
26
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
27
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
+
exports.archiveProject = exports.storeResultsZip = void 0;
|
|
32
|
+
const fs_1 = require("fs");
|
|
33
|
+
const path_1 = require("path");
|
|
34
|
+
const archiver = __importStar(require("archiver"));
|
|
35
|
+
const _1 = require(".");
|
|
36
|
+
const i18n_1 = require("../i18n");
|
|
37
|
+
/**
|
|
38
|
+
* Convert a int byte number to a nice output format like 1.23 KB.
|
|
39
|
+
*
|
|
40
|
+
* @param byteNumber - int number of bytes
|
|
41
|
+
* @returns output string
|
|
42
|
+
*/
|
|
43
|
+
function byteNumberToSizeString(byteNumber) {
|
|
44
|
+
if (byteNumber === 0) {
|
|
45
|
+
return '0 Bytes';
|
|
46
|
+
}
|
|
47
|
+
const units = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
|
48
|
+
const i = Math.floor(Math.log(byteNumber) / Math.log(1024));
|
|
49
|
+
return `${parseFloat((byteNumber / Math.pow(1024, i)).toFixed(2))} ${units[i]}`;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Store output results to zip archive. This includes the markdown report and the raw JSON.
|
|
53
|
+
*
|
|
54
|
+
* @param results - environment check results
|
|
55
|
+
* @param targetFile - path and filename of target zip archive. Default is 'envcheck-results.zip'.
|
|
56
|
+
*/
|
|
57
|
+
function storeResultsZip(results, targetFile = 'envcheck-results.zip') {
|
|
58
|
+
const zip = archiver.default('zip', { zlib: { level: 9 } });
|
|
59
|
+
const writeStream = fs_1.createWriteStream(targetFile);
|
|
60
|
+
writeStream.on('close', () => {
|
|
61
|
+
console.log(`Results written to file '${targetFile}' ${byteNumberToSizeString(zip.pointer())}`);
|
|
62
|
+
});
|
|
63
|
+
zip.on('warning', (error) => {
|
|
64
|
+
if (error.code === 'ENOENT') {
|
|
65
|
+
console.warn(error);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
throw error;
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
zip.on('error', (error) => {
|
|
72
|
+
throw error;
|
|
73
|
+
});
|
|
74
|
+
zip.pipe(writeStream);
|
|
75
|
+
// After all this prep, add the files
|
|
76
|
+
const markdown = Buffer.from(_1.convertResultsToMarkdown(results));
|
|
77
|
+
zip.append(markdown, { name: 'envcheck-results.md' });
|
|
78
|
+
const jsonString = Buffer.from(JSON.stringify(results, null, 4));
|
|
79
|
+
zip.append(jsonString, { name: 'envcheck-results.json' });
|
|
80
|
+
zip.finalize();
|
|
81
|
+
}
|
|
82
|
+
exports.storeResultsZip = storeResultsZip;
|
|
83
|
+
/**
|
|
84
|
+
* Archive a project to zip file. Result file is written to parent of the project root folder.
|
|
85
|
+
*
|
|
86
|
+
* @param projectRoot - root of the project, where package.json is located
|
|
87
|
+
* @param targetFileName - optional file name, defaults to project folder + timestamp + .zip
|
|
88
|
+
*/
|
|
89
|
+
function archiveProject(projectRoot, targetFileName) {
|
|
90
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
91
|
+
return new Promise((resolve, reject) => {
|
|
92
|
+
if (fs_1.existsSync(projectRoot)) {
|
|
93
|
+
try {
|
|
94
|
+
const zip = archiver.default('zip', { zlib: { level: 9 } });
|
|
95
|
+
let targetName = '';
|
|
96
|
+
if (typeof targetFileName === 'string') {
|
|
97
|
+
targetName = targetFileName.toLocaleLowerCase().endsWith('.zip')
|
|
98
|
+
? targetFileName
|
|
99
|
+
: targetFileName + '.zip';
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
targetName = `${path_1.basename(projectRoot)}-${new Date()
|
|
103
|
+
.toISOString()
|
|
104
|
+
.replace('T', '')
|
|
105
|
+
.replace(':', '')
|
|
106
|
+
.substring(0, 14)}.zip`;
|
|
107
|
+
}
|
|
108
|
+
const targetPath = path_1.join(path_1.dirname(projectRoot), targetName);
|
|
109
|
+
const writeStream = fs_1.createWriteStream(targetPath);
|
|
110
|
+
// To define which files to include/exclude archiver uses node-readdir-glob. If we use
|
|
111
|
+
// ignore: ['**/node_modules/**', '**/.env'] here it takes time, as ignore still enters directories.
|
|
112
|
+
// Using skip instead, which is way faster because directories are skipped completely in this
|
|
113
|
+
// case (https://github.com/yqnn/node-readdir-glob#options). Unfortunately, @types/glob -> IOptions
|
|
114
|
+
// hasn't skip defined. It works as it is supported by node-readdir-glob. Define it here as 'unknown'
|
|
115
|
+
const globOptions = {
|
|
116
|
+
cwd: projectRoot,
|
|
117
|
+
ignore: ['**/.env', '**/node_modules'],
|
|
118
|
+
skip: ['**/node_modules/**']
|
|
119
|
+
};
|
|
120
|
+
zip.glob('**', globOptions, {})
|
|
121
|
+
.on('error', (error) => reject(error))
|
|
122
|
+
.pipe(writeStream);
|
|
123
|
+
writeStream.on('close', () => resolve({ path: targetPath, size: byteNumberToSizeString(zip.pointer()) }));
|
|
124
|
+
zip.finalize();
|
|
125
|
+
}
|
|
126
|
+
catch (error) {
|
|
127
|
+
reject(error);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
reject(new Error(i18n_1.t('error.noProjectRoot', { projectRoot })));
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
exports.archiveProject = archiveProject;
|
|
137
|
+
//# sourceMappingURL=zip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zip.js","sourceRoot":"","sources":["../../src/output/zip.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2BAAmD;AACnD,+BAA+C;AAC/C,mDAAqC;AAErC,wBAA6C;AAC7C,kCAA4B;AAE5B;;;;;GAKG;AACH,SAAS,sBAAsB,CAAC,UAAkB;IAC9C,IAAI,UAAU,KAAK,CAAC,EAAE;QAClB,OAAO,SAAS,CAAC;KACpB;IACD,MAAM,KAAK,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACxE,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IAC5D,OAAO,GAAG,UAAU,CAAC,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;AACpF,CAAC;AAED;;;;;GAKG;AACH,SAAgB,eAAe,CAAC,OAA+B,EAAE,UAAU,GAAG,sBAAsB;IAChG,MAAM,GAAG,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IAC5D,MAAM,WAAW,GAAG,sBAAiB,CAAC,UA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AO,EAAE,GAAG,EAAE,CACzB,OAAO,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,sBAAsB,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAC7E,CAAC;oBACF,GAAG,CAAC,QAAQ,EAAE,CAAC;iBAClB;gBAAC,OAAO,KAAK,EAAE;oBACZ,MAAM,CAAC,KAAK,CAAC,CAAC;iBACjB;aACJ;iBAAM;gBACH,MAAM,CAAC,IAAI,KAAK,CAAC,QAAC,CAAC,qBAAqB,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC;aAChE;QACL,CAAC,CAAC,CAAC;IACP,CAAC;CAAA;AA9CD,wCA8CC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"info": {
|
|
3
|
+
"checkingDestination": "Checking destination {{- destination}}",
|
|
4
|
+
"numServicesForDestination": "v{{odataVersion}} catalog request for destination {{- destination}} returned {{numberOfServices}}",
|
|
5
|
+
"urlRequestFailure": "Request to URL: {{url}} failed with message: {{- error}}. Complete error object: {{- errorObj}}",
|
|
6
|
+
"numDestinationsFound": "Found {{destinationNumber}} destinations",
|
|
7
|
+
"appSearch": "Looking for apps in {{folders}}",
|
|
8
|
+
"developmentEnvironment": "Development environment: {{env}}",
|
|
9
|
+
"versions": "Versions: {{- versions}}",
|
|
10
|
+
"platform": "Platform: {{platform}}",
|
|
11
|
+
"basDevSpace": "Business Application Studio Dev space: {{basDevSpace}}",
|
|
12
|
+
"detailsForDestinations": "Getting details for destinations: {{destinations}}",
|
|
13
|
+
"noDetailsRequested": "No destinations details requested",
|
|
14
|
+
"foundNumApps": "Found {{numApps}} apps",
|
|
15
|
+
"foundDestinationsInApp": "Found destinations in app {{- appRoot}} : {{- appDestinations}}",
|
|
16
|
+
"noDestinationsFoundInApp": "No destinations found in app {{- appRoot}}",
|
|
17
|
+
"noDestinationDefinedForApp": "No destination defined for app {{- appRoot}} : {{- error}}",
|
|
18
|
+
"jsonResults": "Full results written as JSON to file {{filename}}",
|
|
19
|
+
"markdownResults": "Full results written as markdown to file {{filename}}",
|
|
20
|
+
"authRequired": "Authentication required for {{- destination}}"
|
|
21
|
+
},
|
|
22
|
+
"warning": {
|
|
23
|
+
"reloadFailure": "Call to '/reload' service failed",
|
|
24
|
+
"noDestinationsFound": "No destinations found",
|
|
25
|
+
"basicAuthRequired": "Destination {{- destination}} requires username/password, no callback for user input provided",
|
|
26
|
+
"destinationsNotFound": "Couldn't find destination {{deepDiveDestination}} in list of {{destNumber}} destinations(s)"
|
|
27
|
+
},
|
|
28
|
+
"error": {
|
|
29
|
+
"missingDynamicDestProperty": "Additional property 'HTML5.DynamicDestination = true' missing for destination {{- destination}}",
|
|
30
|
+
"projectRootWorkspace": "Error while trying to find project in workspace root {{- root}}. Error was: {{- error}}",
|
|
31
|
+
"401": "Unauthorized to access v{{odataVersion}} catalog service for destination {{- destination}}",
|
|
32
|
+
"403": "v{{odataVersion}} catalog service for destination {{- destination}} not available",
|
|
33
|
+
"queryFailure": "Could not query v{{odataVersion}} catalog service for destination {{- destination}}",
|
|
34
|
+
"urlRequestFailure": " Request to URL: {{url}} failed with message: {{- error}}. Complete error object: {{- errorObj}}",
|
|
35
|
+
"retrievingDestinations": "Error while retrieving destinations. Error was: {{- error}}",
|
|
36
|
+
"ui5YamlMissing": "App {{- appRoot}} has no ui5.yaml. Not able to get destinations",
|
|
37
|
+
"basDevSpace": "Couldn't read Business Application Studio Dev environment. Error: {{- error}}",
|
|
38
|
+
"invalidPkgJson": "Found invalid package.json. Error : {{- error}}",
|
|
39
|
+
"checkingEnv": "Error checking environment: {{- error}}",
|
|
40
|
+
"noProjectRoot": "Project root {{- projectRoot}} does not exist"
|
|
41
|
+
},
|
|
42
|
+
"markdownText": {
|
|
43
|
+
"fullServiceUrlConfig": "Configured to be used by Fiori Generator as Full Service URL",
|
|
44
|
+
"partialUrlConfig": "Configured to be used by Fiori Generator as Partial URL",
|
|
45
|
+
"catalogServiceConfig": "Configured to be used by Fiori Generator as Catalog Service",
|
|
46
|
+
"wrongConfig": "Wrong configuration, Fiori Generator cannot use this destination. Please check properties",
|
|
47
|
+
"platform": "Platform: `{{platform}}`",
|
|
48
|
+
"devEnvironement": "Development environment: `{{devEnvironment}}`",
|
|
49
|
+
"devSpaceType": "Dev Space Type: `{{basDevSpace}}`",
|
|
50
|
+
"versions": "Versions",
|
|
51
|
+
"envNotChecked": "Environment not checked",
|
|
52
|
+
"detailsFor": "Details for `{{destName}}`",
|
|
53
|
+
"v2CatalogReturned": "V2 catalog call returned",
|
|
54
|
+
"v2CatalogNotAvailable": "V2 catalog service not available",
|
|
55
|
+
"v4CatalogReturned": "V4 catalog call returned",
|
|
56
|
+
"v4CatalogNotAvailable": "V4 catalog service not available",
|
|
57
|
+
"html5DynamicDestTrue": "Destination property `HTML5.DynamicDestination` set to `true`",
|
|
58
|
+
"setHtml5DynamicDest": "Please ensure property `HTML5.DynamicDestination` is set to `true` in SAP BTP Cockpit -> 'Additional Properties'",
|
|
59
|
+
"sapFioriToolsUsage": "SAP Fiori tools usage",
|
|
60
|
+
"noUrlServiceType": "No URL service type was determined",
|
|
61
|
+
"destinationDetails": "Destination Details",
|
|
62
|
+
"noDestinationDetails": "No destination details",
|
|
63
|
+
"allDestinations": "All Destinations ({{numberOfDestinations}})",
|
|
64
|
+
"noDestinations": "No destinations",
|
|
65
|
+
"messages": "Messages ({{numberOfMessages}})",
|
|
66
|
+
"noMessages": "No messages",
|
|
67
|
+
"envCheckTitle": "SAP Fiori tools - Environment Check in SAP Business Application Studio",
|
|
68
|
+
"createdAt": "created at"
|
|
69
|
+
}
|
|
70
|
+
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type { Destination as BTPDestination } from '@sap-ux/btp-utils';
|
|
3
|
+
import type { ODataServiceInfo } from '@sap-ux/axios-extension';
|
|
4
|
+
export interface CheckEnvironmentOptions {
|
|
5
|
+
workspaceRoots?: string[];
|
|
6
|
+
destinations?: string[];
|
|
7
|
+
credentialCallback?: (destination: Destination) => Promise<{
|
|
8
|
+
username: string;
|
|
9
|
+
password: string;
|
|
10
|
+
}>;
|
|
11
|
+
}
|
|
12
|
+
export declare enum OutputMode {
|
|
13
|
+
Json = "json",
|
|
14
|
+
Markdown = "markdown",
|
|
15
|
+
Verbose = "verbose",
|
|
16
|
+
Zip = "zip",
|
|
17
|
+
UserDownload = "userDownload"
|
|
18
|
+
}
|
|
19
|
+
export interface Environment {
|
|
20
|
+
developmentEnvironment: DevelopmentEnvironment;
|
|
21
|
+
platform: NodeJS.Platform;
|
|
22
|
+
versions: NodeJS.ProcessVersions;
|
|
23
|
+
basDevSpace?: string;
|
|
24
|
+
}
|
|
25
|
+
export declare const enum DevelopmentEnvironment {
|
|
26
|
+
BAS = "Business Application Studio",
|
|
27
|
+
VSCode = "Visual Studio Code"
|
|
28
|
+
}
|
|
29
|
+
export declare const enum Severity {
|
|
30
|
+
Debug = "debug",
|
|
31
|
+
Info = "info",
|
|
32
|
+
Warning = "warn",
|
|
33
|
+
Error = "error"
|
|
34
|
+
}
|
|
35
|
+
export declare type ResultMessageText = string;
|
|
36
|
+
export interface ResultMessage {
|
|
37
|
+
severity: Severity;
|
|
38
|
+
text: ResultMessageText;
|
|
39
|
+
}
|
|
40
|
+
export declare const enum UrlServiceType {
|
|
41
|
+
FullServiceUrl = "Full Service URL",
|
|
42
|
+
CatalogServiceUrl = "Catalog Service",
|
|
43
|
+
PartialUrl = "Partial URL",
|
|
44
|
+
InvalidUrl = "Invalid URL"
|
|
45
|
+
}
|
|
46
|
+
interface CatalogResult {
|
|
47
|
+
results?: ODataServiceInfo[];
|
|
48
|
+
status?: number;
|
|
49
|
+
}
|
|
50
|
+
export interface DestinationResults {
|
|
51
|
+
v2: CatalogResult;
|
|
52
|
+
v4: CatalogResult;
|
|
53
|
+
HTML5DynamicDestination?: boolean;
|
|
54
|
+
}
|
|
55
|
+
export interface Destination extends BTPDestination {
|
|
56
|
+
UrlServiceType?: UrlServiceType;
|
|
57
|
+
}
|
|
58
|
+
export interface EnvironmentCheckResult {
|
|
59
|
+
environment?: Environment;
|
|
60
|
+
destinations?: Destination[];
|
|
61
|
+
destinationResults?: {
|
|
62
|
+
[dest: string]: DestinationResults;
|
|
63
|
+
};
|
|
64
|
+
messages?: ResultMessage[];
|
|
65
|
+
}
|
|
66
|
+
export interface MarkdownWriter {
|
|
67
|
+
addH1: (text: string) => void;
|
|
68
|
+
addH2: (text: string) => void;
|
|
69
|
+
addH3: (text: string) => void;
|
|
70
|
+
addLine: (line: string) => void;
|
|
71
|
+
addDetails: (description: string, details: string) => void;
|
|
72
|
+
addSub: (text: string) => void;
|
|
73
|
+
addTable: (table: Array<Array<string>>) => void;
|
|
74
|
+
toString: () => string;
|
|
75
|
+
}
|
|
76
|
+
export declare enum FileName {
|
|
77
|
+
Package = "package.json",
|
|
78
|
+
Ui5Yaml = "ui5.yaml"
|
|
79
|
+
}
|
|
80
|
+
export interface Package {
|
|
81
|
+
name: string;
|
|
82
|
+
sapux: boolean | string[];
|
|
83
|
+
sapuxLayer?: UI5FlexLayer;
|
|
84
|
+
main?: string;
|
|
85
|
+
cds?: object;
|
|
86
|
+
dependencies?: {
|
|
87
|
+
[dependencyName: string]: string;
|
|
88
|
+
};
|
|
89
|
+
devDependencies?: {
|
|
90
|
+
[dependencyName: string]: string;
|
|
91
|
+
};
|
|
92
|
+
optionalDependencies?: object;
|
|
93
|
+
scripts?: {
|
|
94
|
+
[scriptName: string]: string;
|
|
95
|
+
};
|
|
96
|
+
ui5?: object;
|
|
97
|
+
remarkConfig?: object;
|
|
98
|
+
version?: string;
|
|
99
|
+
}
|
|
100
|
+
export declare const enum UI5FlexLayer {
|
|
101
|
+
VENDOR = "VENDOR",
|
|
102
|
+
CUSTOMER_BASE = "CUSTOMER_BASE"
|
|
103
|
+
}
|
|
104
|
+
export declare enum DirName {
|
|
105
|
+
Sapux = "src",
|
|
106
|
+
Webapp = "webapp"
|
|
107
|
+
}
|
|
108
|
+
export {};
|
|
109
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,WAAW,IAAI,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,MAAM,WAAW,uBAAuB;IACpC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,kBAAkB,CAAC,EAAE,CAAC,WAAW,EAAE,WAAW,KAAK,OAAO,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACtG;AAED,oBAAY,UAAU;IAClB,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,OAAO,YAAY;IACnB,GAAG,QAAQ;IACX,YAAY,iBAAiB;CAChC;AAED,MAAM,WAAW,WAAW;IACxB,sBAAsB,EAAE,sBAAsB,CAAC;IAC/C,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC,eAAe,CAAC;IACjC,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,0BAAkB,sBAAsB;IACpC,GAAG,gCAAgC;IACnC,MAAM,uBAAuB;CAChC;AAED,0BAAkB,QAAQ;IACtB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,OAAO,SAAS;IAChB,KAAK,UAAU;CAClB;AACD,oBAAY,iBAAiB,GAAG,MAAM,CAAC;AAEvC,MAAM,WAAW,aAAa;IAC1B,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,iBAAiB,CAAC;CAC3B;AAED,0BAAkB,cAAc;IAC5B,cAAc,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BAAiB;IACxB,OAAO,aAAa;CACvB;AAED,MAAM,WAAW,OAAO;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CAAC;IAC1B,UAAU,CAAC,EAAE,YAAY,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE;QAAE,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IACpD,eAAe,CAAC,EAAE;QAAE,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IACvD,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,OAAO,CAAC,EAAE;QAAE,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAC3C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,0BAAkB,YAAY;IAC1B,MAAM,WAAW;IACjB,aAAa,kBAAkB;CAClC;AAED,oBAAY,OAAO;IACf,KAAK,QAAQ;IACb,MAAM,WAAW;CACpB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DirName = exports.FileName = exports.OutputMode = void 0;
|
|
4
|
+
var OutputMode;
|
|
5
|
+
(function (OutputMode) {
|
|
6
|
+
OutputMode["Json"] = "json";
|
|
7
|
+
OutputMode["Markdown"] = "markdown";
|
|
8
|
+
OutputMode["Verbose"] = "verbose";
|
|
9
|
+
OutputMode["Zip"] = "zip";
|
|
10
|
+
OutputMode["UserDownload"] = "userDownload";
|
|
11
|
+
})(OutputMode = exports.OutputMode || (exports.OutputMode = {}));
|
|
12
|
+
var FileName;
|
|
13
|
+
(function (FileName) {
|
|
14
|
+
FileName["Package"] = "package.json";
|
|
15
|
+
FileName["Ui5Yaml"] = "ui5.yaml";
|
|
16
|
+
})(FileName = exports.FileName || (exports.FileName = {}));
|
|
17
|
+
var DirName;
|
|
18
|
+
(function (DirName) {
|
|
19
|
+
DirName["Sapux"] = "src";
|
|
20
|
+
DirName["Webapp"] = "webapp";
|
|
21
|
+
})(DirName = exports.DirName || (exports.DirName = {}));
|
|
22
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AASA,IAAY,UAMX;AAND,WAAY,UAAU;IAClB,2BAAa,CAAA;IACb,mCAAqB,CAAA;IACrB,iCAAmB,CAAA;IACnB,yBAAW,CAAA;IACX,2CAA6B,CAAA;AACjC,CAAC,EANW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAMrB;AAmED,IAAY,QAGX;AAHD,WAAY,QAAQ;IAChB,oCAAwB,CAAA;IACxB,gCAAoB,CAAA;AACxB,CAAC,EAHW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAGnB;AAsBD,IAAY,OAGX;AAHD,WAAY,OAAO;IACf,wBAAa,CAAA;IACb,4BAAiB,CAAA;AACrB,CAAC,EAHW,OAAO,GAAP,eAAO,KAAP,eAAO,QAGlB"}
|