@sap-ux/generator-adp 0.1.0

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.
@@ -0,0 +1,226 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConfigPrompter = void 0;
4
+ const project_input_validator_1 = require("@sap-ux/project-input-validator");
5
+ const adp_tooling_1 = require("@sap-ux/adp-tooling");
6
+ const i18n_1 = require("../../utils/i18n");
7
+ const types_1 = require("../types");
8
+ const choices_1 = require("./helper/choices");
9
+ const conditions_1 = require("./helper/conditions");
10
+ /**
11
+ * A stateful prompter class that creates configuration questions.
12
+ * This class accepts the needed dependencies and keeps track of state (e.g. the ApplicationManager instance).
13
+ * It exposes a single public method {@link getPrompts} to retrieve the configuration questions.
14
+ */
15
+ class ConfigPrompter {
16
+ abapProvider;
17
+ targetSystems;
18
+ logger;
19
+ /**
20
+ * Instance of target applications class for loading applications.
21
+ */
22
+ targetApps;
23
+ /**
24
+ * Indicates if the current layer is based on a customer base.
25
+ */
26
+ isCustomerBase;
27
+ /**
28
+ * Creates an instance of ConfigPrompter.
29
+ *
30
+ * @param {AbapProvider} abapProvider - The ABAP provider instance.
31
+ * @param {TargetSystems} targetSystems - The target system class to retrieve system endpoints.
32
+ * @param {FlexLayer} layer - The FlexLayer used to determine the base (customer or otherwise).
33
+ * @param {ToolsLogger} logger - The logger instance for logging.
34
+ */
35
+ constructor(abapProvider, targetSystems, layer, logger) {
36
+ this.abapProvider = abapProvider;
37
+ this.targetSystems = targetSystems;
38
+ this.logger = logger;
39
+ this.targetApps = new adp_tooling_1.TargetApplications(this.abapProvider, this.isCustomerBase, this.logger);
40
+ this.isCustomerBase = layer === "CUSTOMER_BASE" /* FlexLayer.CUSTOMER_BASE */;
41
+ }
42
+ /**
43
+ * Retrieves an array of configuration questions based on provided options.
44
+ * This is the only public method for retrieving prompts.
45
+ *
46
+ * @param {ConfigPromptOptions} promptOptions - Optional configuration to control prompt behavior and defaults.
47
+ * @returns An array of configuration questions.
48
+ */
49
+ getPrompts(promptOptions) {
50
+ const keyedPrompts = {
51
+ [types_1.configPromptNames.system]: this.getSystemListPrompt(promptOptions?.[types_1.configPromptNames.system]),
52
+ [types_1.configPromptNames.username]: this.getUsernamePrompt(promptOptions?.[types_1.configPromptNames.username]),
53
+ [types_1.configPromptNames.password]: this.getPasswordPrompt(promptOptions?.[types_1.configPromptNames.password]),
54
+ [types_1.configPromptNames.application]: this.getApplicationListPrompt(promptOptions?.[types_1.configPromptNames.application])
55
+ };
56
+ const questions = Object.entries(keyedPrompts)
57
+ .filter(([promptName, _]) => {
58
+ const options = promptOptions?.[promptName];
59
+ return !(options && 'hide' in options && options.hide);
60
+ })
61
+ .map(([_, question]) => question);
62
+ return questions;
63
+ }
64
+ /**
65
+ * Creates the system list prompt configuration.
66
+ *
67
+ * @param {SystemPromptOptions} _ - Optional configuration for the system prompt.
68
+ * @returns The system list prompt as a {@link ConfigQuestion}.
69
+ */
70
+ getSystemListPrompt(_) {
71
+ return {
72
+ type: 'list',
73
+ name: types_1.configPromptNames.system,
74
+ message: (0, i18n_1.t)('prompts.systemLabel'),
75
+ choices: async () => {
76
+ const systems = await this.targetSystems.getSystems();
77
+ return (0, adp_tooling_1.getEndpointNames)(systems);
78
+ },
79
+ guiOptions: {
80
+ mandatory: true,
81
+ breadcrumb: true,
82
+ hint: (0, i18n_1.t)('prompts.systemTooltip')
83
+ },
84
+ validate: async (value, answers) => await this.validateSystem(value, answers)
85
+ };
86
+ }
87
+ /**
88
+ * Creates the username prompt configuration.
89
+ *
90
+ * @param {UsernamePromptOptions} _ - Optional configuration for the username prompt.
91
+ * @returns The username prompt as a {@link ConfigQuestion}.
92
+ */
93
+ getUsernamePrompt(_) {
94
+ return {
95
+ type: 'input',
96
+ name: types_1.configPromptNames.username,
97
+ message: (0, i18n_1.t)('prompts.usernameLabel'),
98
+ guiOptions: {
99
+ mandatory: true,
100
+ breadcrumb: true,
101
+ hint: (0, i18n_1.t)('prompts.usernameTooltip')
102
+ },
103
+ filter: (val) => val.trim(),
104
+ validate: (val) => (0, project_input_validator_1.validateEmptyString)(val),
105
+ when: async (answers) => {
106
+ const systemRequiresAuth = await this.targetSystems.getSystemRequiresAuth(answers.system);
107
+ return (0, conditions_1.showCredentialQuestion)(answers, systemRequiresAuth);
108
+ }
109
+ };
110
+ }
111
+ /**
112
+ * Creates the password prompt configuration.
113
+ *
114
+ * @param {PasswordPromptOptions} _ - Optional configuration for the password prompt.
115
+ * @returns The password prompt as a {@link ConfigQuestion}.
116
+ */
117
+ getPasswordPrompt(_) {
118
+ return {
119
+ type: 'password',
120
+ name: types_1.configPromptNames.password,
121
+ message: (0, i18n_1.t)('prompts.passwordLabel'),
122
+ mask: '*',
123
+ guiOptions: {
124
+ type: 'login',
125
+ mandatory: true,
126
+ hint: (0, i18n_1.t)('prompts.passwordTooltip')
127
+ },
128
+ validate: async (value, answers) => await this.validatePassword(value, answers),
129
+ when: async (answers) => {
130
+ const systemRequiresAuth = await this.targetSystems.getSystemRequiresAuth(answers.system);
131
+ return (0, conditions_1.showCredentialQuestion)(answers, systemRequiresAuth);
132
+ }
133
+ };
134
+ }
135
+ /**
136
+ * Creates the application list prompt configuration.
137
+ *
138
+ * @param {ApplicationPromptOptions} options - Optional configuration for the application prompt.
139
+ * @returns The application list prompt as a {@link ConfigQuestion}.
140
+ */
141
+ getApplicationListPrompt(options) {
142
+ return {
143
+ type: 'list',
144
+ name: types_1.configPromptNames.application,
145
+ message: (0, i18n_1.t)('prompts.applicationListLabel'),
146
+ guiOptions: {
147
+ mandatory: true,
148
+ breadcrumb: true,
149
+ hint: (0, i18n_1.t)('prompts.applicationListTooltip'),
150
+ applyDefaultWhenDirty: true
151
+ },
152
+ choices: async () => {
153
+ const apps = await this.targetApps.getApps();
154
+ return (0, choices_1.getApplicationChoices)(apps);
155
+ },
156
+ default: options?.default,
157
+ validate: (value) => this.validateApplicationSelection(value),
158
+ when: async (answers) => {
159
+ const systemRequiresAuth = await this.targetSystems.getSystemRequiresAuth(answers.system);
160
+ return (0, conditions_1.showApplicationQuestion)(answers, systemRequiresAuth);
161
+ }
162
+ };
163
+ }
164
+ /**
165
+ * Validates the selected application.
166
+ *
167
+ * @param {string} app - The selected application.
168
+ * @returns An error message if validation fails, or true if the selection is valid.
169
+ */
170
+ validateApplicationSelection(app) {
171
+ if (!app) {
172
+ return (0, i18n_1.t)('error.selectCannotBeEmptyError', { value: 'Application' });
173
+ }
174
+ return true;
175
+ }
176
+ /**
177
+ * Validates the password by setting up the provider and, if necessary,
178
+ * loading the available applications.
179
+ *
180
+ * @param {string} password - The inputted password.
181
+ * @param {ConfigAnswers} answers - The configuration answers provided by the user.
182
+ * @returns An error message if validation fails, or true if the system selection is valid.
183
+ */
184
+ async validatePassword(password, answers) {
185
+ const validationResult = (0, project_input_validator_1.validateEmptyString)(password);
186
+ if (typeof validationResult === 'string') {
187
+ return validationResult;
188
+ }
189
+ try {
190
+ await this.abapProvider.setProvider(answers.system, undefined, answers.username, password);
191
+ await this.targetApps.getApps();
192
+ return true;
193
+ }
194
+ catch (e) {
195
+ return e.message;
196
+ }
197
+ }
198
+ /**
199
+ * Validates the system selection by setting up the provider and, if necessary,
200
+ * loading the available applications.
201
+ *
202
+ * @param {string} system - The selected system.
203
+ * @param {ConfigAnswers} answers - The configuration answers provided by the user.
204
+ * @returns An error message if validation fails, or true if the system selection is valid.
205
+ */
206
+ async validateSystem(system, answers) {
207
+ const validationResult = (0, project_input_validator_1.validateEmptyString)(system);
208
+ if (typeof validationResult === 'string') {
209
+ return validationResult;
210
+ }
211
+ try {
212
+ this.targetApps.resetApps();
213
+ await this.abapProvider.setProvider(system, undefined, answers.username, answers.password);
214
+ const systemRequiresAuth = await this.targetSystems.getSystemRequiresAuth(system);
215
+ if (!systemRequiresAuth) {
216
+ await this.targetApps.getApps();
217
+ }
218
+ return true;
219
+ }
220
+ catch (e) {
221
+ return e.message;
222
+ }
223
+ }
224
+ }
225
+ exports.ConfigPrompter = ConfigPrompter;
226
+ //# sourceMappingURL=configuration.js.map
@@ -0,0 +1,15 @@
1
+ import type { TargetApplication } from '@sap-ux/adp-tooling';
2
+ interface Choice {
3
+ name: string;
4
+ value: TargetApplication;
5
+ }
6
+ /**
7
+ * Creates a list of choices from a list of applications, formatted for display or selection in a UI.
8
+ * Each choice consists of an application's title (or ID if no title), followed by its registration IDs and ACH, formatted for easy reading.
9
+ *
10
+ * @param {TargetApplication[]} apps - An array of applications to be transformed into display choices.
11
+ * @returns {Choice[]} An array of objects each containing a value (the full application object) and a name (a formatted string).
12
+ */
13
+ export declare const getApplicationChoices: (apps: TargetApplication[]) => Choice[];
14
+ export {};
15
+ //# sourceMappingURL=choices.d.ts.map
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getApplicationChoices = void 0;
4
+ /**
5
+ * Creates a list of choices from a list of applications, formatted for display or selection in a UI.
6
+ * Each choice consists of an application's title (or ID if no title), followed by its registration IDs and ACH, formatted for easy reading.
7
+ *
8
+ * @param {TargetApplication[]} apps - An array of applications to be transformed into display choices.
9
+ * @returns {Choice[]} An array of objects each containing a value (the full application object) and a name (a formatted string).
10
+ */
11
+ const getApplicationChoices = (apps) => {
12
+ return Array.isArray(apps)
13
+ ? apps.map((app) => {
14
+ const name = app.title
15
+ ? `${app.title} (${app.id}, ${app.registrationIds}, ${app.ach})`
16
+ : `${app.id} (${app.registrationIds}, ${app.ach})`;
17
+ return {
18
+ value: app,
19
+ name: name.replace('(, )', '').replace(', , ', ', ').replace(', )', ')').replace('(, ', '(')
20
+ };
21
+ })
22
+ : apps;
23
+ };
24
+ exports.getApplicationChoices = getApplicationChoices;
25
+ //# sourceMappingURL=choices.js.map
@@ -0,0 +1,27 @@
1
+ import type { ConfigAnswers } from '@sap-ux/adp-tooling';
2
+ /**
3
+ * Determines if authentication is necessary based on the provided configuration answers.
4
+ * It checks if the system requires authentication and if the necessary credentials are provided.
5
+ *
6
+ * @param {ConfigAnswers} answers - User provided configuration details.
7
+ * @param {boolean} systemRequiresAuth - A flag indicating if system requires authentication.
8
+ * @returns {boolean | string} True if authentication should proceed, false if there are issues with credentials.
9
+ */
10
+ export declare function shouldAuthenticate<T extends ConfigAnswers>(answers: T, systemRequiresAuth: boolean): boolean;
11
+ /**
12
+ * Determines if an application question will be shown based on the answers and specific conditions.
13
+ *
14
+ * @param {ConfigAnswers} answers - The user-provided answers containing application details.
15
+ * @param {boolean} systemRequiresAuth - A flag indicating if system requires authentication.
16
+ * @returns {boolean | undefined} True if a application question will be shown, otherwise false.
17
+ */
18
+ export declare function showApplicationQuestion<T extends ConfigAnswers>(answers: T, systemRequiresAuth: boolean): boolean;
19
+ /**
20
+ * Determines if a credential question will be shown based on the answers and specific conditions.
21
+ *
22
+ * @param {ConfigAnswers} answers - The user-provided answers containing application details.
23
+ * @param {boolean} systemRequiresAuth - A flag indicating if system requires authentication.
24
+ * @returns {boolean | undefined} True if a credential question will be shown, otherwise false or undefined.
25
+ */
26
+ export declare function showCredentialQuestion(answers: ConfigAnswers, systemRequiresAuth: boolean): boolean;
27
+ //# sourceMappingURL=conditions.d.ts.map
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.showCredentialQuestion = exports.showApplicationQuestion = exports.shouldAuthenticate = void 0;
4
+ /**
5
+ * Determines if authentication is necessary based on the provided configuration answers.
6
+ * It checks if the system requires authentication and if the necessary credentials are provided.
7
+ *
8
+ * @param {ConfigAnswers} answers - User provided configuration details.
9
+ * @param {boolean} systemRequiresAuth - A flag indicating if system requires authentication.
10
+ * @returns {boolean | string} True if authentication should proceed, false if there are issues with credentials.
11
+ */
12
+ function shouldAuthenticate(answers, systemRequiresAuth) {
13
+ return !!answers.system && systemRequiresAuth && (answers.username === '' || answers.password === '');
14
+ }
15
+ exports.shouldAuthenticate = shouldAuthenticate;
16
+ /**
17
+ * Determines if an application question will be shown based on the answers and specific conditions.
18
+ *
19
+ * @param {ConfigAnswers} answers - The user-provided answers containing application details.
20
+ * @param {boolean} systemRequiresAuth - A flag indicating if system requires authentication.
21
+ * @returns {boolean | undefined} True if a application question will be shown, otherwise false.
22
+ */
23
+ function showApplicationQuestion(answers, systemRequiresAuth) {
24
+ return !!answers.system && !shouldAuthenticate(answers, systemRequiresAuth);
25
+ }
26
+ exports.showApplicationQuestion = showApplicationQuestion;
27
+ /**
28
+ * Determines if a credential question will be shown based on the answers and specific conditions.
29
+ *
30
+ * @param {ConfigAnswers} answers - The user-provided answers containing application details.
31
+ * @param {boolean} systemRequiresAuth - A flag indicating if system requires authentication.
32
+ * @returns {boolean | undefined} True if a credential question will be shown, otherwise false or undefined.
33
+ */
34
+ function showCredentialQuestion(answers, systemRequiresAuth) {
35
+ if (answers.system) {
36
+ return systemRequiresAuth;
37
+ }
38
+ else {
39
+ return false;
40
+ }
41
+ }
42
+ exports.showCredentialQuestion = showCredentialQuestion;
43
+ //# sourceMappingURL=conditions.js.map
@@ -0,0 +1,25 @@
1
+ import { FlexLayer } from '@sap-ux/adp-tooling';
2
+ /**
3
+ * Generates a namespace for a project based on its layer.
4
+ *
5
+ * @param {string} projectName - The name of the project.
6
+ * @param {FlexLayer} layer - The UI5 Flex layer, indicating the deployment layer (e.g., CUSTOMER_BASE).
7
+ * @returns {string} The namespace string, prefixed appropriately if it's a customer base project.
8
+ */
9
+ export declare function generateValidNamespace(projectName: string, layer: FlexLayer): string;
10
+ /**
11
+ * Retrieves a list of project directory names that match a specific naming pattern from the given directory path.
12
+ *
13
+ * @param {string} path - The directory path from which to list project names.
14
+ * @param {RegExp} regex - The specific naming pattern to filter by.
15
+ * @returns {string[]} An array of project names that match the pattern /^app\.variant[0-9]{1,3}$/, sorted in reverse order.
16
+ */
17
+ export declare function getProjectNames(path: string, regex?: RegExp): string[];
18
+ /**
19
+ * Generates a default project name based on the existing projects in the specified directory.
20
+ *
21
+ * @param {string} path - The directory path where projects are located.
22
+ * @returns {string} A default project name with an incremented index if similar projects exist.
23
+ */
24
+ export declare function getDefaultProjectName(path: string): string;
25
+ //# sourceMappingURL=default-values.d.ts.map
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getDefaultProjectName = exports.getProjectNames = exports.generateValidNamespace = void 0;
4
+ const fs_1 = require("fs");
5
+ const APP_VARIANT_REGEX = /^app[.]variant\d{1,3}$/;
6
+ /**
7
+ * Generates a namespace for a project based on its layer.
8
+ *
9
+ * @param {string} projectName - The name of the project.
10
+ * @param {FlexLayer} layer - The UI5 Flex layer, indicating the deployment layer (e.g., CUSTOMER_BASE).
11
+ * @returns {string} The namespace string, prefixed appropriately if it's a customer base project.
12
+ */
13
+ function generateValidNamespace(projectName, layer) {
14
+ return layer === "CUSTOMER_BASE" /* FlexLayer.CUSTOMER_BASE */ ? `customer.${projectName}` : projectName;
15
+ }
16
+ exports.generateValidNamespace = generateValidNamespace;
17
+ /**
18
+ * Retrieves a list of project directory names that match a specific naming pattern from the given directory path.
19
+ *
20
+ * @param {string} path - The directory path from which to list project names.
21
+ * @param {RegExp} regex - The specific naming pattern to filter by.
22
+ * @returns {string[]} An array of project names that match the pattern /^app\.variant[0-9]{1,3}$/, sorted in reverse order.
23
+ */
24
+ function getProjectNames(path, regex = APP_VARIANT_REGEX) {
25
+ return (0, fs_1.readdirSync)(path, { withFileTypes: true })
26
+ .filter((dirent) => !dirent.isFile() && regex.test(dirent.name))
27
+ .map((dirent) => dirent.name)
28
+ .sort((a, b) => {
29
+ const numA = parseInt(a.replace('app.variant', ''), 10);
30
+ const numB = parseInt(b.replace('app.variant', ''), 10);
31
+ return numA - numB;
32
+ })
33
+ .reverse();
34
+ }
35
+ exports.getProjectNames = getProjectNames;
36
+ /**
37
+ * Generates a default project name based on the existing projects in the specified directory.
38
+ *
39
+ * @param {string} path - The directory path where projects are located.
40
+ * @returns {string} A default project name with an incremented index if similar projects exist.
41
+ */
42
+ function getDefaultProjectName(path) {
43
+ const projectNames = getProjectNames(path);
44
+ const defaultPrefix = 'app.variant';
45
+ if (projectNames.length === 0) {
46
+ return `${defaultPrefix}1`;
47
+ }
48
+ const lastProject = projectNames[0];
49
+ const lastProjectIdx = lastProject.replace(defaultPrefix, '');
50
+ const newProjectIndex = parseInt(lastProjectIdx, 10) + 1;
51
+ return `${defaultPrefix}${newProjectIndex}`;
52
+ }
53
+ exports.getDefaultProjectName = getDefaultProjectName;
54
+ //# sourceMappingURL=default-values.js.map
@@ -0,0 +1,67 @@
1
+ import type Generator from 'yeoman-generator';
2
+ import type { AppWizard } from '@sap-devx/yeoman-ui-types';
3
+ import type { ConfigAnswers } from '@sap-ux/adp-tooling';
4
+ import type { YUIQuestion } from '@sap-ux/inquirer-common';
5
+ import type { TelemetryData } from '@sap-ux/fiori-generator-shared';
6
+ export interface AdpGeneratorOptions extends Generator.GeneratorOptions {
7
+ /**
8
+ * VSCode instance
9
+ */
10
+ vscode?: unknown;
11
+ /**
12
+ * Option to force the conflicter property of the yeoman environment (prevents additional prompt for overwriting files)
13
+ */
14
+ force?: boolean;
15
+ /**
16
+ * AppWizard instance
17
+ */
18
+ appWizard?: AppWizard;
19
+ /**
20
+ * Telemetry data to be send after deployment configuration has been added
21
+ */
22
+ telemetryData?: TelemetryData;
23
+ /**
24
+ * A boolean flag indicating whether node_modules should be installed after project generation.
25
+ */
26
+ shouldInstallDeps?: boolean;
27
+ }
28
+ /**
29
+ * Enumeration of prompt names used in the configuration.
30
+ */
31
+ export declare enum configPromptNames {
32
+ system = "system",
33
+ username = "username",
34
+ password = "password",
35
+ application = "application"
36
+ }
37
+ /**
38
+ * The question type specific to configuration prompts.
39
+ */
40
+ export type ConfigQuestion = YUIQuestion<ConfigAnswers>;
41
+ /**
42
+ * Options for individual prompts.
43
+ */
44
+ export interface SystemPromptOptions {
45
+ default?: string;
46
+ hide?: boolean;
47
+ }
48
+ export interface UsernamePromptOptions {
49
+ hide?: boolean;
50
+ }
51
+ export interface PasswordPromptOptions {
52
+ hide?: boolean;
53
+ }
54
+ export interface ApplicationPromptOptions {
55
+ default?: string;
56
+ hide?: boolean;
57
+ }
58
+ /**
59
+ * Options for the configuration inquirer & the prompts.
60
+ */
61
+ export type ConfigPromptOptions = Partial<{
62
+ [configPromptNames.system]: SystemPromptOptions;
63
+ [configPromptNames.username]: UsernamePromptOptions;
64
+ [configPromptNames.password]: PasswordPromptOptions;
65
+ [configPromptNames.application]: ApplicationPromptOptions;
66
+ }>;
67
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.configPromptNames = void 0;
4
+ /**
5
+ * Enumeration of prompt names used in the configuration.
6
+ */
7
+ var configPromptNames;
8
+ (function (configPromptNames) {
9
+ configPromptNames["system"] = "system";
10
+ configPromptNames["username"] = "username";
11
+ configPromptNames["password"] = "password";
12
+ configPromptNames["application"] = "application";
13
+ })(configPromptNames || (exports.configPromptNames = configPromptNames = {}));
14
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Event names for telemetry for the adaptation project fiori launchpad configuration generator
3
+ */
4
+ export declare enum EventName {
5
+ ADAPTATION_PROJECT_CREATED = "ADAPTATION_PROJECT_CREATED"
6
+ }
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EventName = void 0;
4
+ /**
5
+ * Event names for telemetry for the adaptation project fiori launchpad configuration generator
6
+ */
7
+ var EventName;
8
+ (function (EventName) {
9
+ EventName["ADAPTATION_PROJECT_CREATED"] = "ADAPTATION_PROJECT_CREATED";
10
+ })(EventName || (exports.EventName = EventName = {}));
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,22 @@
1
+ {
2
+ "yuiNavSteps": {
3
+ "configurationName": "System and Application Selection",
4
+ "configurationDescr": "Configure the system and select an application."
5
+ },
6
+ "prompts": {
7
+ "systemLabel": "System",
8
+ "systemTooltip": "Select a system to load its application list.",
9
+ "usernameLabel": "Username",
10
+ "usernameTooltip": "Enter the user name for the back-end system.",
11
+ "passwordLabel": "Password",
12
+ "passwordTooltip": "Enter the password for the back-end system.",
13
+ "applicationListLabel": "Application",
14
+ "applicationListTooltip": "Select the application for which you want to create an app variant."
15
+ },
16
+ "error": {
17
+ "selectCannotBeEmptyError": "{{value}} has to be selected.",
18
+ "writingPhase": "An error occurred in the writing phase of the adaptation project generation. To see the error, view the logs.",
19
+ "telemetry": "An error occurred when sending telemetry data: {{- error}}. To see the error, view the logs.",
20
+ "updatingApp": "An error occurred when creating a new adaptation project. To see the error, view the logs."
21
+ }
22
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Installs dependencies in the project directory.
3
+ *
4
+ * @param {string} projectPath - The project directory.
5
+ */
6
+ export declare function installDependencies(projectPath: string): Promise<void>;
7
+ //# sourceMappingURL=deps.d.ts.map
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.installDependencies = void 0;
27
+ const util = __importStar(require("util"));
28
+ const child_process_1 = require("child_process");
29
+ /**
30
+ * Installs dependencies in the project directory.
31
+ *
32
+ * @param {string} projectPath - The project directory.
33
+ */
34
+ async function installDependencies(projectPath) {
35
+ const execAsync = util.promisify(child_process_1.exec);
36
+ try {
37
+ await execAsync(`cd ${projectPath} && npm i`);
38
+ }
39
+ catch (error) {
40
+ throw new Error('Installation of dependencies failed.');
41
+ }
42
+ }
43
+ exports.installDependencies = installDependencies;
44
+ //# sourceMappingURL=deps.js.map
@@ -0,0 +1,14 @@
1
+ import type { TOptions } from 'i18next';
2
+ /**
3
+ * Initialize i18next with the translations for this module.
4
+ */
5
+ export declare function initI18n(): Promise<void>;
6
+ /**
7
+ * Helper function facading the call to i18next. Unless a namespace option is provided the local namespace will be used.
8
+ *
9
+ * @param key i18n key
10
+ * @param options additional options
11
+ * @returns {string} localized string stored for the given key
12
+ */
13
+ export declare function t(key: string, options?: TOptions): string;
14
+ //# sourceMappingURL=i18n.d.ts.map
@@ -0,0 +1,38 @@
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
+ exports.t = exports.initI18n = void 0;
7
+ const i18next_1 = __importDefault(require("i18next"));
8
+ const inquirer_common_1 = require("@sap-ux/inquirer-common");
9
+ const project_input_validator_1 = require("@sap-ux/project-input-validator");
10
+ const generator_adp_i18n_json_1 = __importDefault(require("../translations/generator-adp.i18n.json"));
11
+ const adpGeneratorI18nNamespace = 'generator-adp';
12
+ /**
13
+ * Initialize i18next with the translations for this module.
14
+ */
15
+ async function initI18n() {
16
+ await i18next_1.default.init({ lng: 'en', fallbackLng: 'en' }, () => i18next_1.default.addResourceBundle('en', adpGeneratorI18nNamespace, generator_adp_i18n_json_1.default));
17
+ (0, inquirer_common_1.addi18nResourceBundle)();
18
+ (0, project_input_validator_1.addi18nResourceBundle)();
19
+ }
20
+ exports.initI18n = initI18n;
21
+ /**
22
+ * Helper function facading the call to i18next. Unless a namespace option is provided the local namespace will be used.
23
+ *
24
+ * @param key i18n key
25
+ * @param options additional options
26
+ * @returns {string} localized string stored for the given key
27
+ */
28
+ function t(key, options) {
29
+ if (!options?.ns) {
30
+ options = Object.assign(options ?? {}, { ns: adpGeneratorI18nNamespace });
31
+ }
32
+ return i18next_1.default.t(key, options);
33
+ }
34
+ exports.t = t;
35
+ initI18n().catch(() => {
36
+ // Needed for lint
37
+ });
38
+ //# sourceMappingURL=i18n.js.map