@sap-ux/fiori-app-sub-generator 0.1.0 → 0.2.1
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/fiori-app-generator/fioriAppGenerator.js +0 -1
- package/generators/fiori-app-generator/fioriAppGeneratorOptions.d.ts +3 -2
- package/generators/fiori-app-generator/prompting.d.ts +4 -6
- package/generators/fiori-app-generator/prompting.js +7 -14
- package/generators/types/external.d.ts +3 -22
- package/package.json +14 -14
|
@@ -174,7 +174,6 @@ class FioriAppGenerator extends yeoman_generator_1.default {
|
|
|
174
174
|
targetFolder: this.state.project?.targetFolder,
|
|
175
175
|
service: this.state.service,
|
|
176
176
|
floorplan: this.state.floorplan,
|
|
177
|
-
hideUI5VersionPrompt: generatorOptions.hideUI5VersionPrompt,
|
|
178
177
|
promptSettings: generatorOptions.promptSettings,
|
|
179
178
|
promptExtension: generatorOptions.extensions
|
|
180
179
|
}, [this.yeomanUiStepConfig], this.env.adapter);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { AppWizard, Severity } from '@sap-devx/yeoman-ui-types';
|
|
2
2
|
import type Generator from 'yeoman-generator';
|
|
3
|
-
import type { FioriGeneratorSettings, FioriStep, Floorplan,
|
|
3
|
+
import type { FioriGeneratorSettings, FioriStep, Floorplan, FioriAppGeneratorPromptSettings, State, YeomanUiStepConfig } from '../types';
|
|
4
|
+
import type { UI5ApplicationPromptOptions } from '@sap-ux/ui5-application-inquirer';
|
|
4
5
|
/**
|
|
5
6
|
* Fiori generator specific options, for internal use only.
|
|
6
7
|
* todo: Split this into FioriGenerator options (e.g. disableS4, disableGeneratorExtensions, data) that are explicitly root generator options
|
|
@@ -25,7 +26,7 @@ export interface FioriAppGeneratorOptions extends Generator.GeneratorOptions, Fi
|
|
|
25
26
|
/**
|
|
26
27
|
* Customer provided extensions used to customize existing questions
|
|
27
28
|
*/
|
|
28
|
-
extensions?:
|
|
29
|
+
extensions?: UI5ApplicationPromptOptions;
|
|
29
30
|
/**
|
|
30
31
|
* The floorplan (app type) that will be created
|
|
31
32
|
*/
|
|
@@ -3,7 +3,7 @@ import { type CapService, type ConnectedSystem, OdataVersion } from '@sap-ux/oda
|
|
|
3
3
|
import type { UI5ApplicationAnswers, UI5ApplicationPromptOptions } from '@sap-ux/ui5-application-inquirer';
|
|
4
4
|
import type { Question } from 'inquirer';
|
|
5
5
|
import type { Adapter } from 'yeoman-environment';
|
|
6
|
-
import type { FioriAppGeneratorPromptSettings, Floorplan, Project,
|
|
6
|
+
import type { FioriAppGeneratorPromptSettings, Floorplan, Project, Service, YeomanUiStepConfig } from '../types';
|
|
7
7
|
declare const viewNamePromptName = "viewName";
|
|
8
8
|
export interface ViewNameAnswer {
|
|
9
9
|
[viewNamePromptName]: string;
|
|
@@ -17,16 +17,14 @@ type PromptUI5AppAnswersOptions = {
|
|
|
17
17
|
targetFolder?: Project['targetFolder'];
|
|
18
18
|
service: Partial<Service>;
|
|
19
19
|
promptSettings?: FioriAppGeneratorPromptSettings;
|
|
20
|
-
hideUI5VersionPrompt?: boolean;
|
|
21
20
|
floorplan: Floorplan;
|
|
22
|
-
promptExtension?:
|
|
21
|
+
promptExtension?: UI5ApplicationPromptOptions;
|
|
23
22
|
};
|
|
24
23
|
/**
|
|
25
24
|
* Creates the prompt options for UI5 application prompting and calls `prompt`.
|
|
26
25
|
* The answers to the questions are returned.
|
|
27
26
|
*
|
|
28
27
|
* @param param0
|
|
29
|
-
* @param param0.hideUI5VersionPrompt this will override the `hide` property of the ui5Version prompt setting if provided
|
|
30
28
|
* @param param0.service
|
|
31
29
|
* @param param0.projectName
|
|
32
30
|
* @param param0.targetFolder
|
|
@@ -37,7 +35,7 @@ type PromptUI5AppAnswersOptions = {
|
|
|
37
35
|
* @param adapter
|
|
38
36
|
* @returns
|
|
39
37
|
*/
|
|
40
|
-
export declare function promptUI5ApplicationAnswers({ service, projectName, targetFolder, promptSettings,
|
|
38
|
+
export declare function promptUI5ApplicationAnswers({ service, projectName, targetFolder, promptSettings, floorplan, promptExtension }: PromptUI5AppAnswersOptions, yeomanUiStepConfig: YeomanUiStepConfig[], adapter: Adapter): Promise<{
|
|
41
39
|
ui5AppAnswers: UI5ApplicationAnswers;
|
|
42
40
|
localUI5Version: string | undefined;
|
|
43
41
|
}>;
|
|
@@ -65,7 +63,7 @@ export declare function promptOdataServiceAnswers(options: OdataServiceInquirerO
|
|
|
65
63
|
* @param extensions
|
|
66
64
|
* @returns {Promise<UI5ApplicationPromptOptions>} prompt options that may be used to configure UI5 application prompting
|
|
67
65
|
*/
|
|
68
|
-
export declare function createUI5ApplicationPromptOptions(service: Partial<Readonly<Service>>, appGenStepConfigList: YeomanUiStepConfig[], floorplan: Floorplan, projectName?: Project['name'], targetFolder?: Project['targetFolder'], promptSettings?: FioriAppGeneratorPromptSettings, extensions?:
|
|
66
|
+
export declare function createUI5ApplicationPromptOptions(service: Partial<Readonly<Service>>, appGenStepConfigList: YeomanUiStepConfig[], floorplan: Floorplan, projectName?: Project['name'], targetFolder?: Project['targetFolder'], promptSettings?: FioriAppGeneratorPromptSettings, extensions?: UI5ApplicationPromptOptions): Promise<UI5ApplicationPromptOptions>;
|
|
69
67
|
/**
|
|
70
68
|
* Convienience type for the options of the `createOdataServicePromptOptions` function.
|
|
71
69
|
*/
|
|
@@ -61,7 +61,6 @@ exports.getViewQuestion = getViewQuestion;
|
|
|
61
61
|
* The answers to the questions are returned.
|
|
62
62
|
*
|
|
63
63
|
* @param param0
|
|
64
|
-
* @param param0.hideUI5VersionPrompt this will override the `hide` property of the ui5Version prompt setting if provided
|
|
65
64
|
* @param param0.service
|
|
66
65
|
* @param param0.projectName
|
|
67
66
|
* @param param0.targetFolder
|
|
@@ -72,7 +71,7 @@ exports.getViewQuestion = getViewQuestion;
|
|
|
72
71
|
* @param adapter
|
|
73
72
|
* @returns
|
|
74
73
|
*/
|
|
75
|
-
async function promptUI5ApplicationAnswers({ service, projectName, targetFolder, promptSettings,
|
|
74
|
+
async function promptUI5ApplicationAnswers({ service, projectName, targetFolder, promptSettings, floorplan, promptExtension }, yeomanUiStepConfig, adapter) {
|
|
76
75
|
let inquirerAdapter;
|
|
77
76
|
// type `any` will be replaced when we can import ESM modules
|
|
78
77
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -83,14 +82,7 @@ async function promptUI5ApplicationAnswers({ service, projectName, targetFolder,
|
|
|
83
82
|
else {
|
|
84
83
|
inquirerAdapter = adapter;
|
|
85
84
|
}
|
|
86
|
-
|
|
87
|
-
const pmptSettings = {
|
|
88
|
-
...promptSettings,
|
|
89
|
-
[ui5_application_inquirer_1.promptNames.ui5Version]: {
|
|
90
|
-
hide: hideUI5VersionPrompt ?? false
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
const promptOptions = await createUI5ApplicationPromptOptions(service, yeomanUiStepConfig, floorplan, projectName, targetFolder, pmptSettings, promptExtension);
|
|
85
|
+
const promptOptions = await createUI5ApplicationPromptOptions(service, yeomanUiStepConfig, floorplan, projectName, targetFolder, promptSettings, promptExtension);
|
|
94
86
|
const ui5AppAnswers = await (0, ui5_application_inquirer_1.prompt)(inquirerAdapter, promptOptions, service.capService?.cdsUi5PluginInfo, (0, fiori_generator_shared_1.getHostEnvironment)() !== fiori_generator_shared_1.hostEnvironment.cli);
|
|
95
87
|
// Get the (latest) version available from npm, instead of UI5 versions service in case of unpublished versions
|
|
96
88
|
const localUI5Version = (await (0, ui5_info_1.getUI5Versions)({
|
|
@@ -182,7 +174,7 @@ async function createUI5ApplicationPromptOptions(service, appGenStepConfigList,
|
|
|
182
174
|
};
|
|
183
175
|
}
|
|
184
176
|
// Add more prompt options as required
|
|
185
|
-
const
|
|
177
|
+
const preMergedPromptOpts = {
|
|
186
178
|
[ui5_application_inquirer_1.promptNames.name]: {
|
|
187
179
|
defaultValue: projectName
|
|
188
180
|
},
|
|
@@ -202,13 +194,14 @@ async function createUI5ApplicationPromptOptions(service, appGenStepConfigList,
|
|
|
202
194
|
}
|
|
203
195
|
},
|
|
204
196
|
[ui5_application_inquirer_1.promptNames.enableTypeScript]: {
|
|
205
|
-
|
|
197
|
+
default: types_1.defaultPromptValues[ui5_application_inquirer_1.promptNames.enableTypeScript]
|
|
206
198
|
},
|
|
207
199
|
[ui5_application_inquirer_1.promptNames.enableVirtualEndpoints]: {
|
|
208
200
|
hide: service.capService?.capType === 'Java'
|
|
209
201
|
}
|
|
210
|
-
}
|
|
211
|
-
|
|
202
|
+
};
|
|
203
|
+
const promptOptions = (0, merge_1.default)(preMergedPromptOpts, promptSettings);
|
|
204
|
+
// Configure the prompts which should be hidden behind the advanced option switch
|
|
212
205
|
const advancedPrompts = [
|
|
213
206
|
ui5_application_inquirer_1.promptNames.enableCodeAssist,
|
|
214
207
|
ui5_application_inquirer_1.promptNames.skipAnnotations,
|
|
@@ -2,12 +2,11 @@ import type { IPrompt as Step } from '@sap-devx/yeoman-ui-types';
|
|
|
2
2
|
import type { Annotations } from '@sap-ux/axios-extension';
|
|
3
3
|
import { TemplateType as FETemplateType } from '@sap-ux/fiori-elements-writer';
|
|
4
4
|
import { TemplateType as FFTemplateType } from '@sap-ux/fiori-freestyle-writer';
|
|
5
|
-
import type { PromptSeverityMessage } from '@sap-ux/inquirer-common';
|
|
6
5
|
import type { DeployConfig, FLPConfig } from '@sap-ux/fiori-generator-shared';
|
|
7
6
|
import type { CapRuntime, EntityRelatedAnswers } from '@sap-ux/odata-service-inquirer';
|
|
8
7
|
import { OdataVersion } from '@sap-ux/odata-service-inquirer';
|
|
9
|
-
import {
|
|
10
|
-
import type { Answers
|
|
8
|
+
import { type UI5ApplicationPromptOptions } from '@sap-ux/ui5-application-inquirer';
|
|
9
|
+
import type { Answers } from 'inquirer';
|
|
11
10
|
import { type ALPOptions, type Project, type Service, type Floorplan, FloorplanFE, FloorplanFF } from './state';
|
|
12
11
|
export { Floorplan, FloorplanFE, FloorplanFF };
|
|
13
12
|
export type FloorplanKey = keyof typeof FloorplanFE | keyof typeof FloorplanFF;
|
|
@@ -132,12 +131,6 @@ export declare function capTypeConversion(capType?: string): CapRuntime;
|
|
|
132
131
|
* NOTE: Only options specific to FE/FF generators should be passed as options, all other options should be provided via generator extensions
|
|
133
132
|
*/
|
|
134
133
|
export interface FioriGeneratorSettings {
|
|
135
|
-
/**
|
|
136
|
-
* Toggles ui5 version prompting
|
|
137
|
-
*
|
|
138
|
-
* @deprecated Use extensions + prompt options (UI5ApplcationInquirer `ui5Version` options 'hide') to control this
|
|
139
|
-
*/
|
|
140
|
-
hideUI5VersionPrompt?: boolean;
|
|
141
134
|
/**
|
|
142
135
|
* Toggles the generation of index.html and excludes the start-noflp script from package.json
|
|
143
136
|
*/
|
|
@@ -155,20 +148,8 @@ export interface FioriGeneratorSettings {
|
|
|
155
148
|
*/
|
|
156
149
|
showLayoutPrompts?: boolean;
|
|
157
150
|
}
|
|
158
|
-
/**
|
|
159
|
-
* Defines the currently allowed extension points for a Fiori Generator prompt
|
|
160
|
-
* todo: Include open source inquirer prompt options (UI5ApplicationInquirer prompt options) also so extensions can directly use them
|
|
161
|
-
*
|
|
162
|
-
*/
|
|
163
|
-
export type PromptExtension = {
|
|
164
|
-
[key in ui5AppInquirerPromptNames]?: {
|
|
165
|
-
validate?: Question['validate'];
|
|
166
|
-
default?: Question['default'];
|
|
167
|
-
additionalMessages?: PromptSeverityMessage;
|
|
168
|
-
};
|
|
169
|
-
};
|
|
170
151
|
export interface FioriGeneratorPromptExtension {
|
|
171
|
-
[generatorName: string]:
|
|
152
|
+
[generatorName: string]: UI5ApplicationPromptOptions;
|
|
172
153
|
}
|
|
173
154
|
export interface ConditionalStep extends Step {
|
|
174
155
|
/**
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap-ux/fiori-app-sub-generator",
|
|
3
3
|
"description": "A yeoman (sub) generator that can generate Fiori applications. Not for standalone use.",
|
|
4
|
-
"version": "0.1
|
|
4
|
+
"version": "0.2.1",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -29,22 +29,22 @@
|
|
|
29
29
|
"mem-fs-editor": "9.4.0",
|
|
30
30
|
"uuid": "11.0.5",
|
|
31
31
|
"yeoman-generator": "5.10.0",
|
|
32
|
-
"@sap-ux/annotation-generator": "0.3.
|
|
32
|
+
"@sap-ux/annotation-generator": "0.3.33",
|
|
33
33
|
"@sap-ux/axios-extension": "1.21.0",
|
|
34
34
|
"@sap-ux/btp-utils": "1.1.0",
|
|
35
|
-
"@sap-ux/cap-config-writer": "0.10.
|
|
35
|
+
"@sap-ux/cap-config-writer": "0.10.1",
|
|
36
36
|
"@sap-ux/feature-toggle": "0.3.0",
|
|
37
|
-
"@sap-ux/fiori-elements-writer": "2.4.
|
|
38
|
-
"@sap-ux/fiori-freestyle-writer": "2.4.
|
|
39
|
-
"@sap-ux/fiori-generator-shared": "0.12.
|
|
37
|
+
"@sap-ux/fiori-elements-writer": "2.4.2",
|
|
38
|
+
"@sap-ux/fiori-freestyle-writer": "2.4.1",
|
|
39
|
+
"@sap-ux/fiori-generator-shared": "0.12.1",
|
|
40
40
|
"@sap-ux/fiori-tools-settings": "0.2.0",
|
|
41
|
-
"@sap-ux/launch-config": "0.10.
|
|
42
|
-
"@sap-ux/odata-service-inquirer": "2.4.
|
|
43
|
-
"@sap-ux/odata-service-writer": "0.27.
|
|
44
|
-
"@sap-ux/project-access": "1.30.
|
|
41
|
+
"@sap-ux/launch-config": "0.10.1",
|
|
42
|
+
"@sap-ux/odata-service-inquirer": "2.4.1",
|
|
43
|
+
"@sap-ux/odata-service-writer": "0.27.1",
|
|
44
|
+
"@sap-ux/project-access": "1.30.1",
|
|
45
45
|
"@sap-ux/store": "1.1.0",
|
|
46
|
-
"@sap-ux/telemetry": "0.6.
|
|
47
|
-
"@sap-ux/ui5-application-inquirer": "0.
|
|
46
|
+
"@sap-ux/telemetry": "0.6.1",
|
|
47
|
+
"@sap-ux/ui5-application-inquirer": "0.14.0",
|
|
48
48
|
"@sap-ux/ui5-info": "0.11.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
@@ -62,8 +62,8 @@
|
|
|
62
62
|
"mock-spawn": "0.2.6",
|
|
63
63
|
"rimraf": "5.0.5",
|
|
64
64
|
"yeoman-test": "6.3.0",
|
|
65
|
-
"@sap-ux/flp-config-sub-generator": "0.2.
|
|
66
|
-
"@sap-ux/inquirer-common": "0.7.
|
|
65
|
+
"@sap-ux/flp-config-sub-generator": "0.2.3",
|
|
66
|
+
"@sap-ux/inquirer-common": "0.7.1",
|
|
67
67
|
"@sap-ux/jest-file-matchers": "0.2.1",
|
|
68
68
|
"@sap-ux/logger": "0.7.0"
|
|
69
69
|
},
|