@sap-ux/generator-adp 1.0.8 → 1.0.10
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/add-annotations-to-odata/index.js +20 -15
- package/generators/add-component-usages/index.js +21 -16
- package/generators/add-new-model/index.js +29 -24
- package/generators/app/extension-project/index.js +9 -6
- package/generators/app/index.js +135 -129
- package/generators/app/layer.js +8 -5
- package/generators/app/questions/attributes.js +65 -60
- package/generators/app/questions/cf-services.js +52 -48
- package/generators/app/questions/configuration.js +129 -125
- package/generators/app/questions/helper/additional-messages.js +36 -29
- package/generators/app/questions/helper/choices.js +25 -16
- package/generators/app/questions/helper/conditions.js +23 -14
- package/generators/app/questions/helper/default-values.js +13 -8
- package/generators/app/questions/helper/message.js +11 -7
- package/generators/app/questions/helper/tooltip.js +7 -4
- package/generators/app/questions/helper/validators.js +39 -29
- package/generators/app/questions/key-user.js +45 -40
- package/generators/app/questions/target-env.js +27 -22
- package/generators/app/types.js +16 -13
- package/generators/base/questions/credentials.js +18 -15
- package/generators/base/sub-gen-auth-base.js +30 -24
- package/generators/base/sub-gen-base.js +17 -11
- package/generators/change-data-source/index.js +13 -8
- package/generators/telemetry/collector.js +10 -6
- package/generators/telemetry/events.js +5 -2
- package/generators/telemetry/index.js +18 -2
- package/generators/types.js +5 -2
- package/generators/utils/appWizardCache.js +13 -7
- package/generators/utils/deps.d.ts +6 -0
- package/generators/utils/deps.js +52 -10
- package/generators/utils/i18n.js +20 -12
- package/generators/utils/logger.js +7 -4
- package/generators/utils/opts.js +6 -3
- package/generators/utils/parse-json-input.js +9 -5
- package/generators/utils/steps.js +48 -37
- package/generators/utils/subgenHelpers.js +14 -9
- package/generators/utils/templates.d.ts +4 -0
- package/generators/utils/templates.js +13 -7
- package/generators/utils/type-guards.js +6 -2
- package/generators/utils/workspace.js +13 -7
- package/package.json +6 -7
package/generators/app/index.js
CHANGED
|
@@ -1,41 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
7
|
+
const node_path_1 = require("node:path");
|
|
8
|
+
const yeoman_generator_1 = __importDefault(require("yeoman-generator"));
|
|
9
|
+
const uuid_1 = require("uuid");
|
|
10
|
+
const yeoman_ui_types_1 = require("@sap-devx/yeoman-ui-types");
|
|
11
|
+
const adp_tooling_1 = require("@sap-ux/adp-tooling");
|
|
12
|
+
const fiori_generator_shared_1 = require("@sap-ux/fiori-generator-shared");
|
|
13
|
+
const logger_1 = require("@sap-ux/logger");
|
|
14
|
+
const axios_extension_1 = require("@sap-ux/axios-extension");
|
|
15
|
+
const feature_toggle_1 = require("@sap-ux/feature-toggle");
|
|
16
|
+
const appWizardCache_js_1 = require("../utils/appWizardCache.js");
|
|
17
|
+
const deps_js_1 = require("../utils/deps.js");
|
|
18
|
+
const i18n_js_1 = require("../utils/i18n.js");
|
|
19
|
+
const logger_js_1 = __importDefault(require("../utils/logger.js"));
|
|
20
|
+
const opts_js_1 = require("../utils/opts.js");
|
|
21
|
+
const parse_json_input_js_1 = require("../utils/parse-json-input.js");
|
|
22
|
+
const index_js_1 = require("../telemetry/index.js");
|
|
23
|
+
const steps_js_1 = require("../utils/steps.js");
|
|
24
|
+
const subgenHelpers_js_1 = require("../utils/subgenHelpers.js");
|
|
25
|
+
const templates_js_1 = require("../utils/templates.js");
|
|
26
|
+
const workspace_js_1 = require("../utils/workspace.js");
|
|
27
|
+
const layer_js_1 = require("./layer.js");
|
|
28
|
+
const attributes_js_1 = require("./questions/attributes.js");
|
|
29
|
+
const cf_services_js_1 = require("./questions/cf-services.js");
|
|
30
|
+
const configuration_js_1 = require("./questions/configuration.js");
|
|
31
|
+
const default_values_js_1 = require("./questions/helper/default-values.js");
|
|
32
|
+
const validators_js_1 = require("./questions/helper/validators.js");
|
|
33
|
+
const types_js_1 = require("./types.js");
|
|
34
|
+
const target_env_js_1 = require("./questions/target-env.js");
|
|
35
|
+
const key_user_js_1 = require("./questions/key-user.js");
|
|
36
|
+
const telemetry_1 = require("@sap-ux/telemetry");
|
|
32
37
|
const generatorTitle = 'Adaptation Project';
|
|
33
38
|
/**
|
|
34
39
|
* Generator for creating an Adaptation Project.
|
|
35
40
|
*
|
|
36
41
|
* @extends Generator
|
|
37
42
|
*/
|
|
38
|
-
|
|
43
|
+
class default_1 extends yeoman_generator_1.default {
|
|
39
44
|
setPromptsCallback;
|
|
40
45
|
appWizard;
|
|
41
46
|
vscode;
|
|
@@ -158,24 +163,24 @@ export default class extends Generator {
|
|
|
158
163
|
*/
|
|
159
164
|
constructor(args, opts) {
|
|
160
165
|
super(args, opts);
|
|
161
|
-
this.appWizard = opts.appWizard ?? AppWizard.create(opts);
|
|
166
|
+
this.appWizard = opts.appWizard ?? yeoman_ui_types_1.AppWizard.create(opts);
|
|
162
167
|
this.shouldInstallDeps = opts.shouldInstallDeps ?? true;
|
|
163
|
-
this.toolsLogger = new ToolsLogger();
|
|
168
|
+
this.toolsLogger = new logger_1.ToolsLogger();
|
|
164
169
|
this.vscode = opts.vscode;
|
|
165
170
|
this._setupLogging();
|
|
166
171
|
this.options = opts;
|
|
167
|
-
this.isMtaYamlFound = isMtaProject(process.cwd());
|
|
168
|
-
this.isCfFeatureEnabled = isFeatureEnabled('sap.ux.appGenerator.testBetaFeatures.adpCfExperimental');
|
|
172
|
+
this.isMtaYamlFound = (0, adp_tooling_1.isMtaProject)(process.cwd());
|
|
173
|
+
this.isCfFeatureEnabled = (0, feature_toggle_1.isFeatureEnabled)('sap.ux.appGenerator.testBetaFeatures.adpCfExperimental');
|
|
169
174
|
this.logger.debug(`isCfFeatureEnabled: ${this.isCfFeatureEnabled}`);
|
|
170
|
-
const jsonInputString = getFirstArgAsString(args);
|
|
171
|
-
this.jsonInput = parseJsonInput(jsonInputString, this.logger);
|
|
175
|
+
const jsonInputString = (0, parse_json_input_js_1.getFirstArgAsString)(args);
|
|
176
|
+
this.jsonInput = (0, parse_json_input_js_1.parseJsonInput)(jsonInputString, this.logger);
|
|
172
177
|
if (!this.jsonInput) {
|
|
173
178
|
this.env.lookup({
|
|
174
179
|
packagePatterns: ['@sap/generator-fiori', '@bas-dev/generator-extensibility-sub']
|
|
175
180
|
});
|
|
176
|
-
setHeaderTitle(opts, this.logger, generatorTitle);
|
|
177
|
-
initCache(this.logger, this.appWizard);
|
|
178
|
-
this.prompts = new
|
|
181
|
+
(0, opts_js_1.setHeaderTitle)(opts, this.logger, generatorTitle);
|
|
182
|
+
(0, appWizardCache_js_1.initCache)(this.logger, this.appWizard);
|
|
183
|
+
this.prompts = new yeoman_ui_types_1.Prompts([]);
|
|
179
184
|
this.setPromptsCallback = (fn) => {
|
|
180
185
|
if (this.prompts) {
|
|
181
186
|
this.prompts.setCallback(fn);
|
|
@@ -185,18 +190,18 @@ export default class extends Generator {
|
|
|
185
190
|
}
|
|
186
191
|
async initializing() {
|
|
187
192
|
// Force the generator to overwrite existing files without additional prompting
|
|
188
|
-
setYeomanEnvConflicterForce(this.env, this.options.force);
|
|
189
|
-
await initI18n();
|
|
190
|
-
this.isCli = isCli();
|
|
191
|
-
this.layer = getFlexLayer();
|
|
192
|
-
this.isCustomerBase = this.layer === FlexLayer.CUSTOMER_BASE;
|
|
193
|
-
this.systemLookup = new SystemLookup(this.logger);
|
|
194
|
-
this.cfInstalled = await isCfInstalled(this.logger);
|
|
195
|
-
this.cfConfig = loadCfConfig(this.logger);
|
|
196
|
-
this.isCfLoggedIn = await isLoggedInCf(this.cfConfig, this.logger);
|
|
193
|
+
(0, fiori_generator_shared_1.setYeomanEnvConflicterForce)(this.env, this.options.force);
|
|
194
|
+
await (0, i18n_js_1.initI18n)();
|
|
195
|
+
this.isCli = (0, fiori_generator_shared_1.isCli)();
|
|
196
|
+
this.layer = (0, layer_js_1.getFlexLayer)();
|
|
197
|
+
this.isCustomerBase = this.layer === adp_tooling_1.FlexLayer.CUSTOMER_BASE;
|
|
198
|
+
this.systemLookup = new adp_tooling_1.SystemLookup(this.logger);
|
|
199
|
+
this.cfInstalled = await (0, adp_tooling_1.isCfInstalled)(this.logger);
|
|
200
|
+
this.cfConfig = (0, adp_tooling_1.loadCfConfig)(this.logger);
|
|
201
|
+
this.isCfLoggedIn = await (0, adp_tooling_1.isLoggedInCf)(this.cfConfig, this.logger);
|
|
197
202
|
this.logger.info(`isCfInstalled: ${this.cfInstalled}`);
|
|
198
|
-
const isInternalUsage = isInternalFeaturesSettingEnabled();
|
|
199
|
-
await initTelemetrySettings({
|
|
203
|
+
const isInternalUsage = (0, feature_toggle_1.isInternalFeaturesSettingEnabled)();
|
|
204
|
+
await (0, telemetry_1.initTelemetrySettings)({
|
|
200
205
|
consumerModule: {
|
|
201
206
|
name: '@sap/generator-fiori:generator-adp',
|
|
202
207
|
version: this.rootGeneratorVersion()
|
|
@@ -204,12 +209,12 @@ export default class extends Generator {
|
|
|
204
209
|
internalFeature: isInternalUsage,
|
|
205
210
|
watchTelemetrySettingStore: false
|
|
206
211
|
});
|
|
207
|
-
this.telemetryCollector = new TelemetryCollector();
|
|
212
|
+
this.telemetryCollector = new index_js_1.TelemetryCollector();
|
|
208
213
|
if (!this.jsonInput) {
|
|
209
214
|
const shouldShowTargetEnv = this.cfInstalled && this.isCfFeatureEnabled;
|
|
210
|
-
this.prompts.splice(0, 0, getWizardPages(shouldShowTargetEnv));
|
|
215
|
+
this.prompts.splice(0, 0, (0, steps_js_1.getWizardPages)(shouldShowTargetEnv));
|
|
211
216
|
this.prompter = this._getOrCreatePrompter();
|
|
212
|
-
this.cfPrompter = new CFServicesPrompter(isInternalUsage, this.isCfLoggedIn, this.logger);
|
|
217
|
+
this.cfPrompter = new cf_services_js_1.CFServicesPrompter(isInternalUsage, this.isCfLoggedIn, this.logger);
|
|
213
218
|
}
|
|
214
219
|
}
|
|
215
220
|
async prompting() {
|
|
@@ -221,10 +226,10 @@ export default class extends Generator {
|
|
|
221
226
|
await this._promptForCfEnvironment();
|
|
222
227
|
}
|
|
223
228
|
else {
|
|
224
|
-
const isExtensibilityExtInstalled = isExtensionInstalled(this.vscode, 'SAP.vscode-bas-extensibility');
|
|
229
|
+
const isExtensibilityExtInstalled = (0, fiori_generator_shared_1.isExtensionInstalled)(this.vscode, 'SAP.vscode-bas-extensibility');
|
|
225
230
|
const configQuestions = this.prompter.getPrompts({
|
|
226
231
|
projectType: {
|
|
227
|
-
default: AdaptationProjectType.CLOUD_READY
|
|
232
|
+
default: axios_extension_1.AdaptationProjectType.CLOUD_READY
|
|
228
233
|
},
|
|
229
234
|
projectTypeCli: { hide: !this.isCli },
|
|
230
235
|
projectTypeClassicLabel: { hide: this.isCli },
|
|
@@ -245,7 +250,7 @@ export default class extends Generator {
|
|
|
245
250
|
layer: this.layer,
|
|
246
251
|
prompts: this.prompts
|
|
247
252
|
};
|
|
248
|
-
const defaultFolder = getDefaultTargetFolder(this.options.vscode) ?? process.cwd();
|
|
253
|
+
const defaultFolder = (0, fiori_generator_shared_1.getDefaultTargetFolder)(this.options.vscode) ?? process.cwd();
|
|
249
254
|
const options = {
|
|
250
255
|
targetFolder: { default: defaultFolder, hide: this.shouldCreateExtProject },
|
|
251
256
|
ui5ValidationCli: { hide: !this.isCli },
|
|
@@ -257,12 +262,12 @@ export default class extends Generator {
|
|
|
257
262
|
addDeployConfig: { hide: this.shouldCreateExtProject || !this.isCustomerBase },
|
|
258
263
|
importKeyUserChanges: { hide: this.shouldCreateExtProject }
|
|
259
264
|
};
|
|
260
|
-
const attributesQuestions = getPrompts(this.destinationPath(), optionalPromptsConfig, options);
|
|
265
|
+
const attributesQuestions = (0, attributes_js_1.getPrompts)(this.destinationPath(), optionalPromptsConfig, options);
|
|
261
266
|
this.attributeAnswers = await this.prompt(attributesQuestions);
|
|
262
267
|
// Steps need to be updated here to be available after back navigation in Yeoman UI.
|
|
263
268
|
this._updateWizardStepsAfterNavigation();
|
|
264
269
|
if (this.attributeAnswers.importKeyUserChanges) {
|
|
265
|
-
this.keyUserPrompter = new KeyUserImportPrompter(this.systemLookup, this.configAnswers.application.id, this.prompter.provider, this.configAnswers.system, this.logger);
|
|
270
|
+
this.keyUserPrompter = new key_user_js_1.KeyUserImportPrompter(this.systemLookup, this.configAnswers.application.id, this.prompter.provider, this.configAnswers.system, this.logger);
|
|
266
271
|
const keyUserQuestions = this.keyUserPrompter.getPrompts({
|
|
267
272
|
keyUserSystem: { default: this.configAnswers.system }
|
|
268
273
|
});
|
|
@@ -271,7 +276,7 @@ export default class extends Generator {
|
|
|
271
276
|
this.logger.info(`Project Attributes: ${JSON.stringify(this.attributeAnswers, null, 2)}`);
|
|
272
277
|
if (this.attributeAnswers.addDeployConfig) {
|
|
273
278
|
const system = await this.systemLookup.getSystemByName(this.configAnswers.system);
|
|
274
|
-
await addDeployGen({
|
|
279
|
+
await (0, subgenHelpers_js_1.addDeployGen)({
|
|
275
280
|
projectName: this.attributeAnswers.projectName,
|
|
276
281
|
projectPath: this.attributeAnswers.targetFolder,
|
|
277
282
|
connectedSystem: this.configAnswers.system,
|
|
@@ -280,7 +285,7 @@ export default class extends Generator {
|
|
|
280
285
|
}, this.composeWith.bind(this), this.logger, this.appWizard);
|
|
281
286
|
}
|
|
282
287
|
if (this.attributeAnswers?.addFlpConfig) {
|
|
283
|
-
await addFlpGen({
|
|
288
|
+
await (0, subgenHelpers_js_1.addFlpGen)({
|
|
284
289
|
vscode: this.vscode,
|
|
285
290
|
projectRootPath: this._getProjectPath(),
|
|
286
291
|
inbounds: this.prompter.baseAppInbounds,
|
|
@@ -292,7 +297,7 @@ export default class extends Generator {
|
|
|
292
297
|
}
|
|
293
298
|
async writing() {
|
|
294
299
|
try {
|
|
295
|
-
this.toolsId =
|
|
300
|
+
this.toolsId = (0, uuid_1.v4)();
|
|
296
301
|
if (this.jsonInput) {
|
|
297
302
|
await this._initFromJson();
|
|
298
303
|
}
|
|
@@ -302,10 +307,10 @@ export default class extends Generator {
|
|
|
302
307
|
return;
|
|
303
308
|
}
|
|
304
309
|
if (this.configAnswers.storeCredentials) {
|
|
305
|
-
await storeCredentials(this.configAnswers, this.systemLookup, this.logger);
|
|
310
|
+
await (0, adp_tooling_1.storeCredentials)(this.configAnswers, this.systemLookup, this.logger);
|
|
306
311
|
}
|
|
307
312
|
if (this.shouldCreateExtProject) {
|
|
308
|
-
await addExtProjectGen({
|
|
313
|
+
await (0, subgenHelpers_js_1.addExtProjectGen)({
|
|
309
314
|
configAnswers: this.configAnswers,
|
|
310
315
|
attributeAnswers: this.attributeAnswers,
|
|
311
316
|
systemLookup: this.systemLookup
|
|
@@ -317,8 +322,8 @@ export default class extends Generator {
|
|
|
317
322
|
const manifest = this.jsonInput ? this.manifest : this.prompter.manifest;
|
|
318
323
|
const keyUserChanges = this.jsonInput ? this.jsonInput.keyUserChanges : this.keyUserPrompter?.changes;
|
|
319
324
|
const projectType = this._getProjectType();
|
|
320
|
-
const packageJson = getPackageInfo();
|
|
321
|
-
const config = await getConfig({
|
|
325
|
+
const packageJson = (0, deps_js_1.getPackageInfo)();
|
|
326
|
+
const config = await (0, adp_tooling_1.getConfig)({
|
|
322
327
|
provider,
|
|
323
328
|
configAnswers: this.configAnswers,
|
|
324
329
|
attributeAnswers: this.attributeAnswers,
|
|
@@ -333,16 +338,16 @@ export default class extends Generator {
|
|
|
333
338
|
keyUserChanges
|
|
334
339
|
});
|
|
335
340
|
if (config.options) {
|
|
336
|
-
config.options.templatePathOverwrite = getTemplatesOverwritePath();
|
|
341
|
+
config.options.templatePathOverwrite = (0, templates_js_1.getTemplatesOverwritePath)();
|
|
337
342
|
}
|
|
338
|
-
await generate(this._getProjectPath(), config, this.fs);
|
|
343
|
+
await (0, adp_tooling_1.generate)(this._getProjectPath(), config, this.fs);
|
|
339
344
|
}
|
|
340
345
|
catch (e) {
|
|
341
346
|
this.logger.error(`Writing phase failed: ${e}`);
|
|
342
|
-
throw new Error(t('error.updatingApp'));
|
|
347
|
+
throw new Error((0, i18n_js_1.t)('error.updatingApp'));
|
|
343
348
|
}
|
|
344
349
|
finally {
|
|
345
|
-
cacheClear(this.appWizard, this.logger);
|
|
350
|
+
(0, appWizardCache_js_1.cacheClear)(this.appWizard, this.logger);
|
|
346
351
|
}
|
|
347
352
|
}
|
|
348
353
|
async install() {
|
|
@@ -350,7 +355,7 @@ export default class extends Generator {
|
|
|
350
355
|
return;
|
|
351
356
|
}
|
|
352
357
|
try {
|
|
353
|
-
await installDependencies(this._getProjectPath());
|
|
358
|
+
await (0, deps_js_1.installDependencies)(this._getProjectPath());
|
|
354
359
|
}
|
|
355
360
|
catch (e) {
|
|
356
361
|
this.logger.error(`Installation of dependencies failed: ${e.message}`);
|
|
@@ -358,15 +363,15 @@ export default class extends Generator {
|
|
|
358
363
|
}
|
|
359
364
|
async end() {
|
|
360
365
|
const projectPath = this._getProjectPath();
|
|
361
|
-
const data = TelemetryHelper.createTelemetryData({
|
|
366
|
+
const data = fiori_generator_shared_1.TelemetryHelper.createTelemetryData({
|
|
362
367
|
appType: 'generator-adp',
|
|
363
368
|
...this.options.telemetryData,
|
|
364
369
|
...this.telemetryCollector.telemetryData
|
|
365
370
|
});
|
|
366
371
|
if (data) {
|
|
367
|
-
sendTelemetry(EventName.ADAPTATION_PROJECT_CREATED, data, projectPath)
|
|
372
|
+
(0, fiori_generator_shared_1.sendTelemetry)(index_js_1.EventName.ADAPTATION_PROJECT_CREATED, data, projectPath)
|
|
368
373
|
.then(() => {
|
|
369
|
-
this.logger.log(`Event ${EventName.ADAPTATION_PROJECT_CREATED} successfully sent`);
|
|
374
|
+
this.logger.log(`Event ${index_js_1.EventName.ADAPTATION_PROJECT_CREATED} successfully sent`);
|
|
370
375
|
})
|
|
371
376
|
.catch((error) => {
|
|
372
377
|
this.logger.error(`Failed to send telemetry: ${error}`);
|
|
@@ -376,18 +381,18 @@ export default class extends Generator {
|
|
|
376
381
|
return;
|
|
377
382
|
}
|
|
378
383
|
try {
|
|
379
|
-
if (!existsInWorkspace(this.vscode, projectPath)) {
|
|
380
|
-
const userChoice = await showWorkspaceFolderWarning(this.vscode, projectPath);
|
|
384
|
+
if (!(0, workspace_js_1.existsInWorkspace)(this.vscode, projectPath)) {
|
|
385
|
+
const userChoice = await (0, workspace_js_1.showWorkspaceFolderWarning)(this.vscode, projectPath);
|
|
381
386
|
if (!userChoice) {
|
|
382
387
|
return;
|
|
383
388
|
}
|
|
384
|
-
await handleWorkspaceFolderChoice(this.vscode, projectPath, userChoice);
|
|
389
|
+
await (0, workspace_js_1.handleWorkspaceFolderChoice)(this.vscode, projectPath, userChoice);
|
|
385
390
|
return;
|
|
386
391
|
}
|
|
387
392
|
await this.vscode?.commands?.executeCommand?.('sap.ux.application.info', { fsPath: projectPath });
|
|
388
393
|
}
|
|
389
394
|
catch (e) {
|
|
390
|
-
this.appWizard.showError(e.message, MessageType.notification);
|
|
395
|
+
this.appWizard.showError(e.message, yeoman_ui_types_1.MessageType.notification);
|
|
391
396
|
}
|
|
392
397
|
}
|
|
393
398
|
/**
|
|
@@ -396,12 +401,12 @@ export default class extends Generator {
|
|
|
396
401
|
async _promptForCfProjectPath() {
|
|
397
402
|
if (this.isMtaYamlFound) {
|
|
398
403
|
const path = this.destinationRoot(process.cwd());
|
|
399
|
-
getYamlContent(join(path, 'mta.yaml'));
|
|
404
|
+
(0, adp_tooling_1.getYamlContent)((0, node_path_1.join)(path, 'mta.yaml'));
|
|
400
405
|
this.logger.log(`Project path information: ${path}`);
|
|
401
406
|
}
|
|
402
407
|
else {
|
|
403
|
-
const pathAnswers = await this.prompt([getProjectPathPrompt(this.logger, this.vscode)]);
|
|
404
|
-
const path = this.destinationRoot(
|
|
408
|
+
const pathAnswers = await this.prompt([(0, target_env_js_1.getProjectPathPrompt)(this.logger, this.vscode)]);
|
|
409
|
+
const path = this.destinationRoot(node_fs_1.default.realpathSync(pathAnswers.projectLocation, 'utf-8'));
|
|
405
410
|
this.logger.log(`Project path information: ${path}`);
|
|
406
411
|
}
|
|
407
412
|
}
|
|
@@ -421,15 +426,15 @@ export default class extends Generator {
|
|
|
421
426
|
}
|
|
422
427
|
else {
|
|
423
428
|
telemetryData.projectType =
|
|
424
|
-
this._getProjectType() === AdaptationProjectType.CLOUD_READY ? 'cloudReady' : 'onPremise';
|
|
429
|
+
this._getProjectType() === axios_extension_1.AdaptationProjectType.CLOUD_READY ? 'cloudReady' : 'onPremise';
|
|
425
430
|
telemetryData.baseAppTechnicalName = this.configAnswers?.application?.id ?? '';
|
|
426
431
|
}
|
|
427
432
|
if (this.jsonInput) {
|
|
428
|
-
telemetryData.ui5VersionSelected = getLatestVersion(this.publicVersions);
|
|
433
|
+
telemetryData.ui5VersionSelected = (0, adp_tooling_1.getLatestVersion)(this.publicVersions);
|
|
429
434
|
}
|
|
430
435
|
else {
|
|
431
|
-
const version = this.attributeAnswers?.ui5Version ?? getLatestVersion(this.prompter?.ui5?.publicVersions) ?? '';
|
|
432
|
-
telemetryData.ui5VersionSelected = getFormattedVersion(version);
|
|
436
|
+
const version = this.attributeAnswers?.ui5Version ?? (0, adp_tooling_1.getLatestVersion)(this.prompter?.ui5?.publicVersions) ?? '';
|
|
437
|
+
telemetryData.ui5VersionSelected = (0, adp_tooling_1.getFormattedVersion)(version);
|
|
433
438
|
}
|
|
434
439
|
telemetryData.systemUI5Version = this.prompter?.ui5?.systemVersion ?? '';
|
|
435
440
|
this.telemetryCollector.setBatch(telemetryData);
|
|
@@ -444,7 +449,7 @@ export default class extends Generator {
|
|
|
444
449
|
await this._promptForTargetEnvironment();
|
|
445
450
|
}
|
|
446
451
|
else {
|
|
447
|
-
this.targetEnv = TargetEnv.ABAP;
|
|
452
|
+
this.targetEnv = types_js_1.TargetEnv.ABAP;
|
|
448
453
|
}
|
|
449
454
|
}
|
|
450
455
|
/**
|
|
@@ -452,12 +457,12 @@ export default class extends Generator {
|
|
|
452
457
|
*/
|
|
453
458
|
async _promptForTargetEnvironment() {
|
|
454
459
|
const targetEnvAnswers = await this.prompt([
|
|
455
|
-
getTargetEnvPrompt(this.appWizard, this.cfInstalled, this.isCfLoggedIn, this.cfConfig)
|
|
460
|
+
(0, target_env_js_1.getTargetEnvPrompt)(this.appWizard, this.cfInstalled, this.isCfLoggedIn, this.cfConfig)
|
|
456
461
|
]);
|
|
457
462
|
this.targetEnv = targetEnvAnswers.targetEnv;
|
|
458
|
-
this.isCfEnv = this.targetEnv === TargetEnv.CF;
|
|
463
|
+
this.isCfEnv = this.targetEnv === types_js_1.TargetEnv.CF;
|
|
459
464
|
this.logger.info(`Target environment: ${this.targetEnv}`);
|
|
460
|
-
updateCfWizardSteps(this.isCfEnv, this.prompts);
|
|
465
|
+
(0, steps_js_1.updateCfWizardSteps)(this.isCfEnv, this.prompts);
|
|
461
466
|
this.logger.log(`Project organization information: ${JSON.stringify(this.cfConfig.org, null, 2)}`);
|
|
462
467
|
this.logger.log(`Project space information: ${JSON.stringify(this.cfConfig.space, null, 2)}`);
|
|
463
468
|
this.logger.log(`Project apiUrl information: ${JSON.stringify(this.cfConfig.url, null, 2)}`);
|
|
@@ -479,7 +484,7 @@ export default class extends Generator {
|
|
|
479
484
|
importKeyUserChanges: { hide: true }
|
|
480
485
|
};
|
|
481
486
|
const projectPath = this.destinationPath();
|
|
482
|
-
const attributesQuestions = getPrompts(projectPath, {
|
|
487
|
+
const attributesQuestions = (0, attributes_js_1.getPrompts)(projectPath, {
|
|
483
488
|
ui5Versions: [],
|
|
484
489
|
isVersionDetected: false,
|
|
485
490
|
layer: this.layer,
|
|
@@ -496,11 +501,11 @@ export default class extends Generator {
|
|
|
496
501
|
return;
|
|
497
502
|
}
|
|
498
503
|
try {
|
|
499
|
-
const cfInbounds = await getCfBaseAppInbounds(selectedApp.appId, selectedApp.appHostId, this.cfConfig, this.logger);
|
|
504
|
+
const cfInbounds = await (0, adp_tooling_1.getCfBaseAppInbounds)(selectedApp.appId, selectedApp.appHostId, this.cfConfig, this.logger);
|
|
500
505
|
// Register FLP wizard pages now that we know if inbounds are available
|
|
501
|
-
updateFlpWizardSteps(!!cfInbounds, this.prompts, this.attributeAnswers.projectName, true);
|
|
506
|
+
(0, steps_js_1.updateFlpWizardSteps)(!!cfInbounds, this.prompts, this.attributeAnswers.projectName, true);
|
|
502
507
|
if (cfInbounds) {
|
|
503
|
-
await addFlpGen({
|
|
508
|
+
await (0, subgenHelpers_js_1.addFlpGen)({
|
|
504
509
|
vscode: this.vscode,
|
|
505
510
|
projectRootPath: this._getProjectPath(),
|
|
506
511
|
inbounds: cfInbounds,
|
|
@@ -520,12 +525,12 @@ export default class extends Generator {
|
|
|
520
525
|
* @returns {ConfigPrompter} Cached config prompter if going back a page.
|
|
521
526
|
*/
|
|
522
527
|
_getOrCreatePrompter() {
|
|
523
|
-
const cached = cacheGet(this.appWizard, 'prompter', this.logger);
|
|
528
|
+
const cached = (0, appWizardCache_js_1.cacheGet)(this.appWizard, 'prompter', this.logger);
|
|
524
529
|
if (cached) {
|
|
525
530
|
return cached;
|
|
526
531
|
}
|
|
527
|
-
const prompter = new ConfigPrompter(this.systemLookup, this.layer, this.logger, this.telemetryCollector);
|
|
528
|
-
cachePut(this.appWizard, { prompter }, this.logger);
|
|
532
|
+
const prompter = new configuration_js_1.ConfigPrompter(this.systemLookup, this.layer, this.logger, this.telemetryCollector);
|
|
533
|
+
(0, appWizardCache_js_1.cachePut)(this.appWizard, { prompter }, this.logger);
|
|
529
534
|
return prompter;
|
|
530
535
|
}
|
|
531
536
|
/**
|
|
@@ -533,8 +538,8 @@ export default class extends Generator {
|
|
|
533
538
|
*/
|
|
534
539
|
async _generateAdpProjectArtifactsCF() {
|
|
535
540
|
const projectPath = this.destinationPath();
|
|
536
|
-
const publicVersions = await fetchPublicVersions(this.logger);
|
|
537
|
-
this.telemetryCollector.setBatch({ ui5VersionSelected: getLatestVersion(publicVersions) });
|
|
541
|
+
const publicVersions = await (0, adp_tooling_1.fetchPublicVersions)(this.logger);
|
|
542
|
+
this.telemetryCollector.setBatch({ ui5VersionSelected: (0, adp_tooling_1.getLatestVersion)(publicVersions) });
|
|
538
543
|
const manifest = this.cfPrompter.manifest;
|
|
539
544
|
if (!manifest) {
|
|
540
545
|
throw new Error('Manifest not found for base app.');
|
|
@@ -543,10 +548,10 @@ export default class extends Generator {
|
|
|
543
548
|
const serviceInstanceGuid = this.cfPrompter.serviceInstanceGuid;
|
|
544
549
|
const backendUrls = this.cfPrompter.backendUrls;
|
|
545
550
|
const oauthPaths = this.cfPrompter.oauthPaths;
|
|
546
|
-
const serviceInfo = await getOrCreateServiceInstanceKeys({
|
|
551
|
+
const serviceInfo = await (0, adp_tooling_1.getOrCreateServiceInstanceKeys)({
|
|
547
552
|
names: [this.cfServicesAnswers.businessService ?? '']
|
|
548
553
|
}, this.logger);
|
|
549
|
-
const config = getCfConfig({
|
|
554
|
+
const config = (0, adp_tooling_1.getCfConfig)({
|
|
550
555
|
attributeAnswers: this.attributeAnswers,
|
|
551
556
|
cfServicesAnswers: this.cfServicesAnswers,
|
|
552
557
|
cfConfig: this.cfConfig,
|
|
@@ -558,15 +563,15 @@ export default class extends Generator {
|
|
|
558
563
|
oauthPaths,
|
|
559
564
|
projectPath,
|
|
560
565
|
publicVersions,
|
|
561
|
-
packageJson: getPackageInfo(),
|
|
566
|
+
packageJson: (0, deps_js_1.getPackageInfo)(),
|
|
562
567
|
toolsId: this.toolsId,
|
|
563
568
|
serviceInfo,
|
|
564
569
|
spaceGuid: this.cfConfig.space.GUID
|
|
565
570
|
});
|
|
566
571
|
if (config.options) {
|
|
567
|
-
config.options.templatePathOverwrite = getTemplatesOverwritePath();
|
|
572
|
+
config.options.templatePathOverwrite = (0, templates_js_1.getTemplatesOverwritePath)();
|
|
568
573
|
}
|
|
569
|
-
await generateCf(projectPath, config, this.logger, this.fs);
|
|
574
|
+
await (0, adp_tooling_1.generateCf)(projectPath, config, this.logger, this.fs);
|
|
570
575
|
}
|
|
571
576
|
/**
|
|
572
577
|
* Combines the target folder and project name.
|
|
@@ -575,12 +580,12 @@ export default class extends Generator {
|
|
|
575
580
|
*/
|
|
576
581
|
_getProjectPath() {
|
|
577
582
|
if (this.isCfEnv) {
|
|
578
|
-
return join(this.destinationPath(), this.attributeAnswers.projectName);
|
|
583
|
+
return (0, node_path_1.join)(this.destinationPath(), this.attributeAnswers.projectName);
|
|
579
584
|
}
|
|
580
585
|
if (this.shouldCreateExtProject) {
|
|
581
|
-
return join(process.cwd(), this.attributeAnswers.projectName);
|
|
586
|
+
return (0, node_path_1.join)(process.cwd(), this.attributeAnswers.projectName);
|
|
582
587
|
}
|
|
583
|
-
return join(this.attributeAnswers.targetFolder, this.attributeAnswers.projectName);
|
|
588
|
+
return (0, node_path_1.join)(this.attributeAnswers.targetFolder, this.attributeAnswers.projectName);
|
|
584
589
|
}
|
|
585
590
|
/**
|
|
586
591
|
* Use this method to get the correct Adaptation project type, no matter how we start
|
|
@@ -595,8 +600,8 @@ export default class extends Generator {
|
|
|
595
600
|
* Configures logging for the generator.
|
|
596
601
|
*/
|
|
597
602
|
_setupLogging() {
|
|
598
|
-
|
|
599
|
-
this.logger =
|
|
603
|
+
logger_js_1.default.configureLogging(this.options.logger, this.rootGeneratorName(), this.log, this.options.vscode, this.options.logLevel, this.options.logWrapper);
|
|
604
|
+
this.logger = logger_js_1.default.logger;
|
|
600
605
|
}
|
|
601
606
|
/**
|
|
602
607
|
* Initialize the project generator from a json.
|
|
@@ -605,40 +610,40 @@ export default class extends Generator {
|
|
|
605
610
|
if (!this.jsonInput) {
|
|
606
611
|
return;
|
|
607
612
|
}
|
|
608
|
-
const { system, client, username = '', password = '', projectType, application: baseApplicationName, applicationTitle, targetFolder = '/home/user/projects', projectName = getDefaultProjectName(targetFolder, `${baseApplicationName}.variant`), namespace = getDefaultNamespace(projectName, this.isCustomerBase) } = this.jsonInput;
|
|
609
|
-
await validateJsonInput(this.systemLookup, this.isCustomerBase, {
|
|
613
|
+
const { system, client, username = '', password = '', projectType, application: baseApplicationName, applicationTitle, targetFolder = '/home/user/projects', projectName = (0, default_values_js_1.getDefaultProjectName)(targetFolder, `${baseApplicationName}.variant`), namespace = (0, default_values_js_1.getDefaultNamespace)(projectName, this.isCustomerBase) } = this.jsonInput;
|
|
614
|
+
await (0, validators_js_1.validateJsonInput)(this.systemLookup, this.isCustomerBase, {
|
|
610
615
|
projectName,
|
|
611
616
|
targetFolder,
|
|
612
617
|
namespace,
|
|
613
618
|
system
|
|
614
619
|
});
|
|
615
|
-
this.publicVersions = await fetchPublicVersions(this.logger);
|
|
620
|
+
this.publicVersions = await (0, adp_tooling_1.fetchPublicVersions)(this.logger);
|
|
616
621
|
const providerOptions = {
|
|
617
622
|
system,
|
|
618
623
|
client,
|
|
619
624
|
username,
|
|
620
625
|
password
|
|
621
626
|
};
|
|
622
|
-
this.abapProvider = await getConfiguredProvider(providerOptions, this.logger);
|
|
623
|
-
const supportedProject = await getSupportedProject(this.abapProvider);
|
|
624
|
-
let selectedProjectType = AdaptationProjectType.ON_PREMISE;
|
|
625
|
-
if (supportedProject === SupportedProject.CLOUD_READY_AND_ON_PREM) {
|
|
626
|
-
const isInternalUsage = isInternalFeaturesSettingEnabled();
|
|
627
|
+
this.abapProvider = await (0, adp_tooling_1.getConfiguredProvider)(providerOptions, this.logger);
|
|
628
|
+
const supportedProject = await (0, adp_tooling_1.getSupportedProject)(this.abapProvider);
|
|
629
|
+
let selectedProjectType = axios_extension_1.AdaptationProjectType.ON_PREMISE;
|
|
630
|
+
if (supportedProject === adp_tooling_1.SupportedProject.CLOUD_READY_AND_ON_PREM) {
|
|
631
|
+
const isInternalUsage = (0, feature_toggle_1.isInternalFeaturesSettingEnabled)();
|
|
627
632
|
selectedProjectType = isInternalUsage
|
|
628
|
-
? AdaptationProjectType.ON_PREMISE
|
|
629
|
-
: (projectType ?? AdaptationProjectType.CLOUD_READY);
|
|
633
|
+
? axios_extension_1.AdaptationProjectType.ON_PREMISE
|
|
634
|
+
: (projectType ?? axios_extension_1.AdaptationProjectType.CLOUD_READY);
|
|
630
635
|
}
|
|
631
|
-
else if (supportedProject === SupportedProject.CLOUD_READY) {
|
|
632
|
-
selectedProjectType = AdaptationProjectType.CLOUD_READY;
|
|
636
|
+
else if (supportedProject === adp_tooling_1.SupportedProject.CLOUD_READY) {
|
|
637
|
+
selectedProjectType = axios_extension_1.AdaptationProjectType.CLOUD_READY;
|
|
633
638
|
}
|
|
634
639
|
this.projectType = selectedProjectType;
|
|
635
|
-
const applications = await loadApps(this.abapProvider, this.isCustomerBase, supportedProject);
|
|
640
|
+
const applications = await (0, adp_tooling_1.loadApps)(this.abapProvider, this.isCustomerBase, supportedProject);
|
|
636
641
|
this.telemetryCollector.setBatch({ numberOfApplications: applications.length });
|
|
637
642
|
const application = applications.find((application) => application.id === baseApplicationName);
|
|
638
643
|
if (!application) {
|
|
639
|
-
throw new Error(t('error.applicationNotFound', { appName: baseApplicationName }));
|
|
644
|
+
throw new Error((0, i18n_js_1.t)('error.applicationNotFound', { appName: baseApplicationName }));
|
|
640
645
|
}
|
|
641
|
-
const sourceManifest = new SourceManifest(this.abapProvider, application.id);
|
|
646
|
+
const sourceManifest = new adp_tooling_1.SourceManifest(this.abapProvider, application.id);
|
|
642
647
|
this.manifest = await sourceManifest.getManifest();
|
|
643
648
|
this.configAnswers = {
|
|
644
649
|
system,
|
|
@@ -662,15 +667,16 @@ export default class extends Generator {
|
|
|
662
667
|
*/
|
|
663
668
|
_updateWizardStepsAfterNavigation() {
|
|
664
669
|
const pages = this.prompts['items'];
|
|
665
|
-
const flpPagesExist = pages.some((p) => p.name === t('yuiNavSteps.flpConfigName'));
|
|
666
|
-
const deployPageExists = pages.some((p) => p.name === t('yuiNavSteps.deployConfigName'));
|
|
670
|
+
const flpPagesExist = pages.some((p) => p.name === (0, i18n_js_1.t)('yuiNavSteps.flpConfigName'));
|
|
671
|
+
const deployPageExists = pages.some((p) => p.name === (0, i18n_js_1.t)('yuiNavSteps.deployConfigName'));
|
|
667
672
|
if (!deployPageExists) {
|
|
668
|
-
updateWizardSteps(this.prompts, getDeployPage(), t('yuiNavSteps.projectAttributesName'), this.attributeAnswers.addDeployConfig);
|
|
673
|
+
(0, steps_js_1.updateWizardSteps)(this.prompts, (0, steps_js_1.getDeployPage)(), (0, i18n_js_1.t)('yuiNavSteps.projectAttributesName'), this.attributeAnswers.addDeployConfig);
|
|
669
674
|
}
|
|
670
|
-
updateWizardSteps(this.prompts, getKeyUserImportPage(), t('yuiNavSteps.projectAttributesName'), !!this.attributeAnswers.importKeyUserChanges);
|
|
675
|
+
(0, steps_js_1.updateWizardSteps)(this.prompts, (0, steps_js_1.getKeyUserImportPage)(), (0, i18n_js_1.t)('yuiNavSteps.projectAttributesName'), !!this.attributeAnswers.importKeyUserChanges);
|
|
671
676
|
if (!flpPagesExist) {
|
|
672
|
-
updateFlpWizardSteps(!!this.prompter.baseAppInbounds, this.prompts, this.attributeAnswers.projectName, !!this.attributeAnswers.addFlpConfig);
|
|
677
|
+
(0, steps_js_1.updateFlpWizardSteps)(!!this.prompter.baseAppInbounds, this.prompts, this.attributeAnswers.projectName, !!this.attributeAnswers.addFlpConfig);
|
|
673
678
|
}
|
|
674
679
|
}
|
|
675
680
|
}
|
|
681
|
+
exports.default = default_1;
|
|
676
682
|
//# sourceMappingURL=index.js.map
|
package/generators/app/layer.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getFlexLayer = getFlexLayer;
|
|
4
|
+
const adp_tooling_1 = require("@sap-ux/adp-tooling");
|
|
5
|
+
const feature_toggle_1 = require("@sap-ux/feature-toggle");
|
|
3
6
|
/**
|
|
4
7
|
* Determines and returns the appropriate FlexLayer based on internal usage.
|
|
5
8
|
*
|
|
6
9
|
* @returns {FlexLayer} True if internal usage; otherwise, false.
|
|
7
10
|
*/
|
|
8
|
-
|
|
9
|
-
const internal = isInternalFeaturesSettingEnabled();
|
|
10
|
-
return internal ? FlexLayer.VENDOR : FlexLayer.CUSTOMER_BASE;
|
|
11
|
+
function getFlexLayer() {
|
|
12
|
+
const internal = (0, feature_toggle_1.isInternalFeaturesSettingEnabled)();
|
|
13
|
+
return internal ? adp_tooling_1.FlexLayer.VENDOR : adp_tooling_1.FlexLayer.CUSTOMER_BASE;
|
|
11
14
|
}
|
|
12
15
|
//# sourceMappingURL=layer.js.map
|