@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,175 @@
|
|
|
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.checkEnvironment = exports.getEnvironment = void 0;
|
|
16
|
+
const axios_1 = __importDefault(require("axios"));
|
|
17
|
+
const btp_utils_1 = require("@sap-ux/btp-utils");
|
|
18
|
+
const destination_1 = require("./destination");
|
|
19
|
+
const workspace_1 = require("./workspace");
|
|
20
|
+
const logger_1 = require("../logger");
|
|
21
|
+
const bas_sdk_1 = require("@sap/bas-sdk");
|
|
22
|
+
const i18n_1 = require("../i18n");
|
|
23
|
+
/**
|
|
24
|
+
* Return the environment.
|
|
25
|
+
*
|
|
26
|
+
* @returns environment, including ide, versions, ...
|
|
27
|
+
*/
|
|
28
|
+
function getEnvironment() {
|
|
29
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
const logger = logger_1.getLogger();
|
|
31
|
+
const environment = {
|
|
32
|
+
developmentEnvironment: btp_utils_1.isAppStudio() ? "Business Application Studio" /* BAS */ : "Visual Studio Code" /* VSCode */,
|
|
33
|
+
versions: process.versions,
|
|
34
|
+
platform: process.platform
|
|
35
|
+
};
|
|
36
|
+
logger.info(i18n_1.t('info.developmentEnvironment', { env: environment.developmentEnvironment }));
|
|
37
|
+
logger.info(i18n_1.t('info.versions', { versions: JSON.stringify(environment.versions, null, 4) }));
|
|
38
|
+
logger.info(i18n_1.t('info.platform', { plaform: environment.platform }));
|
|
39
|
+
try {
|
|
40
|
+
environment.basDevSpace = btp_utils_1.isAppStudio() ? yield getSbasDevspace() : undefined;
|
|
41
|
+
logger.info(i18n_1.t('info.basDevSpace', { basDevSpace: environment.basDevSpace }));
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
logger.info(i18n_1.t('error.basDevSpace', { error: error.message }));
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
environment,
|
|
48
|
+
messages: logger.getMessages()
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
exports.getEnvironment = getEnvironment;
|
|
53
|
+
/**
|
|
54
|
+
* Internal function to check a destination.
|
|
55
|
+
*
|
|
56
|
+
* @param destination - the destination to get detailed results for
|
|
57
|
+
* @param credentialCallback - callback in case user credentials are required to query a destination
|
|
58
|
+
* @returns - messages and detailed destination check results
|
|
59
|
+
*/
|
|
60
|
+
function getDestinationResults(destination, credentialCallback) {
|
|
61
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
const logger = logger_1.getLogger();
|
|
63
|
+
let username;
|
|
64
|
+
let password;
|
|
65
|
+
if (destination_1.needsUsernamePassword(destination)) {
|
|
66
|
+
if (typeof credentialCallback === 'function') {
|
|
67
|
+
const credentials = yield credentialCallback(destination);
|
|
68
|
+
if (credentials && credentials.username && credentials.password) {
|
|
69
|
+
username = credentials.username;
|
|
70
|
+
password = credentials.password;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
logger.warn(i18n_1.t('warning.basicAuthRequired', {
|
|
75
|
+
destination: destination.Name
|
|
76
|
+
}));
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
const destDetails = yield destination_1.checkBASDestination(destination, username, password);
|
|
80
|
+
logger.push(...destDetails.messages);
|
|
81
|
+
return {
|
|
82
|
+
messages: logger.getMessages(),
|
|
83
|
+
destResults: destDetails.destinationResults
|
|
84
|
+
};
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Internal function to check a set of destinations (deep dive into them).
|
|
89
|
+
*
|
|
90
|
+
* @param deepDiveDestinations - destinations selected for a closer look
|
|
91
|
+
* @param destinations - array of all destinations that contains url and destination type information
|
|
92
|
+
* @param credentialCallback - callback in case user credentials are required to query a destination
|
|
93
|
+
* @returns - messages and the map of detailed destination check results
|
|
94
|
+
*/
|
|
95
|
+
function getDestinationsResults(deepDiveDestinations, destinations, credentialCallback) {
|
|
96
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
97
|
+
const logger = logger_1.getLogger();
|
|
98
|
+
const destinationResults = {};
|
|
99
|
+
logger.info(deepDiveDestinations.size > 0
|
|
100
|
+
? i18n_1.t('info.detailsForDestinations', { destinations: Array.from(deepDiveDestinations).join(', ') })
|
|
101
|
+
: i18n_1.t('info.noDetailsRequested'));
|
|
102
|
+
for (const deepDiveDestination of Array.from(deepDiveDestinations)) {
|
|
103
|
+
const checkDest = destinations.find((d) => d.Name === deepDiveDestination);
|
|
104
|
+
if (checkDest) {
|
|
105
|
+
const { messages: destMessages, destResults } = yield getDestinationResults(checkDest, credentialCallback);
|
|
106
|
+
logger.push(...destMessages);
|
|
107
|
+
destinationResults[checkDest.Name] = destResults;
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
logger.warn(i18n_1.t('warning.destinationsNotFound', { deepDiveDestination, destNumber: destinations.length }));
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return {
|
|
114
|
+
messages: logger.getMessages(),
|
|
115
|
+
destinationResults
|
|
116
|
+
};
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Check environment includes process.env, list of destinations, details about destinations.
|
|
121
|
+
*
|
|
122
|
+
* @param options - see type CheckEnvironmentOptions, includes destination for deep dive, workspace roots, ...
|
|
123
|
+
* @returns the result, currently as JSON
|
|
124
|
+
*/
|
|
125
|
+
function checkEnvironment(options) {
|
|
126
|
+
var _a;
|
|
127
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
128
|
+
const logger = logger_1.getLogger();
|
|
129
|
+
const { environment, messages } = yield getEnvironment();
|
|
130
|
+
logger.push(...messages);
|
|
131
|
+
const deepDiveDestinations = (options === null || options === void 0 ? void 0 : options.destinations) ? new Set(options.destinations) : new Set();
|
|
132
|
+
if (((_a = options === null || options === void 0 ? void 0 : options.workspaceRoots) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
133
|
+
const workspaceResults = yield workspace_1.getDestinationsFromWorkspace(options === null || options === void 0 ? void 0 : options.workspaceRoots);
|
|
134
|
+
logger.push(...workspaceResults.messages);
|
|
135
|
+
workspaceResults.destinations.forEach((dest) => deepDiveDestinations.add(dest));
|
|
136
|
+
}
|
|
137
|
+
const { messages: destMessages, destinations } = yield destination_1.checkBASDestinations();
|
|
138
|
+
logger.push(...destMessages);
|
|
139
|
+
const { messages: destDetailsMessages, destinationResults } = yield getDestinationsResults(deepDiveDestinations, destinations, options === null || options === void 0 ? void 0 : options.credentialCallback);
|
|
140
|
+
logger.push(...destDetailsMessages);
|
|
141
|
+
return {
|
|
142
|
+
environment,
|
|
143
|
+
destinations,
|
|
144
|
+
destinationResults,
|
|
145
|
+
messages: logger.getMessages()
|
|
146
|
+
};
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
exports.checkEnvironment = checkEnvironment;
|
|
150
|
+
/**
|
|
151
|
+
* Obtain dev space type from SBAS rest api.
|
|
152
|
+
*
|
|
153
|
+
* @returns SBAS Dev Space Name. Empty string is returned if unable to fetch workspace type or the environment is not SBAS
|
|
154
|
+
*/
|
|
155
|
+
function getSbasDevspace() {
|
|
156
|
+
var _a, _b;
|
|
157
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
158
|
+
if (btp_utils_1.isAppStudio()) {
|
|
159
|
+
const h20Url = bas_sdk_1.core.getEnvValue('H2O_URL');
|
|
160
|
+
let workspaceId = '';
|
|
161
|
+
if (process.env.WORKSPACE_ID) {
|
|
162
|
+
workspaceId = process.env.WORKSPACE_ID.replace('workspaces-', '');
|
|
163
|
+
}
|
|
164
|
+
const url = `${h20Url}/ws-manager/api/v1/workspace/${workspaceId}`;
|
|
165
|
+
const response = yield axios_1.default.get(url);
|
|
166
|
+
if (response.data) {
|
|
167
|
+
const workspaceConfig = response.data;
|
|
168
|
+
const devspace = (_b = (_a = workspaceConfig === null || workspaceConfig === void 0 ? void 0 : workspaceConfig.config) === null || _a === void 0 ? void 0 : _a.annotations) === null || _b === void 0 ? void 0 : _b.pack;
|
|
169
|
+
return devspace ? devspace : '';
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
return '';
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
//# sourceMappingURL=environment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment.js","sourceRoot":"","sources":["../../src/checks/environment.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,iDAAgD;AAChD,+CAAiG;AACjG,2CAA2D;AAC3D,sCAAsC;AACtC,0CAAkD;AAUlD,kCAA4B;AAE5B;;;;GAIG;AACH,SA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AAG,CAAC,GAAG,CAAC,CAAC;YACtC,IAAI,QAAQ,CAAC,IAAI,EAAE;gBACf,MAAM,eAAe,GAAG,QAAQ,CAAC,IAAI,CAAC;gBACtC,MAAM,QAAQ,eAAG,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,MAAM,0CAAE,WAAW,0CAAE,IAAI,CAAC;gBAC5D,OAAO,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;aACnC;SACJ;QACD,OAAO,EAAE,CAAC;;CACb"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/checks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.needsUsernamePassword = exports.checkBASDestinations = exports.checkBASDestination = exports.getEnvironment = exports.checkEnvironment = void 0;
|
|
4
|
+
var environment_1 = require("./environment");
|
|
5
|
+
Object.defineProperty(exports, "checkEnvironment", { enumerable: true, get: function () { return environment_1.checkEnvironment; } });
|
|
6
|
+
Object.defineProperty(exports, "getEnvironment", { enumerable: true, get: function () { return environment_1.getEnvironment; } });
|
|
7
|
+
var destination_1 = require("./destination");
|
|
8
|
+
Object.defineProperty(exports, "checkBASDestination", { enumerable: true, get: function () { return destination_1.checkBASDestination; } });
|
|
9
|
+
Object.defineProperty(exports, "checkBASDestinations", { enumerable: true, get: function () { return destination_1.checkBASDestinations; } });
|
|
10
|
+
Object.defineProperty(exports, "needsUsernamePassword", { enumerable: true, get: function () { return destination_1.needsUsernamePassword; } });
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/checks/index.ts"],"names":[],"mappings":";;;AAAA,6CAAiE;AAAxD,+GAAA,gBAAgB,OAAA;AAAE,6GAAA,cAAc,OAAA;AACzC,6CAAiG;AAAxF,kHAAA,mBAAmB,OAAA;AAAE,mHAAA,oBAAoB,OAAA;AAAE,oHAAA,qBAAqB,OAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { WorkspaceFolder } from 'vscode';
|
|
2
|
+
import type { CustomMiddleware, FioriToolsProxyConfig } from '@sap-ux/ui5-config';
|
|
3
|
+
/**
|
|
4
|
+
* Returns the ui5 middleware settings of a given Fiori elements project (v2 or v4).
|
|
5
|
+
*
|
|
6
|
+
* @param root string - path to the SAP UX project (where the ui5.yaml is)
|
|
7
|
+
* @returns middleware proxy
|
|
8
|
+
*/
|
|
9
|
+
export declare function getUi5CustomMiddleware(root: string): Promise<CustomMiddleware<FioriToolsProxyConfig>>;
|
|
10
|
+
/**
|
|
11
|
+
* Internal function to find all folders that contain a package.json in a given workspace.
|
|
12
|
+
*
|
|
13
|
+
* @param wsFolders - root folder paths or workspaces to start the search from
|
|
14
|
+
* @returns projects
|
|
15
|
+
*/
|
|
16
|
+
export declare function findAllPackageJsonFolders(wsFolders: WorkspaceFolder[] | string[] | undefined): Promise<string[]>;
|
|
17
|
+
//# sourceMappingURL=project-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-utils.d.ts","sourceRoot":"","sources":["../../src/checks/project-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAOlF;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,qBAAqB,CAAC,CAAC,CAI3G;AAED;;;;;GAKG;AACH,wBAAsB,yBAAyB,CAC3C,SAAS,EAAE,eAAe,EAAE,GAAG,MAAM,EAAE,GAAG,SAAS,GACpD,OAAO,CAAC,MAAM,EAAE,CAAC,CA4BnB"}
|
|
@@ -0,0 +1,173 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
31
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
32
|
+
};
|
|
33
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
|
+
exports.findAllPackageJsonFolders = exports.getUi5CustomMiddleware = void 0;
|
|
35
|
+
const fs = __importStar(require("fs"));
|
|
36
|
+
const types_1 = require("../types");
|
|
37
|
+
const yaml = __importStar(require("yamljs"));
|
|
38
|
+
const findit2_1 = __importDefault(require("findit2"));
|
|
39
|
+
const path_1 = require("path");
|
|
40
|
+
const i18n_1 = require("../i18n");
|
|
41
|
+
/**
|
|
42
|
+
* Returns the ui5 middleware settings of a given Fiori elements project (v2 or v4).
|
|
43
|
+
*
|
|
44
|
+
* @param root string - path to the SAP UX project (where the ui5.yaml is)
|
|
45
|
+
* @returns middleware proxy
|
|
46
|
+
*/
|
|
47
|
+
function getUi5CustomMiddleware(root) {
|
|
48
|
+
var _a, _b;
|
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
const yamlContent = yield readFile(path_1.join(root, types_1.FileName.Ui5Yaml));
|
|
51
|
+
const middlewares = (_b = (_a = yaml.parse(yamlContent)) === null || _a === void 0 ? void 0 : _a.server) === null || _b === void 0 ? void 0 : _b.customMiddleware;
|
|
52
|
+
return middlewares === null || middlewares === void 0 ? void 0 : middlewares.find((element) => element.name === 'fiori-tools-proxy');
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
exports.getUi5CustomMiddleware = getUi5CustomMiddleware;
|
|
56
|
+
/**
|
|
57
|
+
* Internal function to find all folders that contain a package.json in a given workspace.
|
|
58
|
+
*
|
|
59
|
+
* @param wsFolders - root folder paths or workspaces to start the search from
|
|
60
|
+
* @returns projects
|
|
61
|
+
*/
|
|
62
|
+
function findAllPackageJsonFolders(wsFolders) {
|
|
63
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
// extract root path if provided as VSCode folder
|
|
65
|
+
let wsRoots;
|
|
66
|
+
if (isWorkspaceFolder(wsFolders)) {
|
|
67
|
+
wsRoots = [];
|
|
68
|
+
wsFolders
|
|
69
|
+
.filter((each) => each.uri.scheme === 'file')
|
|
70
|
+
.forEach((folder) => {
|
|
71
|
+
wsRoots.push(folder.uri.fsPath);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
wsRoots = wsFolders || [];
|
|
76
|
+
}
|
|
77
|
+
// find all folders containing a package.json
|
|
78
|
+
const projects = [];
|
|
79
|
+
for (const root of wsRoots) {
|
|
80
|
+
try {
|
|
81
|
+
yield findProject(root, projects);
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
const errorMessage = i18n_1.t('error.projectRootWorkspace', {
|
|
85
|
+
root,
|
|
86
|
+
error: error.message
|
|
87
|
+
});
|
|
88
|
+
console.error(errorMessage);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return projects;
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
exports.findAllPackageJsonFolders = findAllPackageJsonFolders;
|
|
95
|
+
/**
|
|
96
|
+
* WorkspaceFolder typeguard.
|
|
97
|
+
*
|
|
98
|
+
* @param value value to typecheck
|
|
99
|
+
* @returns boolean - if workspace folder
|
|
100
|
+
*/
|
|
101
|
+
function isWorkspaceFolder(value) {
|
|
102
|
+
return value && value.length > 0 && value[0].uri !== undefined;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Find all projects in the given folder.
|
|
106
|
+
*
|
|
107
|
+
* @param wsRoot root folder for the search
|
|
108
|
+
* @param projects projects array to which all found projects will be added
|
|
109
|
+
*/
|
|
110
|
+
function findProject(wsRoot, projects) {
|
|
111
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
112
|
+
return findAll(wsRoot, types_1.FileName.Package, projects, [
|
|
113
|
+
'.git',
|
|
114
|
+
'node_modules',
|
|
115
|
+
'dist',
|
|
116
|
+
types_1.DirName.Sapux,
|
|
117
|
+
types_1.DirName.Webapp,
|
|
118
|
+
'MDKModule' // GH #14290
|
|
119
|
+
]);
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Asynchronously reads the entire contents of a file.
|
|
124
|
+
*
|
|
125
|
+
* @param path A path to a file
|
|
126
|
+
*/
|
|
127
|
+
function readFile(path) {
|
|
128
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
129
|
+
return new Promise((resolve, reject) => {
|
|
130
|
+
fs.readFile(path, { encoding: 'utf8' }, (err, data) => {
|
|
131
|
+
if (err) {
|
|
132
|
+
reject(err);
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
resolve(data);
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Find function to search through folders starting from root.
|
|
143
|
+
*
|
|
144
|
+
* @param root - root folder to start search
|
|
145
|
+
* @param filename - filename to search
|
|
146
|
+
* @param results - result collector (found paths will be added here)
|
|
147
|
+
* @param stopFolders - list of foldernames to exclude (search doesn't traverse into these folders)
|
|
148
|
+
*/
|
|
149
|
+
function findAll(root, filename, results, stopFolders) {
|
|
150
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
151
|
+
return new Promise((resolve, reject) => {
|
|
152
|
+
const finder = findit2_1.default(root);
|
|
153
|
+
finder.on('directory', (dir, stat, stop) => {
|
|
154
|
+
const base = path_1.basename(dir);
|
|
155
|
+
if (stopFolders.indexOf(base) !== -1) {
|
|
156
|
+
stop();
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
finder.on('file', (file) => {
|
|
160
|
+
if (file.endsWith(filename)) {
|
|
161
|
+
results.push(path_1.dirname(file));
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
finder.on('end', () => {
|
|
165
|
+
resolve();
|
|
166
|
+
});
|
|
167
|
+
finder.on('error', (error) => {
|
|
168
|
+
reject(error);
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
//# sourceMappingURL=project-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-utils.js","sourceRoot":"","sources":["../../src/checks/project-utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,uCAAyB;AAEzB,oCAA6C;AAC7C,6CAA+B;AAC/B,sDAA0C;AAC1C,+BAA+C;AAC/C,kCAA4B;AAE5B;;;;;GAKG;AACH,SAAsB,sBAAsB,CAAC,IAAY;;;QACrD,MAAM,WAAW,GAAG,MAAM,QAAQ,CAAC,WAAI,CAAC,IAAI,EAAE,gBAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;QACjE,MAAM,WAAW,eAA8C,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,0CAAE,MAAM,0CAAE,gBAAgB,CAAC;QACjH,OAAO,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,mBAAmB,EAAE;;CAC/E;AAJD,wDAIC;AAED;;;;;GAKG;AACH,SAAsB,yBAAyB,CAC3C,SAAmD;;QAEnD,iDAAiD;QACjD,IAAI,OAAiB,CAAC;QACtB,IAAI,iBAAiB,CAAC,SAAS,CAAC,EAAE;YAC9B,OAAO,GAAG,EAAE,CAAC;YACb,SAAS;iBACJ,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,KAAK,MAAM,CAAC;iBAC5C,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;gBAChB,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YACpC,CAAC,CAAC,CAAC;SACV;aAAM;YACH,OAAO,GAAG,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+
* @returns messages, destinations
|
|
7
|
+
*/
|
|
8
|
+
export declare function getDestinationsFromWorkspace(wsFolders: string[]): Promise<{
|
|
9
|
+
messages: ResultMessage[];
|
|
10
|
+
destinations: string[];
|
|
11
|
+
}>;
|
|
12
|
+
//# sourceMappingURL=workspace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../src/checks/workspace.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAwB9C;;;;;GAKG;AACH,wBAAsB,4BAA4B,CAC9C,SAAS,EAAE,MAAM,EAAE,GACpB,OAAO,CAAC;IAAE,QAAQ,EAAE,aAAa,EAAE,CAAC;IAAC,YAAY,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CA0ChE"}
|
|
@@ -0,0 +1,91 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.getDestinationsFromWorkspace = void 0;
|
|
13
|
+
const fs_1 = require("fs");
|
|
14
|
+
const path_1 = require("path");
|
|
15
|
+
const types_1 = require("../types");
|
|
16
|
+
const project_utils_1 = require("./project-utils");
|
|
17
|
+
const i18n_1 = require("../i18n");
|
|
18
|
+
/**
|
|
19
|
+
* Retrieve destination from the app.
|
|
20
|
+
*
|
|
21
|
+
* @param appRoot root of app
|
|
22
|
+
* @returns destination
|
|
23
|
+
*/
|
|
24
|
+
function getDestinationFromApp(appRoot) {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
const appDestinations = [];
|
|
27
|
+
if (fs_1.existsSync(path_1.join(appRoot, types_1.FileName.Ui5Yaml))) {
|
|
28
|
+
const middleware = yield project_utils_1.getUi5CustomMiddleware(appRoot);
|
|
29
|
+
for (const backendConfig of middleware.configuration.backend || []) {
|
|
30
|
+
if (backendConfig.destination) {
|
|
31
|
+
appDestinations.push(backendConfig.destination);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
throw Error(i18n_1.t('error.ui5YamlMissing', { appRoot }));
|
|
37
|
+
}
|
|
38
|
+
return appDestinations;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Retrieve destinations from workspace.
|
|
43
|
+
*
|
|
44
|
+
* @param wsFolders workspace folders
|
|
45
|
+
* @returns messages, destinations
|
|
46
|
+
*/
|
|
47
|
+
function getDestinationsFromWorkspace(wsFolders) {
|
|
48
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
const messages = [];
|
|
50
|
+
const destinations = [];
|
|
51
|
+
messages.push({
|
|
52
|
+
severity: "info" /* Info */,
|
|
53
|
+
text: i18n_1.t('info.appSearch', { folders: wsFolders.join(', ') })
|
|
54
|
+
});
|
|
55
|
+
const appRoots = yield project_utils_1.findAllPackageJsonFolders(wsFolders);
|
|
56
|
+
messages.push({
|
|
57
|
+
severity: "info" /* Info */,
|
|
58
|
+
text: i18n_1.t('info.foundNumApps', { numApps: appRoots.length })
|
|
59
|
+
});
|
|
60
|
+
for (const appRoot of appRoots) {
|
|
61
|
+
try {
|
|
62
|
+
const appDestinations = yield getDestinationFromApp(appRoot);
|
|
63
|
+
if (appDestinations.length > 0) {
|
|
64
|
+
destinations.push(...appDestinations);
|
|
65
|
+
messages.push({
|
|
66
|
+
severity: "info" /* Info */,
|
|
67
|
+
text: i18n_1.t('info.foundDestinationsInApp', { appRoot, appDestinations: appDestinations.join(', ') })
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
messages.push({
|
|
72
|
+
severity: "debug" /* Debug */,
|
|
73
|
+
text: i18n_1.t('info.noDestinationsFoundInApp', { appRoot })
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
messages.push({
|
|
79
|
+
severity: "debug" /* Debug */,
|
|
80
|
+
text: i18n_1.t('info.noDestinationDefinedForApp', { appRoot, error: error.message })
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
messages,
|
|
86
|
+
destinations
|
|
87
|
+
};
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
exports.getDestinationsFromWorkspace = getDestinationsFromWorkspace;
|
|
91
|
+
//# sourceMappingURL=workspace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace.js","sourceRoot":"","sources":["../../src/checks/workspace.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2BAAgC;AAChC,+BAA4B;AAC5B,oCAA8C;AAC9C,mDAAoF;AAEpF,kCAA4B;AAE5B;;;;;GAKG;AACH,SAAe,qBAAqB,CAAC,OAAe;;QAChD,MAAM,eAAe,GAAa,EAAE,CAAC;QACrC,IAAI,eAAU,CAAC,WAAI,CAAC,OAAO,EAAE,gBAAQ,CAAC,OAAO,CAAC,CAAC,EAAE;YAC7C,MAAM,UAAU,GAAG,MAAM,sCAAsB,CAAC,OAAO,CAAC,CAAC;YACzD,KAAK,MAAM,aAAa,IAAI,UAAU,CAAC,aAAa,CAAC,OAAO,IAAI,EAAE,EAAE;gBAChE,IAAI,aAAa,CAAC,WAAW,EAAE;oB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