@sap-ux/fiori-generator-shared 0.3.13 → 0.3.15
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/dist/environment.d.ts +7 -0
- package/dist/environment.js +18 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/system-utils.d.ts +18 -0
- package/dist/system-utils.js +56 -0
- package/package.json +2 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isCli = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Determine if the current prompting environment is cli .
|
|
6
|
+
*
|
|
7
|
+
* @returns true if it is a cli environment, false otherwise
|
|
8
|
+
*/
|
|
9
|
+
function isCli() {
|
|
10
|
+
if (process.argv[1]?.includes('yo') || process.stdin.isTTY) {
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.isCli = isCli;
|
|
18
|
+
//# sourceMappingURL=environment.js.map
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -16,8 +16,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.generateReadMe = exports.getBootstrapResourceUrls = void 0;
|
|
18
18
|
__exportStar(require("./cap"), exports);
|
|
19
|
+
__exportStar(require("./environment"), exports);
|
|
19
20
|
var helpers_1 = require("./helpers");
|
|
20
21
|
Object.defineProperty(exports, "getBootstrapResourceUrls", { enumerable: true, get: function () { return helpers_1.getBootstrapResourceUrls; } });
|
|
21
22
|
var read_me_1 = require("./read-me");
|
|
22
23
|
Object.defineProperty(exports, "generateReadMe", { enumerable: true, get: function () { return read_me_1.generateReadMe; } });
|
|
24
|
+
__exportStar(require("./system-utils"), exports);
|
|
23
25
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Relevant values for display extended system properties to the UI
|
|
3
|
+
*/
|
|
4
|
+
export declare enum Suffix {
|
|
5
|
+
S4HC = "S4HC",
|
|
6
|
+
BTP = "BTP"
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Get the system display name.
|
|
10
|
+
*
|
|
11
|
+
* @param systemName - system name
|
|
12
|
+
* @param displayUsername - display username
|
|
13
|
+
* @param isBtp - is BTP
|
|
14
|
+
* @param isS4HC - is S/4 Hana Cloud
|
|
15
|
+
* @returns system display name
|
|
16
|
+
*/
|
|
17
|
+
export declare function getSystemDisplayName(systemName: string, displayUsername?: string, isBtp?: boolean, isS4HC?: boolean): string;
|
|
18
|
+
//# sourceMappingURL=system-utils.d.ts.map
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSystemDisplayName = exports.Suffix = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Relevant values for display extended system properties to the UI
|
|
6
|
+
*/
|
|
7
|
+
var Suffix;
|
|
8
|
+
(function (Suffix) {
|
|
9
|
+
Suffix["S4HC"] = "S4HC";
|
|
10
|
+
Suffix["BTP"] = "BTP";
|
|
11
|
+
})(Suffix || (exports.Suffix = Suffix = {}));
|
|
12
|
+
/**
|
|
13
|
+
* Escape any special RegExp character that we want to use literally.
|
|
14
|
+
*
|
|
15
|
+
* @param str string input
|
|
16
|
+
* @returns string a cleansed version of the input
|
|
17
|
+
*/
|
|
18
|
+
function escapeRegExp(str) {
|
|
19
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Trim, cleanse and return a system name appended with the appropriate suffix i.e. BTP | S4HC.
|
|
23
|
+
*
|
|
24
|
+
* @param systemName name of the system
|
|
25
|
+
* @param suffix the appropriate suffix appended, BTP | S4HC
|
|
26
|
+
* @returns string return an escaped string, appended with the appropriate suffix
|
|
27
|
+
*/
|
|
28
|
+
function addSuffix(systemName, suffix) {
|
|
29
|
+
const suffixStr = ` (${suffix})`;
|
|
30
|
+
return RegExp(`${escapeRegExp(suffixStr)}$`).exec(systemName.trim()) ? systemName : `${systemName} (${suffix})`;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Get the system display name.
|
|
34
|
+
*
|
|
35
|
+
* @param systemName - system name
|
|
36
|
+
* @param displayUsername - display username
|
|
37
|
+
* @param isBtp - is BTP
|
|
38
|
+
* @param isS4HC - is S/4 Hana Cloud
|
|
39
|
+
* @returns system display name
|
|
40
|
+
*/
|
|
41
|
+
function getSystemDisplayName(systemName, displayUsername, isBtp = false, isS4HC = false) {
|
|
42
|
+
const userDisplayName = displayUsername ? ` [${displayUsername}]` : '';
|
|
43
|
+
let systemDisplayName;
|
|
44
|
+
if (isBtp) {
|
|
45
|
+
systemDisplayName = addSuffix(systemName, Suffix.BTP);
|
|
46
|
+
}
|
|
47
|
+
else if (isS4HC) {
|
|
48
|
+
systemDisplayName = addSuffix(systemName, Suffix.S4HC);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
systemDisplayName = systemName;
|
|
52
|
+
}
|
|
53
|
+
return `${systemDisplayName}${userDisplayName}`;
|
|
54
|
+
}
|
|
55
|
+
exports.getSystemDisplayName = getSystemDisplayName;
|
|
56
|
+
//# sourceMappingURL=system-utils.js.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap-ux/fiori-generator-shared",
|
|
3
3
|
"description": "Commonly used shared functionality and types to support the fiori generator.",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.15",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"mem-fs": "2.1.0",
|
|
21
21
|
"mem-fs-editor": "9.4.0",
|
|
22
|
+
"@sap-ux/btp-utils": "0.15.1",
|
|
22
23
|
"@sap-ux/project-access": "1.26.8"
|
|
23
24
|
},
|
|
24
25
|
"devDependencies": {
|