@sap-ux/fiori-app-sub-generator 0.0.2
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/generators/app/index.d.ts +3 -0
- package/generators/app/index.js +5 -0
- package/generators/app-headless/index.d.ts +34 -0
- package/generators/app-headless/index.js +75 -0
- package/generators/app-headless/transforms.d.ts +9 -0
- package/generators/app-headless/transforms.js +208 -0
- package/generators/fiori-app-generator/end.d.ts +49 -0
- package/generators/fiori-app-generator/end.js +105 -0
- package/generators/fiori-app-generator/fioriAppGenerator.d.ts +45 -0
- package/generators/fiori-app-generator/fioriAppGenerator.js +319 -0
- package/generators/fiori-app-generator/fioriAppGeneratorOptions.d.ts +94 -0
- package/generators/fiori-app-generator/fioriAppGeneratorOptions.js +3 -0
- package/generators/fiori-app-generator/index.d.ts +3 -0
- package/generators/fiori-app-generator/index.js +19 -0
- package/generators/fiori-app-generator/install.d.ts +34 -0
- package/generators/fiori-app-generator/install.js +80 -0
- package/generators/fiori-app-generator/prompting.d.ts +84 -0
- package/generators/fiori-app-generator/prompting.js +303 -0
- package/generators/fiori-app-generator/subgenHelpers.d.ts +43 -0
- package/generators/fiori-app-generator/subgenHelpers.js +71 -0
- package/generators/fiori-app-generator/transforms.d.ts +38 -0
- package/generators/fiori-app-generator/transforms.js +278 -0
- package/generators/fiori-app-generator/writing.d.ts +27 -0
- package/generators/fiori-app-generator/writing.js +94 -0
- package/generators/index.d.ts +6 -0
- package/generators/index.js +22 -0
- package/generators/translations/fioriAppSubGenerator.i18n.json +119 -0
- package/generators/types/common.d.ts +46 -0
- package/generators/types/common.js +3 -0
- package/generators/types/constants.d.ts +60 -0
- package/generators/types/constants.js +98 -0
- package/generators/types/external.d.ts +261 -0
- package/generators/types/external.js +88 -0
- package/generators/types/index.d.ts +7 -0
- package/generators/types/index.js +23 -0
- package/generators/types/state.d.ts +149 -0
- package/generators/types/state.js +35 -0
- package/generators/types/telemetryEvents.d.ts +61 -0
- package/generators/types/telemetryEvents.js +3 -0
- package/generators/types/yeomanUiStepConfig.d.ts +13 -0
- package/generators/types/yeomanUiStepConfig.js +3 -0
- package/generators/utils/appWizardCache.d.ts +40 -0
- package/generators/utils/appWizardCache.js +72 -0
- package/generators/utils/command-runner.d.ts +30 -0
- package/generators/utils/command-runner.js +88 -0
- package/generators/utils/common.d.ts +147 -0
- package/generators/utils/common.js +286 -0
- package/generators/utils/eventHooks.d.ts +29 -0
- package/generators/utils/eventHooks.js +48 -0
- package/generators/utils/i18n.d.ts +16 -0
- package/generators/utils/i18n.js +54 -0
- package/generators/utils/index.d.ts +9 -0
- package/generators/utils/index.js +25 -0
- package/generators/utils/sapuxLayer.d.ts +15 -0
- package/generators/utils/sapuxLayer.js +24 -0
- package/generators/utils/stepsHelper.d.ts +47 -0
- package/generators/utils/stepsHelper.js +161 -0
- package/generators/utils/telemetry.d.ts +16 -0
- package/generators/utils/telemetry.js +41 -0
- package/package.json +84 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateDependentStep = updateDependentStep;
|
|
4
|
+
exports.hasActiveStep = hasActiveStep;
|
|
5
|
+
exports.hasStep = hasStep;
|
|
6
|
+
exports.getYeomanUiStepConfig = getYeomanUiStepConfig;
|
|
7
|
+
exports.validateNextStep = validateNextStep;
|
|
8
|
+
const yeoman_ui_types_1 = require("@sap-devx/yeoman-ui-types");
|
|
9
|
+
const i18n_1 = require("../utils/i18n");
|
|
10
|
+
/**
|
|
11
|
+
* Find the index of a step in the Yeoman UI steps.
|
|
12
|
+
*
|
|
13
|
+
* @param stepName The name (title) of the step to check. Not the step key.
|
|
14
|
+
* @param prompts
|
|
15
|
+
* @returns
|
|
16
|
+
*/
|
|
17
|
+
function getStepIndex(stepName, prompts) {
|
|
18
|
+
const steps = prompts.items;
|
|
19
|
+
return steps?.findIndex((step) => {
|
|
20
|
+
return step.name === (0, i18n_1.t)(stepName);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Update the dependent step in the active steps of the Yeoman UI steps. Ultimately this will result in a new step being added to the Application Wizard.
|
|
25
|
+
*
|
|
26
|
+
* @param currentStepName The name (title) of the step that is being toggled. Not the step key.
|
|
27
|
+
* @param stepConfigList
|
|
28
|
+
* @param action Add dependent step if true, remove if false.
|
|
29
|
+
* @param dependentStepName
|
|
30
|
+
*/
|
|
31
|
+
function updateDependentStep(currentStepName, stepConfigList, action, dependentStepName) {
|
|
32
|
+
stepConfigList.forEach((stepConfig) => {
|
|
33
|
+
const dependentSteps = stepConfig.dependentMap[currentStepName];
|
|
34
|
+
const indexOfdependentSteps = [];
|
|
35
|
+
dependentSteps.forEach((dependentStep) => {
|
|
36
|
+
const index = getStepIndex(dependentStep.name, stepConfig.activeSteps);
|
|
37
|
+
indexOfdependentSteps.push(index);
|
|
38
|
+
});
|
|
39
|
+
const currentStepIndex = getStepIndex(currentStepName, stepConfig.activeSteps);
|
|
40
|
+
// We turn on/off all the dependent steps together, check only index 0 is sufficient
|
|
41
|
+
if (!dependentStepName) {
|
|
42
|
+
if (indexOfdependentSteps.length > 0 && indexOfdependentSteps[0] >= 0 && !action) {
|
|
43
|
+
// If user doens't want to add deployment config, remove them from active steps.
|
|
44
|
+
// For each dependent step at index i we remove, the next dependent step will be at index i.
|
|
45
|
+
// So we keep removing dependent steps at indexOfdependentSteps[0].
|
|
46
|
+
indexOfdependentSteps.forEach(() => {
|
|
47
|
+
stepConfig.activeSteps.splice(indexOfdependentSteps[0], 1, []);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
if (indexOfdependentSteps.length > 0 && indexOfdependentSteps[0] < 0 && action) {
|
|
51
|
+
// If user doens't want to add deployment config, add them to active steps.
|
|
52
|
+
for (let i = 0; i < indexOfdependentSteps.length; i++) {
|
|
53
|
+
const dependentStep = dependentSteps[i];
|
|
54
|
+
// If the dependency step is at index currentStepIndex, the dependent steps
|
|
55
|
+
// are added to index currentStepIndex + 1, currentStepIndex + 2, etc.
|
|
56
|
+
stepConfig.activeSteps.splice(currentStepIndex + i + 1, 0, [
|
|
57
|
+
{ name: dependentStep.name, description: dependentStep.description }
|
|
58
|
+
]);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
else if (!action) {
|
|
63
|
+
const dependentStepIndex = getStepIndex(dependentStepName, stepConfig.activeSteps);
|
|
64
|
+
if (dependentStepIndex >= 0) {
|
|
65
|
+
stepConfig.activeSteps.splice(dependentStepIndex, 1, []);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
// Count number of dependent steps that are active
|
|
70
|
+
let count = 0;
|
|
71
|
+
let dependentStepToAdd;
|
|
72
|
+
for (const dependentStep of dependentSteps) {
|
|
73
|
+
if (dependentStep.name === dependentStepName) {
|
|
74
|
+
dependentStepToAdd = dependentStep;
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
const index = getStepIndex(dependentStep.name, stepConfig.activeSteps);
|
|
78
|
+
if (index >= 0) {
|
|
79
|
+
count++;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (dependentStepToAdd) {
|
|
83
|
+
const index = getStepIndex(dependentStepToAdd.name, stepConfig.activeSteps);
|
|
84
|
+
if (index < 0) {
|
|
85
|
+
stepConfig.activeSteps.splice(currentStepIndex + count + 1, 0, [
|
|
86
|
+
{ name: dependentStepToAdd.name, description: dependentStepToAdd.description }
|
|
87
|
+
]);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Check if a step is considered active in the Yeoman UI steps.
|
|
95
|
+
*
|
|
96
|
+
* @param stepName The name (title) of the step to check. Not the step key.
|
|
97
|
+
* @param yuiSteps
|
|
98
|
+
* @returns
|
|
99
|
+
*/
|
|
100
|
+
function hasActiveStep(stepName, yuiSteps) {
|
|
101
|
+
return getStepIndex(stepName, yuiSteps) > -1;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Check if a step is present in the steps array. Non-present steps are not added to the Application Wizard, essentially skipping them.
|
|
105
|
+
*
|
|
106
|
+
* @param steps
|
|
107
|
+
* @param stepKey
|
|
108
|
+
* @returns
|
|
109
|
+
*/
|
|
110
|
+
function hasStep(steps, stepKey) {
|
|
111
|
+
return !!steps.find((step) => step.key === stepKey);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Get the Yeoman UI step configuration.
|
|
115
|
+
*
|
|
116
|
+
* @param stepsArr
|
|
117
|
+
* @returns
|
|
118
|
+
*/
|
|
119
|
+
function getYeomanUiStepConfig(stepsArr) {
|
|
120
|
+
const activeStepsArr = [];
|
|
121
|
+
const dependentMap = {};
|
|
122
|
+
stepsArr.forEach((step, index) => {
|
|
123
|
+
if (step['dependency']) {
|
|
124
|
+
if (index - 1 < 0) {
|
|
125
|
+
throw (0, i18n_1.t)('error.invalidYUIStepConfig');
|
|
126
|
+
}
|
|
127
|
+
const dependencyStepName = step['dependency'];
|
|
128
|
+
if (dependencyStepName) {
|
|
129
|
+
if (!dependentMap[dependencyStepName]) {
|
|
130
|
+
dependentMap[dependencyStepName] = [];
|
|
131
|
+
}
|
|
132
|
+
dependentMap[dependencyStepName].push(step);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
activeStepsArr.push(step);
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
const stepConfig = {
|
|
140
|
+
activeSteps: new yeoman_ui_types_1.Prompts(activeStepsArr),
|
|
141
|
+
dependentMap: dependentMap
|
|
142
|
+
};
|
|
143
|
+
return stepConfig;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Used in Inquirer prompt validators to dynamically add or remove dependent steps to the Application Wizard.
|
|
147
|
+
* For example, may be used when a user checks `addDeployConfig` to add that deployment config step to the wizard.
|
|
148
|
+
*
|
|
149
|
+
* @param addDependentStep
|
|
150
|
+
* @param currentStepName
|
|
151
|
+
* @param appGenStepConfigList
|
|
152
|
+
* @param dependentStepName
|
|
153
|
+
* @returns
|
|
154
|
+
*/
|
|
155
|
+
function validateNextStep(addDependentStep, currentStepName, appGenStepConfigList, dependentStepName) {
|
|
156
|
+
if (appGenStepConfigList) {
|
|
157
|
+
updateDependentStep(currentStepName, appGenStepConfigList, addDependentStep, dependentStepName);
|
|
158
|
+
}
|
|
159
|
+
return true;
|
|
160
|
+
}
|
|
161
|
+
//# sourceMappingURL=stepsHelper.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ApiHubType, type TelemetryBusinessHubType, type Service, type TelemetrySapSystemType } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Get the SAP system type as reported in telemetry events.
|
|
4
|
+
*
|
|
5
|
+
* @param connectedSystem
|
|
6
|
+
* @returns
|
|
7
|
+
*/
|
|
8
|
+
export declare function getTelemetrySapSystemType(connectedSystem: Service['connectedSystem']): TelemetrySapSystemType | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Get the business hub type as reported in telemetry events.
|
|
11
|
+
*
|
|
12
|
+
* @param apiHubType
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
export declare function getTelemetryBusinessHubType(apiHubType?: ApiHubType): TelemetryBusinessHubType | undefined;
|
|
16
|
+
//# sourceMappingURL=telemetry.d.ts.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTelemetrySapSystemType = getTelemetrySapSystemType;
|
|
4
|
+
exports.getTelemetryBusinessHubType = getTelemetryBusinessHubType;
|
|
5
|
+
const btp_utils_1 = require("@sap-ux/btp-utils");
|
|
6
|
+
const common_1 = require("./common");
|
|
7
|
+
/**
|
|
8
|
+
* Get the SAP system type as reported in telemetry events.
|
|
9
|
+
*
|
|
10
|
+
* @param connectedSystem
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
function getTelemetrySapSystemType(connectedSystem) {
|
|
14
|
+
if ((0, common_1.isBTPHosted)(connectedSystem)) {
|
|
15
|
+
return 'SCP';
|
|
16
|
+
}
|
|
17
|
+
if ((connectedSystem?.destination && (0, btp_utils_1.isOnPremiseDestination)(connectedSystem.destination)) ||
|
|
18
|
+
(connectedSystem?.backendSystem && !connectedSystem.backendSystem.serviceKeys)) {
|
|
19
|
+
return 'ABAP';
|
|
20
|
+
}
|
|
21
|
+
// The only remaining case is CF on VSCode
|
|
22
|
+
if (connectedSystem?.serviceProvider) {
|
|
23
|
+
return 'CF';
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Get the business hub type as reported in telemetry events.
|
|
28
|
+
*
|
|
29
|
+
* @param apiHubType
|
|
30
|
+
* @returns
|
|
31
|
+
*/
|
|
32
|
+
function getTelemetryBusinessHubType(apiHubType) {
|
|
33
|
+
if (apiHubType === "API_HUB" /* ApiHubType.apiHub */) {
|
|
34
|
+
return 'BusinessAcceleratorHub';
|
|
35
|
+
}
|
|
36
|
+
else if (apiHubType === "API_HUB_ENTERPRISE" /* ApiHubType.apiHubEnterprise */) {
|
|
37
|
+
return 'BusinessHubEnterprise';
|
|
38
|
+
}
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=telemetry.js.map
|
package/package.json
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sap-ux/fiori-app-sub-generator",
|
|
3
|
+
"description": "A yeoman (sub) generator that can generate Fiori applications. Not for standalone use.",
|
|
4
|
+
"version": "0.0.2",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
8
|
+
"directory": "packages/fiori-app-sub-generator"
|
|
9
|
+
},
|
|
10
|
+
"bugs": {
|
|
11
|
+
"url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Afiori-app-sub-generator"
|
|
12
|
+
},
|
|
13
|
+
"license": "Apache-2.0",
|
|
14
|
+
"main": "generators/index.js",
|
|
15
|
+
"files": [
|
|
16
|
+
"LICENSE",
|
|
17
|
+
"generators",
|
|
18
|
+
"!generators/*.map",
|
|
19
|
+
"!generators/**/*.map"
|
|
20
|
+
],
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@sap-ux/annotation-converter": "0.10.3",
|
|
23
|
+
"@sap-ux/edmx-parser": "0.9.0",
|
|
24
|
+
"@sap/service-provider-apis": "2.1.5",
|
|
25
|
+
"i18next": "23.11.2",
|
|
26
|
+
"inquirer": "8.2.6",
|
|
27
|
+
"lodash": "4.17.21",
|
|
28
|
+
"mem-fs": "2.1.0",
|
|
29
|
+
"mem-fs-editor": "9.4.0",
|
|
30
|
+
"uuid": "11.0.5",
|
|
31
|
+
"yeoman-generator": "5.10.0",
|
|
32
|
+
"@sap-ux/annotation-generator": "0.3.22",
|
|
33
|
+
"@sap-ux/axios-extension": "1.19.2",
|
|
34
|
+
"@sap-ux/btp-utils": "1.0.2",
|
|
35
|
+
"@sap-ux/cap-config-writer": "0.9.23",
|
|
36
|
+
"@sap-ux/feature-toggle": "0.2.3",
|
|
37
|
+
"@sap-ux/fiori-elements-writer": "2.1.36",
|
|
38
|
+
"@sap-ux/fiori-freestyle-writer": "2.2.6",
|
|
39
|
+
"@sap-ux/fiori-generator-shared": "0.10.0",
|
|
40
|
+
"@sap-ux/fiori-tools-settings": "0.1.0",
|
|
41
|
+
"@sap-ux/launch-config": "0.8.1",
|
|
42
|
+
"@sap-ux/odata-service-inquirer": "2.2.28",
|
|
43
|
+
"@sap-ux/odata-service-writer": "0.26.13",
|
|
44
|
+
"@sap-ux/project-access": "1.29.18",
|
|
45
|
+
"@sap-ux/store": "1.0.0",
|
|
46
|
+
"@sap-ux/telemetry": "0.5.72",
|
|
47
|
+
"@sap-ux/ui5-application-inquirer": "0.11.2",
|
|
48
|
+
"@sap-ux/ui5-info": "0.9.1"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@sap-devx/yeoman-ui-types": "1.16.9",
|
|
52
|
+
"@types/inquirer": "8.2.6",
|
|
53
|
+
"@types/lodash": "4.14.202",
|
|
54
|
+
"@types/mem-fs": "1.1.2",
|
|
55
|
+
"@types/mem-fs-editor": "7.0.1",
|
|
56
|
+
"@types/vscode": "1.73.1",
|
|
57
|
+
"@types/yeoman-environment": "2.10.11",
|
|
58
|
+
"@types/yeoman-generator": "5.2.14",
|
|
59
|
+
"@types/yeoman-test": "4.0.6",
|
|
60
|
+
"jest-extended": "4.0.2",
|
|
61
|
+
"jest-mock": "29.7.0",
|
|
62
|
+
"mock-spawn": "0.2.6",
|
|
63
|
+
"rimraf": "5.0.5",
|
|
64
|
+
"yeoman-test": "6.3.0",
|
|
65
|
+
"@sap-ux/flp-config-sub-generator": "0.1.52",
|
|
66
|
+
"@sap-ux/inquirer-common": "0.6.33",
|
|
67
|
+
"@sap-ux/jest-file-matchers": "0.2.1",
|
|
68
|
+
"@sap-ux/logger": "0.6.0"
|
|
69
|
+
},
|
|
70
|
+
"engines": {
|
|
71
|
+
"node": ">=18.x"
|
|
72
|
+
},
|
|
73
|
+
"scripts": {
|
|
74
|
+
"build": "tsc --build",
|
|
75
|
+
"clean": "rimraf --glob generators test/test-output coverage *.tsbuildinfo",
|
|
76
|
+
"watch": "tsc --watch",
|
|
77
|
+
"lint": "eslint . --ext .ts",
|
|
78
|
+
"lint:fix": "eslint . --ext .ts --fix",
|
|
79
|
+
"test": "jest --ci --forceExit --detectOpenHandles --colors --passWithNoTests",
|
|
80
|
+
"test-u": "jest --ci --forceExit --detectOpenHandles --colors -u",
|
|
81
|
+
"link": "pnpm link --global",
|
|
82
|
+
"unlink": "pnpm unlink --global"
|
|
83
|
+
}
|
|
84
|
+
}
|