@sap-ux/generator-adp 0.3.16 → 0.3.18
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/generators/app/extension-project/index.js +3 -3
- package/generators/app/index.d.ts +9 -7
- package/generators/app/index.js +79 -47
- package/generators/app/layer.js +2 -3
- package/generators/app/questions/attributes.d.ts +20 -1
- package/generators/app/questions/attributes.js +55 -5
- package/generators/app/questions/configuration.js +1 -1
- package/generators/app/questions/helper/conditions.js +4 -5
- package/generators/app/questions/helper/default-values.js +3 -4
- package/generators/app/questions/helper/tooltip.js +1 -2
- package/generators/app/questions/helper/validators.js +2 -3
- package/generators/app/types.d.ts +13 -2
- package/generators/app/types.js +2 -0
- package/generators/translations/generator-adp.i18n.json +7 -1
- package/generators/utils/appWizardCache.d.ts +55 -0
- package/generators/utils/appWizardCache.js +77 -0
- package/generators/utils/deps.js +19 -10
- package/generators/utils/i18n.js +2 -3
- package/generators/utils/opts.d.ts +11 -0
- package/generators/utils/opts.js +25 -0
- package/generators/utils/parse-json-input.js +2 -3
- package/generators/utils/steps.d.ts +36 -0
- package/generators/utils/steps.js +82 -0
- package/generators/utils/subgenHelpers.d.ts +74 -0
- package/generators/utils/subgenHelpers.js +103 -0
- package/generators/utils/type-guards.js +2 -3
- package/package.json +9 -8
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.EXTENSIBILITY_GENERATOR_NS = void 0;
|
|
4
|
+
exports.getExtensionProjectData = getExtensionProjectData;
|
|
5
|
+
exports.resolveNodeModuleGenerator = resolveNodeModuleGenerator;
|
|
4
6
|
const path_1 = require("path");
|
|
5
7
|
const adp_tooling_1 = require("@sap-ux/adp-tooling");
|
|
6
8
|
const i18n_1 = require("../../utils/i18n");
|
|
@@ -39,7 +41,6 @@ async function getExtensionProjectData(configAnswers, attributeAnswers, systemLo
|
|
|
39
41
|
namespace: application.id
|
|
40
42
|
};
|
|
41
43
|
}
|
|
42
|
-
exports.getExtensionProjectData = getExtensionProjectData;
|
|
43
44
|
/**
|
|
44
45
|
* Attempts to resolve the path to a specific node module generator from the NODE_PATH environment variable.
|
|
45
46
|
* This is particularly used in the prompt for extension projects within SAP Business Application Studio (BAS)
|
|
@@ -69,5 +70,4 @@ function resolveNodeModuleGenerator() {
|
|
|
69
70
|
}
|
|
70
71
|
return generator;
|
|
71
72
|
}
|
|
72
|
-
exports.resolveNodeModuleGenerator = resolveNodeModuleGenerator;
|
|
73
73
|
//# sourceMappingURL=index.js.map
|
|
@@ -14,10 +14,14 @@ export default class extends Generator {
|
|
|
14
14
|
* A boolean flag indicating whether node_modules should be installed after project generation.
|
|
15
15
|
*/
|
|
16
16
|
private readonly shouldInstallDeps;
|
|
17
|
+
/**
|
|
18
|
+
* A boolean flag indicating whether an extension project should be created.
|
|
19
|
+
*/
|
|
20
|
+
private shouldCreateExtProject;
|
|
17
21
|
/**
|
|
18
22
|
* Generator prompts.
|
|
19
23
|
*/
|
|
20
|
-
private prompts;
|
|
24
|
+
private readonly prompts;
|
|
21
25
|
/**
|
|
22
26
|
* Instance of the logger.
|
|
23
27
|
*/
|
|
@@ -76,19 +80,17 @@ export default class extends Generator {
|
|
|
76
80
|
install(): Promise<void>;
|
|
77
81
|
end(): void;
|
|
78
82
|
/**
|
|
79
|
-
*
|
|
83
|
+
* Retrieves the ConfigPrompter instance from cache if it exists, otherwise creates a new instance.
|
|
84
|
+
*
|
|
85
|
+
* @returns {ConfigPrompter} Cached config prompter if going back a page.
|
|
80
86
|
*/
|
|
81
|
-
private
|
|
87
|
+
private _getOrCreatePrompter;
|
|
82
88
|
/**
|
|
83
89
|
* Combines the target folder and project name.
|
|
84
90
|
*
|
|
85
91
|
* @returns {string} The project path from the answers.
|
|
86
92
|
*/
|
|
87
93
|
private _getProjectPath;
|
|
88
|
-
/**
|
|
89
|
-
* Sets up the prompts for the generator.
|
|
90
|
-
*/
|
|
91
|
-
private _setupPrompts;
|
|
92
94
|
/**
|
|
93
95
|
* Configures logging for the generator.
|
|
94
96
|
*/
|
package/generators/app/index.js
CHANGED
|
@@ -13,13 +13,16 @@ const feature_toggle_1 = require("@sap-ux/feature-toggle");
|
|
|
13
13
|
const layer_1 = require("./layer");
|
|
14
14
|
const i18n_1 = require("../utils/i18n");
|
|
15
15
|
const telemetryEvents_1 = require("../telemetryEvents");
|
|
16
|
+
const opts_1 = require("../utils/opts");
|
|
17
|
+
const steps_1 = require("../utils/steps");
|
|
16
18
|
const logger_2 = __importDefault(require("../utils/logger"));
|
|
17
19
|
const attributes_1 = require("./questions/attributes");
|
|
18
20
|
const configuration_1 = require("./questions/configuration");
|
|
19
21
|
const validators_1 = require("./questions/helper/validators");
|
|
20
22
|
const deps_1 = require("../utils/deps");
|
|
23
|
+
const subgenHelpers_1 = require("../utils/subgenHelpers");
|
|
21
24
|
const parse_json_input_1 = require("../utils/parse-json-input");
|
|
22
|
-
const
|
|
25
|
+
const appWizardCache_1 = require("../utils/appWizardCache");
|
|
23
26
|
const default_values_1 = require("./questions/helper/default-values");
|
|
24
27
|
/**
|
|
25
28
|
* Generator for creating an Adaptation Project.
|
|
@@ -35,6 +38,10 @@ class default_1 extends yeoman_generator_1.default {
|
|
|
35
38
|
* A boolean flag indicating whether node_modules should be installed after project generation.
|
|
36
39
|
*/
|
|
37
40
|
shouldInstallDeps;
|
|
41
|
+
/**
|
|
42
|
+
* A boolean flag indicating whether an extension project should be created.
|
|
43
|
+
*/
|
|
44
|
+
shouldCreateExtProject;
|
|
38
45
|
/**
|
|
39
46
|
* Generator prompts.
|
|
40
47
|
*/
|
|
@@ -101,7 +108,17 @@ class default_1 extends yeoman_generator_1.default {
|
|
|
101
108
|
const jsonInputString = (0, parse_json_input_1.getFirstArgAsString)(args);
|
|
102
109
|
this.jsonInput = (0, parse_json_input_1.parseJsonInput)(jsonInputString, this.toolsLogger);
|
|
103
110
|
if (!this.jsonInput) {
|
|
104
|
-
this.
|
|
111
|
+
this.env.lookup({
|
|
112
|
+
packagePatterns: ['@sap/generator-fiori', '@sap-ux/adp-flp-config-sub-generator']
|
|
113
|
+
});
|
|
114
|
+
(0, opts_1.setHeaderTitle)(opts, this.logger);
|
|
115
|
+
(0, appWizardCache_1.initCache)(this.logger, this.appWizard);
|
|
116
|
+
this.prompts = new yeoman_ui_types_1.Prompts([]);
|
|
117
|
+
this.setPromptsCallback = (fn) => {
|
|
118
|
+
if (this.prompts) {
|
|
119
|
+
this.prompts.setCallback(fn);
|
|
120
|
+
}
|
|
121
|
+
};
|
|
105
122
|
}
|
|
106
123
|
}
|
|
107
124
|
async initializing() {
|
|
@@ -110,12 +127,8 @@ class default_1 extends yeoman_generator_1.default {
|
|
|
110
127
|
this.isCustomerBase = this.layer === "CUSTOMER_BASE" /* FlexLayer.CUSTOMER_BASE */;
|
|
111
128
|
this.systemLookup = new adp_tooling_1.SystemLookup(this.toolsLogger);
|
|
112
129
|
if (!this.jsonInput) {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
{ name: (0, i18n_1.t)('yuiNavSteps.projectAttributesName'), description: (0, i18n_1.t)('yuiNavSteps.projectAttributesDescr') }
|
|
116
|
-
];
|
|
117
|
-
this.prompts.splice(0, 0, pages);
|
|
118
|
-
this.prompter = new configuration_1.ConfigPrompter(this.systemLookup, this.layer, this.toolsLogger);
|
|
130
|
+
this.prompts.splice(0, 0, (0, steps_1.getWizardPages)());
|
|
131
|
+
this.prompter = this._getOrCreatePrompter();
|
|
119
132
|
}
|
|
120
133
|
await fiori_generator_shared_1.TelemetryHelper.initTelemetrySettings({
|
|
121
134
|
consumerModule: {
|
|
@@ -136,6 +149,7 @@ class default_1 extends yeoman_generator_1.default {
|
|
|
136
149
|
systemValidationCli: { hide: !isCLI }
|
|
137
150
|
});
|
|
138
151
|
this.configAnswers = await this.prompt(configQuestions);
|
|
152
|
+
this.shouldCreateExtProject = !!this.configAnswers.shouldCreateExtProject;
|
|
139
153
|
this.logger.info(`System: ${this.configAnswers.system}`);
|
|
140
154
|
this.logger.info(`Application: ${JSON.stringify(this.configAnswers.application, null, 2)}`);
|
|
141
155
|
const { ui5Versions, systemVersion } = this.prompter.ui5;
|
|
@@ -143,25 +157,46 @@ class default_1 extends yeoman_generator_1.default {
|
|
|
143
157
|
ui5Versions,
|
|
144
158
|
isVersionDetected: !!systemVersion,
|
|
145
159
|
isCloudProject: this.prompter.isCloud,
|
|
146
|
-
layer: this.layer
|
|
160
|
+
layer: this.layer,
|
|
161
|
+
prompts: this.prompts
|
|
147
162
|
};
|
|
148
163
|
const defaultFolder = (0, fiori_generator_shared_1.getDefaultTargetFolder)(this.options.vscode) ?? process.cwd();
|
|
149
164
|
const options = {
|
|
150
165
|
targetFolder: { default: defaultFolder },
|
|
151
166
|
ui5ValidationCli: { hide: !isCLI },
|
|
152
|
-
enableTypeScript: { hide:
|
|
167
|
+
enableTypeScript: { hide: this.shouldCreateExtProject }
|
|
153
168
|
};
|
|
154
169
|
const attributesQuestions = (0, attributes_1.getPrompts)(this.destinationPath(), promptConfig, options);
|
|
155
170
|
this.attributeAnswers = await this.prompt(attributesQuestions);
|
|
156
171
|
this.logger.info(`Project Attributes: ${JSON.stringify(this.attributeAnswers, null, 2)}`);
|
|
172
|
+
if (this.attributeAnswers?.addFlpConfig) {
|
|
173
|
+
(0, subgenHelpers_1.addFlpGen)({
|
|
174
|
+
projectRootPath: this._getProjectPath(),
|
|
175
|
+
system: this.configAnswers.system,
|
|
176
|
+
manifest: this.prompter.manifest
|
|
177
|
+
}, this.composeWith.bind(this), this.logger, this.appWizard);
|
|
178
|
+
}
|
|
179
|
+
if (this.attributeAnswers.addDeployConfig) {
|
|
180
|
+
const client = (await this.systemLookup.getSystemByName(this.configAnswers.system))?.Client;
|
|
181
|
+
(0, subgenHelpers_1.addDeployGen)({
|
|
182
|
+
projectName: this.attributeAnswers.projectName,
|
|
183
|
+
targetFolder: this.attributeAnswers.targetFolder,
|
|
184
|
+
connectedSystem: this.configAnswers.system,
|
|
185
|
+
client
|
|
186
|
+
}, this.composeWith.bind(this), this.logger, this.appWizard);
|
|
187
|
+
}
|
|
157
188
|
}
|
|
158
189
|
async writing() {
|
|
159
|
-
if (this.jsonInput) {
|
|
160
|
-
await this._initFromJson();
|
|
161
|
-
}
|
|
162
190
|
try {
|
|
163
|
-
if (this.
|
|
164
|
-
await this.
|
|
191
|
+
if (this.jsonInput) {
|
|
192
|
+
await this._initFromJson();
|
|
193
|
+
}
|
|
194
|
+
if (this.shouldCreateExtProject) {
|
|
195
|
+
await (0, subgenHelpers_1.addExtProjectGen)({
|
|
196
|
+
configAnswers: this.configAnswers,
|
|
197
|
+
attributeAnswers: this.attributeAnswers,
|
|
198
|
+
systemLookup: this.systemLookup
|
|
199
|
+
}, this.composeWith.bind(this), this.logger, this.appWizard);
|
|
165
200
|
return;
|
|
166
201
|
}
|
|
167
202
|
const provider = this.jsonInput ? this.abapProvider : this.prompter.provider;
|
|
@@ -185,52 +220,60 @@ class default_1 extends yeoman_generator_1.default {
|
|
|
185
220
|
this.logger.error(`Writing phase failed: ${e}`);
|
|
186
221
|
throw new Error((0, i18n_1.t)('error.updatingApp'));
|
|
187
222
|
}
|
|
223
|
+
finally {
|
|
224
|
+
(0, appWizardCache_1.cacheClear)(this.appWizard, this.logger);
|
|
225
|
+
}
|
|
188
226
|
}
|
|
189
227
|
async install() {
|
|
228
|
+
if (!this.shouldInstallDeps || this.shouldCreateExtProject) {
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
190
231
|
try {
|
|
191
|
-
|
|
192
|
-
await (0, deps_1.installDependencies)(this._getProjectPath());
|
|
193
|
-
}
|
|
232
|
+
await (0, deps_1.installDependencies)(this._getProjectPath());
|
|
194
233
|
}
|
|
195
234
|
catch (e) {
|
|
196
235
|
this.logger.error(`Installation of dependencies failed: ${e.message}`);
|
|
197
236
|
}
|
|
237
|
+
finally {
|
|
238
|
+
(0, appWizardCache_1.cacheClear)(this.appWizard, this.logger);
|
|
239
|
+
}
|
|
198
240
|
}
|
|
199
241
|
end() {
|
|
200
242
|
const telemetryData = fiori_generator_shared_1.TelemetryHelper.createTelemetryData({
|
|
201
243
|
appType: 'generator-adp',
|
|
202
244
|
...this.options.telemetryData
|
|
203
245
|
}) ?? {};
|
|
246
|
+
const projectPath = this._getProjectPath();
|
|
204
247
|
if (telemetryData) {
|
|
205
|
-
(0, fiori_generator_shared_1.sendTelemetry)(telemetryEvents_1.EventName.ADAPTATION_PROJECT_CREATED, telemetryData,
|
|
248
|
+
(0, fiori_generator_shared_1.sendTelemetry)(telemetryEvents_1.EventName.ADAPTATION_PROJECT_CREATED, telemetryData, projectPath).catch((error) => {
|
|
206
249
|
this.logger.error((0, i18n_1.t)('error.telemetry', { error }));
|
|
207
250
|
});
|
|
208
251
|
}
|
|
209
252
|
try {
|
|
210
|
-
|
|
253
|
+
if (!(0, adp_tooling_1.isCFEnvironment)(projectPath)) {
|
|
254
|
+
this.vscode?.commands?.executeCommand?.('sap.ux.application.info', { fsPath: projectPath });
|
|
255
|
+
}
|
|
211
256
|
}
|
|
212
257
|
catch (e) {
|
|
213
258
|
this.appWizard.showError(e.message, yeoman_ui_types_1.MessageType.notification);
|
|
214
259
|
}
|
|
260
|
+
finally {
|
|
261
|
+
(0, appWizardCache_1.cacheClear)(this.appWizard, this.logger);
|
|
262
|
+
}
|
|
215
263
|
}
|
|
216
264
|
/**
|
|
217
|
-
*
|
|
265
|
+
* Retrieves the ConfigPrompter instance from cache if it exists, otherwise creates a new instance.
|
|
266
|
+
*
|
|
267
|
+
* @returns {ConfigPrompter} Cached config prompter if going back a page.
|
|
218
268
|
*/
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
this.composeWith(generator, {
|
|
224
|
-
arguments: [JSON.stringify(data)],
|
|
225
|
-
appWizard: this.appWizard
|
|
226
|
-
});
|
|
227
|
-
this.logger.info(`'@bas-dev/generator-extensibility-sub' was called.`);
|
|
228
|
-
}
|
|
229
|
-
catch (e) {
|
|
230
|
-
this.logger.info((0, i18n_1.t)('error.creatingExtensionProjectError'));
|
|
231
|
-
this.logger.error(e.message);
|
|
232
|
-
this.appWizard.showError(e.message, yeoman_ui_types_1.MessageType.notification);
|
|
269
|
+
_getOrCreatePrompter() {
|
|
270
|
+
const cached = (0, appWizardCache_1.cacheGet)(this.appWizard, 'prompter', this.logger);
|
|
271
|
+
if (cached) {
|
|
272
|
+
return cached;
|
|
233
273
|
}
|
|
274
|
+
const prompter = new configuration_1.ConfigPrompter(this.systemLookup, this.layer, this.toolsLogger);
|
|
275
|
+
(0, appWizardCache_1.cachePut)(this.appWizard, { prompter }, this.logger);
|
|
276
|
+
return prompter;
|
|
234
277
|
}
|
|
235
278
|
/**
|
|
236
279
|
* Combines the target folder and project name.
|
|
@@ -240,17 +283,6 @@ class default_1 extends yeoman_generator_1.default {
|
|
|
240
283
|
_getProjectPath() {
|
|
241
284
|
return (0, path_1.join)(this.attributeAnswers.targetFolder, this.attributeAnswers.projectName);
|
|
242
285
|
}
|
|
243
|
-
/**
|
|
244
|
-
* Sets up the prompts for the generator.
|
|
245
|
-
*/
|
|
246
|
-
_setupPrompts() {
|
|
247
|
-
this.prompts = new yeoman_ui_types_1.Prompts([]);
|
|
248
|
-
this.setPromptsCallback = (fn) => {
|
|
249
|
-
if (this.prompts) {
|
|
250
|
-
this.prompts.setCallback(fn);
|
|
251
|
-
}
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
286
|
/**
|
|
255
287
|
* Configures logging for the generator.
|
|
256
288
|
*/
|
|
@@ -272,7 +304,7 @@ class default_1 extends yeoman_generator_1.default {
|
|
|
272
304
|
namespace,
|
|
273
305
|
system
|
|
274
306
|
});
|
|
275
|
-
this.publicVersions = await (0, adp_tooling_1.fetchPublicVersions)();
|
|
307
|
+
this.publicVersions = await (0, adp_tooling_1.fetchPublicVersions)(this.toolsLogger);
|
|
276
308
|
const providerOptions = {
|
|
277
309
|
system,
|
|
278
310
|
client,
|
package/generators/app/layer.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.isInternalUsage = isInternalUsage;
|
|
4
|
+
exports.getFlexLayer = getFlexLayer;
|
|
4
5
|
const btp_utils_1 = require("@sap-ux/btp-utils");
|
|
5
6
|
const feature_toggle_node_1 = require("@sap-devx/feature-toggle-node");
|
|
6
7
|
/**
|
|
@@ -14,7 +15,6 @@ async function isInternalUsage() {
|
|
|
14
15
|
}
|
|
15
16
|
return false;
|
|
16
17
|
}
|
|
17
|
-
exports.isInternalUsage = isInternalUsage;
|
|
18
18
|
/**
|
|
19
19
|
* Determines and returns the appropriate FlexLayer based on internal usage.
|
|
20
20
|
*
|
|
@@ -24,5 +24,4 @@ async function getFlexLayer() {
|
|
|
24
24
|
const internal = await isInternalUsage();
|
|
25
25
|
return internal ? "VENDOR" /* FlexLayer.VENDOR */ : "CUSTOMER_BASE" /* FlexLayer.CUSTOMER_BASE */;
|
|
26
26
|
}
|
|
27
|
-
exports.getFlexLayer = getFlexLayer;
|
|
28
27
|
//# sourceMappingURL=layer.js.map
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { type Prompts as YeomanUiSteps } from '@sap-devx/yeoman-ui-types';
|
|
1
2
|
import { FlexLayer } from '@sap-ux/adp-tooling';
|
|
2
|
-
import type { AttributesQuestion, AttributePromptOptions } from '../types';
|
|
3
|
+
import type { AttributesQuestion, AttributePromptOptions, AddDeployConfigPromptOptions, AddFlpConfigPromptOptions } from '../types';
|
|
3
4
|
interface Config {
|
|
4
5
|
isCloudProject: boolean;
|
|
5
6
|
layer: FlexLayer;
|
|
6
7
|
ui5Versions: string[];
|
|
7
8
|
isVersionDetected: boolean;
|
|
9
|
+
prompts: YeomanUiSteps;
|
|
8
10
|
}
|
|
9
11
|
/**
|
|
10
12
|
* Returns all project attribute prompts, filtering based on promptOptions.
|
|
@@ -15,5 +17,22 @@ interface Config {
|
|
|
15
17
|
* @returns {AttributesQuestion[]} An array of prompt objects for basic info input.
|
|
16
18
|
*/
|
|
17
19
|
export declare function getPrompts(path: string, config: Config, promptOptions?: AttributePromptOptions): AttributesQuestion[];
|
|
20
|
+
/**
|
|
21
|
+
* Creates the Add Deployment Config confirm prompt.
|
|
22
|
+
*
|
|
23
|
+
* @param {YeomanUiSteps} prompts - The Yeoman UI pages.
|
|
24
|
+
* @param {AddDeployConfigPromptOptions} [_] - Optional prompt options to control visibility.
|
|
25
|
+
* @returns {AttributesQuestion} The prompt configuration for Add Deployment config confirmation.
|
|
26
|
+
*/
|
|
27
|
+
export declare function getAddDeployConfigPrompt(prompts: YeomanUiSteps, _?: AddDeployConfigPromptOptions): AttributesQuestion;
|
|
28
|
+
/**
|
|
29
|
+
* Creates the Add FLP Config confirm prompt.
|
|
30
|
+
*
|
|
31
|
+
* @param {YeomanUiSteps} prompts - The Yeoman UI pages.
|
|
32
|
+
* @param {boolean} isCloudProject - Whether the project is for a cloud-based system.
|
|
33
|
+
* @param {AddFlpConfigPromptOptions} [_] - Optional prompt options to control visibility.
|
|
34
|
+
* @returns {AttributesQuestion} The prompt configuration for Add FLP config confirmation.
|
|
35
|
+
*/
|
|
36
|
+
export declare function getFlpConfigPrompt(prompts: YeomanUiSteps, isCloudProject: boolean, _?: AddFlpConfigPromptOptions): AttributesQuestion;
|
|
18
37
|
export {};
|
|
19
38
|
//# sourceMappingURL=attributes.d.ts.map
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getPrompts =
|
|
3
|
+
exports.getPrompts = getPrompts;
|
|
4
|
+
exports.getAddDeployConfigPrompt = getAddDeployConfigPrompt;
|
|
5
|
+
exports.getFlpConfigPrompt = getFlpConfigPrompt;
|
|
4
6
|
const adp_tooling_1 = require("@sap-ux/adp-tooling");
|
|
5
7
|
const project_input_validator_1 = require("@sap-ux/project-input-validator");
|
|
6
8
|
const i18n_1 = require("../../utils/i18n");
|
|
7
9
|
const types_1 = require("../types");
|
|
8
10
|
const tooltip_1 = require("./helper/tooltip");
|
|
9
|
-
const default_values_1 = require("./helper/default-values");
|
|
10
11
|
const additional_messages_1 = require("./helper/additional-messages");
|
|
12
|
+
const steps_1 = require("../../utils/steps");
|
|
13
|
+
const default_values_1 = require("./helper/default-values");
|
|
11
14
|
/**
|
|
12
15
|
* Returns all project attribute prompts, filtering based on promptOptions.
|
|
13
16
|
*
|
|
@@ -17,7 +20,7 @@ const additional_messages_1 = require("./helper/additional-messages");
|
|
|
17
20
|
* @returns {AttributesQuestion[]} An array of prompt objects for basic info input.
|
|
18
21
|
*/
|
|
19
22
|
function getPrompts(path, config, promptOptions) {
|
|
20
|
-
const { isVersionDetected, ui5Versions, isCloudProject, layer } = config;
|
|
23
|
+
const { isVersionDetected, ui5Versions, isCloudProject, layer, prompts } = config;
|
|
21
24
|
const isCustomerBase = layer === "CUSTOMER_BASE" /* FlexLayer.CUSTOMER_BASE */;
|
|
22
25
|
const keyedPrompts = {
|
|
23
26
|
[types_1.attributePromptNames.projectName]: getProjectNamePrompt(path, isCustomerBase, promptOptions?.[types_1.attributePromptNames.projectName]),
|
|
@@ -26,7 +29,9 @@ function getPrompts(path, config, promptOptions) {
|
|
|
26
29
|
[types_1.attributePromptNames.targetFolder]: getTargetFolderPrompt(promptOptions?.[types_1.attributePromptNames.targetFolder]),
|
|
27
30
|
[types_1.attributePromptNames.ui5Version]: getUi5VersionPrompt(ui5Versions, isVersionDetected, isCloudProject),
|
|
28
31
|
[types_1.attributePromptNames.ui5ValidationCli]: getUi5VersionValidationPromptForCli(),
|
|
29
|
-
[types_1.attributePromptNames.enableTypeScript]: getEnableTypeScriptPrompt(promptOptions?.[types_1.attributePromptNames.enableTypeScript])
|
|
32
|
+
[types_1.attributePromptNames.enableTypeScript]: getEnableTypeScriptPrompt(promptOptions?.[types_1.attributePromptNames.enableTypeScript]),
|
|
33
|
+
[types_1.attributePromptNames.addDeployConfig]: getAddDeployConfigPrompt(prompts, promptOptions?.[types_1.attributePromptNames.addDeployConfig]),
|
|
34
|
+
[types_1.attributePromptNames.addFlpConfig]: getFlpConfigPrompt(prompts, isCloudProject, promptOptions?.[types_1.attributePromptNames.addFlpConfig])
|
|
30
35
|
};
|
|
31
36
|
const questions = Object.entries(keyedPrompts)
|
|
32
37
|
.filter(([promptName]) => {
|
|
@@ -36,7 +41,6 @@ function getPrompts(path, config, promptOptions) {
|
|
|
36
41
|
.map(([_, question]) => question);
|
|
37
42
|
return questions;
|
|
38
43
|
}
|
|
39
|
-
exports.getPrompts = getPrompts;
|
|
40
44
|
/**
|
|
41
45
|
* Creates the project name input prompt.
|
|
42
46
|
*
|
|
@@ -195,4 +199,50 @@ function getEnableTypeScriptPrompt(_) {
|
|
|
195
199
|
}
|
|
196
200
|
};
|
|
197
201
|
}
|
|
202
|
+
/**
|
|
203
|
+
* Creates the Add Deployment Config confirm prompt.
|
|
204
|
+
*
|
|
205
|
+
* @param {YeomanUiSteps} prompts - The Yeoman UI pages.
|
|
206
|
+
* @param {AddDeployConfigPromptOptions} [_] - Optional prompt options to control visibility.
|
|
207
|
+
* @returns {AttributesQuestion} The prompt configuration for Add Deployment config confirmation.
|
|
208
|
+
*/
|
|
209
|
+
function getAddDeployConfigPrompt(prompts, _) {
|
|
210
|
+
return {
|
|
211
|
+
type: 'confirm',
|
|
212
|
+
name: types_1.attributePromptNames.addDeployConfig,
|
|
213
|
+
message: (0, i18n_1.t)('prompts.addDeployConfig'),
|
|
214
|
+
default: false,
|
|
215
|
+
guiOptions: {
|
|
216
|
+
breadcrumb: true
|
|
217
|
+
},
|
|
218
|
+
validate: (value) => {
|
|
219
|
+
(0, steps_1.updateWizardSteps)(prompts, (0, steps_1.getDeployPage)(), (0, i18n_1.t)('yuiNavSteps.projectAttributesName'), value);
|
|
220
|
+
return true;
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Creates the Add FLP Config confirm prompt.
|
|
226
|
+
*
|
|
227
|
+
* @param {YeomanUiSteps} prompts - The Yeoman UI pages.
|
|
228
|
+
* @param {boolean} isCloudProject - Whether the project is for a cloud-based system.
|
|
229
|
+
* @param {AddFlpConfigPromptOptions} [_] - Optional prompt options to control visibility.
|
|
230
|
+
* @returns {AttributesQuestion} The prompt configuration for Add FLP config confirmation.
|
|
231
|
+
*/
|
|
232
|
+
function getFlpConfigPrompt(prompts, isCloudProject, _) {
|
|
233
|
+
return {
|
|
234
|
+
type: 'confirm',
|
|
235
|
+
name: types_1.attributePromptNames.addFlpConfig,
|
|
236
|
+
message: (0, i18n_1.t)('prompts.addFlpConfig'),
|
|
237
|
+
default: false,
|
|
238
|
+
guiOptions: {
|
|
239
|
+
breadcrumb: true
|
|
240
|
+
},
|
|
241
|
+
when: () => isCloudProject,
|
|
242
|
+
validate: (value) => {
|
|
243
|
+
(0, steps_1.updateWizardSteps)(prompts, (0, steps_1.getFlpPage)(), (0, i18n_1.t)('yuiNavSteps.deployConfigName'), value);
|
|
244
|
+
return true;
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
}
|
|
198
248
|
//# sourceMappingURL=attributes.js.map
|
|
@@ -527,7 +527,7 @@ class ConfigPrompter {
|
|
|
527
527
|
async loadUI5Versions() {
|
|
528
528
|
const version = await (0, adp_tooling_1.getSystemUI5Version)(this.abapProvider);
|
|
529
529
|
this.systemVersion = (0, adp_tooling_1.checkSystemVersionPattern)(version);
|
|
530
|
-
this.publicVersions = await (0, adp_tooling_1.fetchPublicVersions)();
|
|
530
|
+
this.publicVersions = await (0, adp_tooling_1.fetchPublicVersions)(this.logger);
|
|
531
531
|
this.ui5Versions = await (0, adp_tooling_1.getRelevantVersions)(this.systemVersion, this.isCustomerBase, this.publicVersions);
|
|
532
532
|
}
|
|
533
533
|
/**
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.showCredentialQuestion = showCredentialQuestion;
|
|
4
|
+
exports.showApplicationQuestion = showApplicationQuestion;
|
|
5
|
+
exports.showExtensionProjectQuestion = showExtensionProjectQuestion;
|
|
6
|
+
exports.showInternalQuestions = showInternalQuestions;
|
|
4
7
|
const btp_utils_1 = require("@sap-ux/btp-utils");
|
|
5
8
|
/**
|
|
6
9
|
* Determines if a credential question should be shown.
|
|
@@ -13,7 +16,6 @@ const btp_utils_1 = require("@sap-ux/btp-utils");
|
|
|
13
16
|
function showCredentialQuestion(answers, isAuthRequired) {
|
|
14
17
|
return !!answers.system && isAuthRequired;
|
|
15
18
|
}
|
|
16
|
-
exports.showCredentialQuestion = showCredentialQuestion;
|
|
17
19
|
/**
|
|
18
20
|
* Determines if an application question should be shown.
|
|
19
21
|
*
|
|
@@ -26,7 +28,6 @@ exports.showCredentialQuestion = showCredentialQuestion;
|
|
|
26
28
|
function showApplicationQuestion(answers, appsLoaded, isAuthRequired, isLoginSuccessful) {
|
|
27
29
|
return !!answers.system && appsLoaded && (isAuthRequired ? isLoginSuccessful : true);
|
|
28
30
|
}
|
|
29
|
-
exports.showApplicationQuestion = showApplicationQuestion;
|
|
30
31
|
/**
|
|
31
32
|
* Determines if an extension project is allowed based on the system and application conditions.
|
|
32
33
|
*
|
|
@@ -49,7 +50,6 @@ function showExtensionProjectQuestion(answers, flexUISystem, isCloudProject, isA
|
|
|
49
50
|
return (isOnPremiseAppStudio &&
|
|
50
51
|
(!isApplicationSupported || (isApplicationSupported && (nonFlexOrNonOnPremise || hasSyncViews))));
|
|
51
52
|
}
|
|
52
|
-
exports.showExtensionProjectQuestion = showExtensionProjectQuestion;
|
|
53
53
|
/**
|
|
54
54
|
* Determines if an internal question for ACH and FioriId will be shown based on the answers and specific conditions.
|
|
55
55
|
*
|
|
@@ -61,5 +61,4 @@ exports.showExtensionProjectQuestion = showExtensionProjectQuestion;
|
|
|
61
61
|
function showInternalQuestions(answers, isCustomerBase, isApplicationSupported) {
|
|
62
62
|
return !!answers.system && answers.application && !isCustomerBase && isApplicationSupported;
|
|
63
63
|
}
|
|
64
|
-
exports.showInternalQuestions = showInternalQuestions;
|
|
65
64
|
//# sourceMappingURL=conditions.js.map
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getDefaultNamespace = getDefaultNamespace;
|
|
4
|
+
exports.getDefaultProjectName = getDefaultProjectName;
|
|
5
|
+
exports.getDefaultVersion = getDefaultVersion;
|
|
4
6
|
const path_1 = require("path");
|
|
5
7
|
const fs_1 = require("fs");
|
|
6
8
|
const adp_tooling_1 = require("@sap-ux/adp-tooling");
|
|
@@ -15,7 +17,6 @@ const DEFAULT_PREFIX = 'app.variant';
|
|
|
15
17
|
function getDefaultNamespace(projectName, isCustomerBase) {
|
|
16
18
|
return isCustomerBase ? `customer.${projectName}` : projectName;
|
|
17
19
|
}
|
|
18
|
-
exports.getDefaultNamespace = getDefaultNamespace;
|
|
19
20
|
/**
|
|
20
21
|
* Generates a default project name based on the existing projects in the specified directory.
|
|
21
22
|
*
|
|
@@ -32,7 +33,6 @@ function getDefaultProjectName(basePath, dirName = DEFAULT_PREFIX) {
|
|
|
32
33
|
}
|
|
33
34
|
return newDir;
|
|
34
35
|
}
|
|
35
|
-
exports.getDefaultProjectName = getDefaultProjectName;
|
|
36
36
|
/**
|
|
37
37
|
* Gets the default UI5 version from the system versions list by validating the first available version.
|
|
38
38
|
* If the first version is valid according to the UI5 service, it returns that version; otherwise, returns an empty string.
|
|
@@ -47,5 +47,4 @@ async function getDefaultVersion(ui5Versions) {
|
|
|
47
47
|
const isValid = await (0, adp_tooling_1.validateUI5VersionExists)(ui5Versions[0]);
|
|
48
48
|
return isValid === true ? ui5Versions[0] : '';
|
|
49
49
|
}
|
|
50
|
-
exports.getDefaultVersion = getDefaultVersion;
|
|
51
50
|
//# sourceMappingURL=default-values.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getProjectNameTooltip =
|
|
3
|
+
exports.getProjectNameTooltip = getProjectNameTooltip;
|
|
4
4
|
const i18n_1 = require("../../../utils/i18n");
|
|
5
5
|
/**
|
|
6
6
|
* Returns a tooltip message for project name input fields, customized based on the project's user layer.
|
|
@@ -14,5 +14,4 @@ function getProjectNameTooltip(isCustomerBase) {
|
|
|
14
14
|
const validationErrorMsg = (0, i18n_1.t)(`prompts.projectNameValidationError${baseType}`);
|
|
15
15
|
return `${lengthErrorMsg} ${validationErrorMsg}`;
|
|
16
16
|
}
|
|
17
|
-
exports.getProjectNameTooltip = getProjectNameTooltip;
|
|
18
17
|
//# sourceMappingURL=tooltip.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.validateExtensibilityGenerator = validateExtensibilityGenerator;
|
|
4
|
+
exports.validateJsonInput = validateJsonInput;
|
|
4
5
|
const project_input_validator_1 = require("@sap-ux/project-input-validator");
|
|
5
6
|
const i18n_1 = require("../../../utils/i18n");
|
|
6
7
|
const type_guards_1 = require("../../../utils/type-guards");
|
|
@@ -24,7 +25,6 @@ function validateExtensibilityGenerator(value, isApplicationSupported, hasSyncVi
|
|
|
24
25
|
}
|
|
25
26
|
return isApplicationSupported && hasSyncViews ? true : (0, i18n_1.t)('prompts.createExtProjectContinueLabel');
|
|
26
27
|
}
|
|
27
|
-
exports.validateExtensibilityGenerator = validateExtensibilityGenerator;
|
|
28
28
|
/**
|
|
29
29
|
* Validates the input parameters for an adaptation project configuration.
|
|
30
30
|
*
|
|
@@ -55,5 +55,4 @@ async function validateJsonInput(systemLookup, isCustomerBase, { projectName, ta
|
|
|
55
55
|
throw new Error((0, i18n_1.t)('error.systemNotFound', { system }));
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
exports.validateJsonInput = validateJsonInput;
|
|
59
58
|
//# sourceMappingURL=validators.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type Generator from 'yeoman-generator';
|
|
2
2
|
import type { AppWizard } from '@sap-devx/yeoman-ui-types';
|
|
3
|
-
import type { AttributesAnswers, ConfigAnswers } from '@sap-ux/adp-tooling';
|
|
4
3
|
import type { YUIQuestion } from '@sap-ux/inquirer-common';
|
|
5
4
|
import type { TelemetryData } from '@sap-ux/fiori-generator-shared';
|
|
5
|
+
import type { AttributesAnswers, ConfigAnswers } from '@sap-ux/adp-tooling';
|
|
6
6
|
export interface AdpGeneratorOptions extends Generator.GeneratorOptions {
|
|
7
7
|
/**
|
|
8
8
|
* VSCode instance
|
|
@@ -93,7 +93,9 @@ export declare enum attributePromptNames {
|
|
|
93
93
|
targetFolder = "targetFolder",
|
|
94
94
|
ui5Version = "ui5Version",
|
|
95
95
|
ui5ValidationCli = "ui5ValidationCli",
|
|
96
|
-
enableTypeScript = "enableTypeScript"
|
|
96
|
+
enableTypeScript = "enableTypeScript",
|
|
97
|
+
addDeployConfig = "addDeployConfig",
|
|
98
|
+
addFlpConfig = "addFlpConfig"
|
|
97
99
|
}
|
|
98
100
|
export type AttributesQuestion = YUIQuestion<AttributesAnswers>;
|
|
99
101
|
export interface ProjectNamePromptOptions {
|
|
@@ -109,6 +111,7 @@ export interface NamespacePromptOptions {
|
|
|
109
111
|
}
|
|
110
112
|
export interface TargetFolderPromptOptions {
|
|
111
113
|
default?: string;
|
|
114
|
+
hide?: boolean;
|
|
112
115
|
}
|
|
113
116
|
export interface UI5VersionPromptOptions {
|
|
114
117
|
default?: string;
|
|
@@ -116,6 +119,12 @@ export interface UI5VersionPromptOptions {
|
|
|
116
119
|
export interface EnableTypeScriptPromptOptions {
|
|
117
120
|
hide?: boolean;
|
|
118
121
|
}
|
|
122
|
+
export interface AddDeployConfigPromptOptions {
|
|
123
|
+
hide?: boolean;
|
|
124
|
+
}
|
|
125
|
+
export interface AddFlpConfigPromptOptions {
|
|
126
|
+
hide?: boolean;
|
|
127
|
+
}
|
|
119
128
|
export type AttributePromptOptions = Partial<{
|
|
120
129
|
[attributePromptNames.projectName]: ProjectNamePromptOptions;
|
|
121
130
|
[attributePromptNames.title]: ApplicationTitlePromptOptions;
|
|
@@ -124,6 +133,8 @@ export type AttributePromptOptions = Partial<{
|
|
|
124
133
|
[attributePromptNames.ui5Version]: UI5VersionPromptOptions;
|
|
125
134
|
[attributePromptNames.ui5ValidationCli]: CliValidationPromptOptions;
|
|
126
135
|
[attributePromptNames.enableTypeScript]: EnableTypeScriptPromptOptions;
|
|
136
|
+
[attributePromptNames.addDeployConfig]: AddDeployConfigPromptOptions;
|
|
137
|
+
[attributePromptNames.addFlpConfig]: AddFlpConfigPromptOptions;
|
|
127
138
|
}>;
|
|
128
139
|
export interface ExtensionProjectData {
|
|
129
140
|
destination: {
|
package/generators/app/types.js
CHANGED
|
@@ -25,5 +25,7 @@ var attributePromptNames;
|
|
|
25
25
|
attributePromptNames["ui5Version"] = "ui5Version";
|
|
26
26
|
attributePromptNames["ui5ValidationCli"] = "ui5ValidationCli";
|
|
27
27
|
attributePromptNames["enableTypeScript"] = "enableTypeScript";
|
|
28
|
+
attributePromptNames["addDeployConfig"] = "addDeployConfig";
|
|
29
|
+
attributePromptNames["addFlpConfig"] = "addFlpConfig";
|
|
28
30
|
})(attributePromptNames || (exports.attributePromptNames = attributePromptNames = {}));
|
|
29
31
|
//# sourceMappingURL=types.js.map
|
|
@@ -3,7 +3,11 @@
|
|
|
3
3
|
"configurationName": "System and Application Selection",
|
|
4
4
|
"configurationDescr": "Configure the system and select an application.",
|
|
5
5
|
"projectAttributesName": "Project Attributes",
|
|
6
|
-
"projectAttributesDescr": "Configure the main project attributes."
|
|
6
|
+
"projectAttributesDescr": "Configure the main project attributes.",
|
|
7
|
+
"flpConfigName": "SAP Fiori Launchpad Configuration",
|
|
8
|
+
"flpConfigDescr": "Configure SAP Fiori launchpad settings for {{- projectName}}.",
|
|
9
|
+
"deployConfigName": "Deployment Configuration",
|
|
10
|
+
"deployConfigDescr": "Configure deployment settings."
|
|
7
11
|
},
|
|
8
12
|
"prompts": {
|
|
9
13
|
"systemLabel": "System",
|
|
@@ -33,6 +37,8 @@
|
|
|
33
37
|
"projectFolderPath": "Project Path",
|
|
34
38
|
"ui5VersionLabel": "SAPUI5 Version",
|
|
35
39
|
"ui5VersionTooltip": "Select the SAPUI5 version you want to use to preview your app variant.",
|
|
40
|
+
"addDeployConfig": "Add Deployment Configuration",
|
|
41
|
+
"addFlpConfig": "Add SAP Fiori Launchpad Configuration",
|
|
36
42
|
"appInfoLabel": "Synchronous views are detected for this application. Therefore, the controller extensions are not supported. Controller extension functionality on these views will be disabled.",
|
|
37
43
|
"notSupportedAdpOverAdpLabel": "You have selected 'Adaptation Project' as the base. The selected system has a SAPUI5 version lower than 1.90. Therefore, it does not support 'Adaptation Project' as а base for a new adaptation project. You will be able to create such а project, but after deployment it will not work until the SAPUI5 version of the system is updated.",
|
|
38
44
|
"isPartiallySupportedAdpOverAdpLabel": "You have selected 'Adaptation Project' as the base. The selected system has a SAPUI5 version lower than 1.96 and in order for your adaptation project based on adaptation project to work after deployment, you will need to apply SAP Note 756 SP0 on your system.",
|