@sap-ux/generator-adp 0.3.16 → 0.3.17
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 +7 -6
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { AppWizard } from '@sap-devx/yeoman-ui-types';
|
|
2
|
+
import { type ILogWrapper } from '@sap-ux/fiori-generator-shared';
|
|
3
|
+
import type { ConfigPrompter } from '../app/questions/configuration';
|
|
4
|
+
/**
|
|
5
|
+
* Values that are stashed in the App-Wizard cache.
|
|
6
|
+
*/
|
|
7
|
+
interface State {
|
|
8
|
+
/** Re-use the heavy-weight ConfigPrompter when the user navigates back-and-forth. */
|
|
9
|
+
prompter?: ConfigPrompter;
|
|
10
|
+
}
|
|
11
|
+
declare const ADP_CACHE_KEY = "$adp-generator-cache";
|
|
12
|
+
/**
|
|
13
|
+
* Augmented AppWizard type with optional internal cache field used for state persistence.
|
|
14
|
+
*/
|
|
15
|
+
export type AppWizardWithCache = AppWizard & {
|
|
16
|
+
[ADP_CACHE_KEY]?: Partial<State>;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Initializes the internal cache store on the AppWizard instance if it doesn't exist.
|
|
20
|
+
* This should be called early in the generator lifecycle (typically in the constructor).
|
|
21
|
+
*
|
|
22
|
+
* @param {ILogWrapper} logger - Logger instance used for debugging messages.
|
|
23
|
+
* @param {AppWizardWithCache} [wizard] - The AppWizard instance to augment with cache storage.
|
|
24
|
+
* @returns {void}
|
|
25
|
+
*/
|
|
26
|
+
export declare function initCache(logger: ILogWrapper, wizard?: AppWizardWithCache): void;
|
|
27
|
+
/**
|
|
28
|
+
* Stores or merges partial generator state in the AppWizard’s cache.
|
|
29
|
+
*
|
|
30
|
+
* @param {AppWizardWithCache | undefined} wizard - The AppWizard instance (may be undefined).
|
|
31
|
+
* @param {Partial<State>} state - Partial state object to cache.
|
|
32
|
+
* @param {ILogWrapper} logger - Logger instance for diagnostics.
|
|
33
|
+
* @returns {void}
|
|
34
|
+
*/
|
|
35
|
+
export declare function cachePut(wizard: AppWizardWithCache | undefined, state: Partial<State>, logger: ILogWrapper): void;
|
|
36
|
+
/**
|
|
37
|
+
* Retrieves a cached value from the AppWizard instance by key.
|
|
38
|
+
*
|
|
39
|
+
* @template T
|
|
40
|
+
* @param {AppWizardWithCache | undefined} wizard - The AppWizard instance with cache.
|
|
41
|
+
* @param {keyof State} key - The key to retrieve from the cached state.
|
|
42
|
+
* @param {ILogWrapper} logger - Logger instance used for diagnostics.
|
|
43
|
+
* @returns {T | undefined} - The cached value if present, otherwise `undefined`.
|
|
44
|
+
*/
|
|
45
|
+
export declare function cacheGet<T>(wizard: AppWizardWithCache | undefined, key: keyof State, logger: ILogWrapper): T | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Clears the entire generator state cache from the AppWizard instance.
|
|
48
|
+
*
|
|
49
|
+
* @param {AppWizardWithCache | undefined} wizard - The AppWizard instance with cache to clear.
|
|
50
|
+
* @param {ILogWrapper} logger - Logger instance for diagnostics.
|
|
51
|
+
* @returns {void}
|
|
52
|
+
*/
|
|
53
|
+
export declare function cacheClear(wizard: AppWizardWithCache | undefined, logger: ILogWrapper): void;
|
|
54
|
+
export {};
|
|
55
|
+
//# sourceMappingURL=appWizardCache.d.ts.map
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.initCache = initCache;
|
|
4
|
+
exports.cachePut = cachePut;
|
|
5
|
+
exports.cacheGet = cacheGet;
|
|
6
|
+
exports.cacheClear = cacheClear;
|
|
7
|
+
const fiori_generator_shared_1 = require("@sap-ux/fiori-generator-shared");
|
|
8
|
+
const ADP_CACHE_KEY = '$adp-generator-cache';
|
|
9
|
+
/**
|
|
10
|
+
* Initializes the internal cache store on the AppWizard instance if it doesn't exist.
|
|
11
|
+
* This should be called early in the generator lifecycle (typically in the constructor).
|
|
12
|
+
*
|
|
13
|
+
* @param {ILogWrapper} logger - Logger instance used for debugging messages.
|
|
14
|
+
* @param {AppWizardWithCache} [wizard] - The AppWizard instance to augment with cache storage.
|
|
15
|
+
* @returns {void}
|
|
16
|
+
*/
|
|
17
|
+
function initCache(logger, wizard) {
|
|
18
|
+
if (wizard && !wizard[ADP_CACHE_KEY]) {
|
|
19
|
+
wizard[ADP_CACHE_KEY] = {};
|
|
20
|
+
logger.debug('ADP-wizard cache initialised.');
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Stores or merges partial generator state in the AppWizard’s cache.
|
|
25
|
+
*
|
|
26
|
+
* @param {AppWizardWithCache | undefined} wizard - The AppWizard instance (may be undefined).
|
|
27
|
+
* @param {Partial<State>} state - Partial state object to cache.
|
|
28
|
+
* @param {ILogWrapper} logger - Logger instance for diagnostics.
|
|
29
|
+
* @returns {void}
|
|
30
|
+
*/
|
|
31
|
+
function cachePut(wizard, state, logger) {
|
|
32
|
+
ensureCache(logger, wizard);
|
|
33
|
+
if (wizard?.[ADP_CACHE_KEY]) {
|
|
34
|
+
Object.assign(wizard[ADP_CACHE_KEY], state);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Retrieves a cached value from the AppWizard instance by key.
|
|
39
|
+
*
|
|
40
|
+
* @template T
|
|
41
|
+
* @param {AppWizardWithCache | undefined} wizard - The AppWizard instance with cache.
|
|
42
|
+
* @param {keyof State} key - The key to retrieve from the cached state.
|
|
43
|
+
* @param {ILogWrapper} logger - Logger instance used for diagnostics.
|
|
44
|
+
* @returns {T | undefined} - The cached value if present, otherwise `undefined`.
|
|
45
|
+
*/
|
|
46
|
+
function cacheGet(wizard, key, logger) {
|
|
47
|
+
ensureCache(logger, wizard);
|
|
48
|
+
return wizard?.[ADP_CACHE_KEY]?.[key];
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Clears the entire generator state cache from the AppWizard instance.
|
|
52
|
+
*
|
|
53
|
+
* @param {AppWizardWithCache | undefined} wizard - The AppWizard instance with cache to clear.
|
|
54
|
+
* @param {ILogWrapper} logger - Logger instance for diagnostics.
|
|
55
|
+
* @returns {void}
|
|
56
|
+
*/
|
|
57
|
+
function cacheClear(wizard, logger) {
|
|
58
|
+
ensureCache(logger, wizard);
|
|
59
|
+
if (wizard?.[ADP_CACHE_KEY]) {
|
|
60
|
+
delete wizard[ADP_CACHE_KEY];
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Logs a warning if caching is attempted in VS Code but the cache hasn’t been initialized.
|
|
65
|
+
* This is a guard to ensure callers run `initCache()` before interacting with the cache.
|
|
66
|
+
*
|
|
67
|
+
* @param {ILogWrapper} logger - Logger instance for diagnostics.
|
|
68
|
+
* @param {AppWizardWithCache | undefined} wizard - The AppWizard instance to check.
|
|
69
|
+
* @returns {void}
|
|
70
|
+
*/
|
|
71
|
+
function ensureCache(logger, wizard) {
|
|
72
|
+
const hostEnv = (0, fiori_generator_shared_1.getHostEnvironment)();
|
|
73
|
+
if (hostEnv === fiori_generator_shared_1.hostEnvironment.vscode && !wizard?.[ADP_CACHE_KEY]) {
|
|
74
|
+
logger.info('Warning: caching is not supported');
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=appWizardCache.js.map
|
package/generators/utils/deps.js
CHANGED
|
@@ -15,15 +15,26 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
36
|
+
exports.getPackageInfo = getPackageInfo;
|
|
37
|
+
exports.installDependencies = installDependencies;
|
|
27
38
|
const path_1 = require("path");
|
|
28
39
|
const util = __importStar(require("util"));
|
|
29
40
|
const fs_1 = require("fs");
|
|
@@ -36,7 +47,6 @@ const child_process_1 = require("child_process");
|
|
|
36
47
|
function getPackageInfo() {
|
|
37
48
|
return JSON.parse((0, fs_1.readFileSync)((0, path_1.join)(__dirname, '../../package.json'), 'utf-8'));
|
|
38
49
|
}
|
|
39
|
-
exports.getPackageInfo = getPackageInfo;
|
|
40
50
|
/**
|
|
41
51
|
* Installs dependencies in the project directory.
|
|
42
52
|
*
|
|
@@ -51,5 +61,4 @@ async function installDependencies(projectPath) {
|
|
|
51
61
|
throw new Error('Installation of dependencies failed.');
|
|
52
62
|
}
|
|
53
63
|
}
|
|
54
|
-
exports.installDependencies = installDependencies;
|
|
55
64
|
//# sourceMappingURL=deps.js.map
|
package/generators/utils/i18n.js
CHANGED
|
@@ -3,7 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.initI18n = initI18n;
|
|
7
|
+
exports.t = t;
|
|
7
8
|
const i18next_1 = __importDefault(require("i18next"));
|
|
8
9
|
const inquirer_common_1 = require("@sap-ux/inquirer-common");
|
|
9
10
|
const project_input_validator_1 = require("@sap-ux/project-input-validator");
|
|
@@ -17,7 +18,6 @@ async function initI18n() {
|
|
|
17
18
|
(0, inquirer_common_1.addi18nResourceBundle)();
|
|
18
19
|
(0, project_input_validator_1.addi18nResourceBundle)();
|
|
19
20
|
}
|
|
20
|
-
exports.initI18n = initI18n;
|
|
21
21
|
/**
|
|
22
22
|
* Helper function facading the call to i18next. Unless a namespace option is provided the local namespace will be used.
|
|
23
23
|
*
|
|
@@ -31,7 +31,6 @@ function t(key, options) {
|
|
|
31
31
|
}
|
|
32
32
|
return i18next_1.default.t(key, options);
|
|
33
33
|
}
|
|
34
|
-
exports.t = t;
|
|
35
34
|
initI18n().catch(() => {
|
|
36
35
|
// Needed for lint
|
|
37
36
|
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { IChildLogger } from '@vscode-logging/logger';
|
|
2
|
+
import type { AdpGeneratorOptions } from '../app/types';
|
|
3
|
+
/**
|
|
4
|
+
* Sets the header title in the AppWizard UI, if the `setHeaderTitle` method is available.
|
|
5
|
+
* This helps users identify the generator and its version in the Yeoman UI interface.
|
|
6
|
+
*
|
|
7
|
+
* @param {AdpGeneratorOptions} opts - The generator options, potentially including the AppWizard instance.
|
|
8
|
+
* @param {IChildLogger} logger - Logger instance used for logging any errors that occur during execution.
|
|
9
|
+
*/
|
|
10
|
+
export declare function setHeaderTitle(opts: AdpGeneratorOptions, logger: IChildLogger): void;
|
|
11
|
+
//# sourceMappingURL=opts.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setHeaderTitle = setHeaderTitle;
|
|
4
|
+
const deps_1 = require("./deps");
|
|
5
|
+
/**
|
|
6
|
+
* Sets the header title in the AppWizard UI, if the `setHeaderTitle` method is available.
|
|
7
|
+
* This helps users identify the generator and its version in the Yeoman UI interface.
|
|
8
|
+
*
|
|
9
|
+
* @param {AdpGeneratorOptions} opts - The generator options, potentially including the AppWizard instance.
|
|
10
|
+
* @param {IChildLogger} logger - Logger instance used for logging any errors that occur during execution.
|
|
11
|
+
*/
|
|
12
|
+
function setHeaderTitle(opts, logger) {
|
|
13
|
+
try {
|
|
14
|
+
if (typeof opts?.appWizard?.setHeaderTitle === 'function') {
|
|
15
|
+
const { name = '', version = '', displayName = '' } = (0, deps_1.getPackageInfo)();
|
|
16
|
+
if (name && version) {
|
|
17
|
+
opts.appWizard.setHeaderTitle(displayName || name, `${name}@${version}`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
catch (e) {
|
|
22
|
+
logger.error(`An error occurred while trying to set '@sap-ux/generator-adp' header: ${e.message}`);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=opts.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getFirstArgAsString = getFirstArgAsString;
|
|
4
|
+
exports.parseJsonInput = parseJsonInput;
|
|
4
5
|
const type_guards_1 = require("./type-guards");
|
|
5
6
|
/**
|
|
6
7
|
* Returns the first argument from a list of CLI arguments. If the first argument
|
|
@@ -18,7 +19,6 @@ function getFirstArgAsString(args) {
|
|
|
18
19
|
}
|
|
19
20
|
return '';
|
|
20
21
|
}
|
|
21
|
-
exports.getFirstArgAsString = getFirstArgAsString;
|
|
22
22
|
/**
|
|
23
23
|
* Parse a json string as an object conforming to the {@link JsonInput} interface.
|
|
24
24
|
*
|
|
@@ -40,5 +40,4 @@ function parseJsonInput(jsonString, logger) {
|
|
|
40
40
|
return undefined;
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
exports.parseJsonInput = parseJsonInput;
|
|
44
43
|
//# sourceMappingURL=parse-json-input.js.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Prompts as YeomanUiSteps, IPrompt } from '@sap-devx/yeoman-ui-types';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the list of base wizard pages used in the Adaptation Project.
|
|
4
|
+
*
|
|
5
|
+
* @returns {IPrompt[]} The list of static wizard steps to show initially.
|
|
6
|
+
*/
|
|
7
|
+
export declare function getWizardPages(): IPrompt[];
|
|
8
|
+
/**
|
|
9
|
+
* Returns the FLP configuration page step.
|
|
10
|
+
*
|
|
11
|
+
* @returns {IPrompt} The FLP configuration wizard page.
|
|
12
|
+
*/
|
|
13
|
+
export declare function getFlpPage(): IPrompt;
|
|
14
|
+
/**
|
|
15
|
+
* Returns the deploy configuration page step.
|
|
16
|
+
*
|
|
17
|
+
* @returns {IPrompt} The deployment configuration wizard page.
|
|
18
|
+
*/
|
|
19
|
+
export declare function getDeployPage(): IPrompt;
|
|
20
|
+
/**
|
|
21
|
+
* Dynamically adds or removes a step in the Yeoman UI wizard.
|
|
22
|
+
*
|
|
23
|
+
* If `shouldAdd` is true and the step is not already in the list, it is inserted
|
|
24
|
+
* after the step with name `insertAfter` (or at the end if not found).
|
|
25
|
+
* If the step is already in the list and `shouldAdd` is false, it is removed.
|
|
26
|
+
*
|
|
27
|
+
* If the step exists and needs to be moved (based on desired insertion point),
|
|
28
|
+
* it is repositioned accordingly.
|
|
29
|
+
*
|
|
30
|
+
* @param {YeomanUiSteps} prompts - The Yeoman UI Prompts container object.
|
|
31
|
+
* @param {IPrompt} step - The step to add or remove.
|
|
32
|
+
* @param {string} [insertAfter] - Optional name of the step after which to insert.
|
|
33
|
+
* @param {boolean} [shouldAdd] - Whether to add (`true`) or remove (`false`) the step.
|
|
34
|
+
*/
|
|
35
|
+
export declare function updateWizardSteps(prompts: YeomanUiSteps, step: IPrompt, insertAfter?: string, shouldAdd?: boolean): void;
|
|
36
|
+
//# sourceMappingURL=steps.d.ts.map
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getWizardPages = getWizardPages;
|
|
4
|
+
exports.getFlpPage = getFlpPage;
|
|
5
|
+
exports.getDeployPage = getDeployPage;
|
|
6
|
+
exports.updateWizardSteps = updateWizardSteps;
|
|
7
|
+
const i18n_1 = require("./i18n");
|
|
8
|
+
/**
|
|
9
|
+
* Returns the list of base wizard pages used in the Adaptation Project.
|
|
10
|
+
*
|
|
11
|
+
* @returns {IPrompt[]} The list of static wizard steps to show initially.
|
|
12
|
+
*/
|
|
13
|
+
function getWizardPages() {
|
|
14
|
+
return [
|
|
15
|
+
{
|
|
16
|
+
name: (0, i18n_1.t)('yuiNavSteps.configurationName'),
|
|
17
|
+
description: (0, i18n_1.t)('yuiNavSteps.configurationDescr')
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: (0, i18n_1.t)('yuiNavSteps.projectAttributesName'),
|
|
21
|
+
description: (0, i18n_1.t)('yuiNavSteps.projectAttributesDescr')
|
|
22
|
+
}
|
|
23
|
+
];
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Returns the FLP configuration page step.
|
|
27
|
+
*
|
|
28
|
+
* @returns {IPrompt} The FLP configuration wizard page.
|
|
29
|
+
*/
|
|
30
|
+
function getFlpPage() {
|
|
31
|
+
return {
|
|
32
|
+
name: (0, i18n_1.t)('yuiNavSteps.flpConfigName'),
|
|
33
|
+
description: (0, i18n_1.t)('yuiNavSteps.flpConfigDescr')
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Returns the deploy configuration page step.
|
|
38
|
+
*
|
|
39
|
+
* @returns {IPrompt} The deployment configuration wizard page.
|
|
40
|
+
*/
|
|
41
|
+
function getDeployPage() {
|
|
42
|
+
return { name: (0, i18n_1.t)('yuiNavSteps.deployConfigName'), description: (0, i18n_1.t)('yuiNavSteps.deployConfigDescr') };
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Dynamically adds or removes a step in the Yeoman UI wizard.
|
|
46
|
+
*
|
|
47
|
+
* If `shouldAdd` is true and the step is not already in the list, it is inserted
|
|
48
|
+
* after the step with name `insertAfter` (or at the end if not found).
|
|
49
|
+
* If the step is already in the list and `shouldAdd` is false, it is removed.
|
|
50
|
+
*
|
|
51
|
+
* If the step exists and needs to be moved (based on desired insertion point),
|
|
52
|
+
* it is repositioned accordingly.
|
|
53
|
+
*
|
|
54
|
+
* @param {YeomanUiSteps} prompts - The Yeoman UI Prompts container object.
|
|
55
|
+
* @param {IPrompt} step - The step to add or remove.
|
|
56
|
+
* @param {string} [insertAfter] - Optional name of the step after which to insert.
|
|
57
|
+
* @param {boolean} [shouldAdd] - Whether to add (`true`) or remove (`false`) the step.
|
|
58
|
+
*/
|
|
59
|
+
function updateWizardSteps(prompts, step, insertAfter = '', shouldAdd = true) {
|
|
60
|
+
const pages = prompts['items'];
|
|
61
|
+
const existingIdx = pages.findIndex((p) => p.name === step.name);
|
|
62
|
+
if (shouldAdd) {
|
|
63
|
+
// Decide the desired index
|
|
64
|
+
const afterIdx = pages.findIndex((p) => p.name === insertAfter);
|
|
65
|
+
const targetIdx = afterIdx === -1 ? pages.length : afterIdx + 1;
|
|
66
|
+
// Page already there → move it
|
|
67
|
+
if (existingIdx !== -1) {
|
|
68
|
+
if (existingIdx === targetIdx) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const [existingStep] = pages.splice(existingIdx, 1);
|
|
72
|
+
prompts.splice(targetIdx > existingIdx ? targetIdx - 1 : targetIdx, 0, [existingStep]);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
// Page not there → insert it
|
|
76
|
+
prompts.splice(targetIdx, 0, [step]);
|
|
77
|
+
}
|
|
78
|
+
else if (existingIdx !== -1) {
|
|
79
|
+
prompts.splice(existingIdx, 1, []);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=steps.js.map
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type Generator from 'yeoman-generator';
|
|
2
|
+
import { type AppWizard } from '@sap-devx/yeoman-ui-types';
|
|
3
|
+
import type { Manifest } from '@sap-ux/project-access';
|
|
4
|
+
import type { ILogWrapper } from '@sap-ux/fiori-generator-shared';
|
|
5
|
+
import type { ConfigAnswers, AttributesAnswers, SystemLookup } from '@sap-ux/adp-tooling';
|
|
6
|
+
/**
|
|
7
|
+
* Parameters required for composing the extension project generator.
|
|
8
|
+
*/
|
|
9
|
+
interface ExtProjectGenProps {
|
|
10
|
+
configAnswers: ConfigAnswers;
|
|
11
|
+
attributeAnswers: AttributesAnswers;
|
|
12
|
+
systemLookup: SystemLookup;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Parameters required for composing the FLP config generator.
|
|
16
|
+
*/
|
|
17
|
+
interface FlpGenProps {
|
|
18
|
+
projectRootPath: string;
|
|
19
|
+
system: string;
|
|
20
|
+
manifest: Manifest;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Options required to invoke the deploy-config subgenerator.
|
|
24
|
+
*/
|
|
25
|
+
interface DeployGenOptions {
|
|
26
|
+
projectName: string;
|
|
27
|
+
targetFolder: string;
|
|
28
|
+
client?: string;
|
|
29
|
+
connectedSystem: string;
|
|
30
|
+
destinationName?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Composes the FLP config sub-generator using `composeWith`. This generator is used to scaffold
|
|
34
|
+
* the FLP (Fiori Launchpad) configuration for the project.
|
|
35
|
+
*
|
|
36
|
+
* @param {FlpGenProps} options - Configuration object for the FLP generator.
|
|
37
|
+
* @param {string} options.projectRootPath - Full path to the root of the project.
|
|
38
|
+
* @param {string} options.system - System identifier string.
|
|
39
|
+
* @param {Manifest} options.manifest - The manifest object to pass to the FLP generator.
|
|
40
|
+
* @param {Generator['composeWith']} composeWith - `composeWith` method provided by Yeoman Generator instance.
|
|
41
|
+
* @param {ILogWrapper} logger - Logger instance for tracking operations and errors.
|
|
42
|
+
* @param {AppWizard} appWizard - AppWizard instance for interacting with the UI (optional).
|
|
43
|
+
*/
|
|
44
|
+
export declare function addFlpGen({ projectRootPath, system, manifest }: FlpGenProps, composeWith: Generator['composeWith'], logger: ILogWrapper, appWizard: AppWizard): void;
|
|
45
|
+
/**
|
|
46
|
+
* Composes the Fiori deploy-config sub-generator using `composeWith`. This sub-generator configures
|
|
47
|
+
* deployment for Fiori applications, such as to ABAP or Cloud Foundry environments.
|
|
48
|
+
*
|
|
49
|
+
* @param {DeployGenOptions} options - Deployment generator input options
|
|
50
|
+
* @param {string} options.projectName - Project name
|
|
51
|
+
* @param {string} options.targetFolder - Folder where project will be generated
|
|
52
|
+
* @param {string} options.applicationType - Type of application being deployed
|
|
53
|
+
* @param {string} options.client - (Optional) ABAP client number
|
|
54
|
+
* @param {string} options.connectedSystem - (Optional) Connected system data
|
|
55
|
+
* @param {string} options.destinationName - (Optional) Destination name for deployment
|
|
56
|
+
* @param {Generator['composeWith']} composeWith - Yeoman composeWith method from generator context
|
|
57
|
+
* @param {ILogWrapper} logger - Logger for info and error output
|
|
58
|
+
* @param {AppWizard} appWizard - Optional AppWizard instance for displaying UI messages
|
|
59
|
+
*/
|
|
60
|
+
export declare function addDeployGen({ projectName, targetFolder, client, connectedSystem, destinationName }: DeployGenOptions, composeWith: Generator['composeWith'], logger: ILogWrapper, appWizard: AppWizard): void;
|
|
61
|
+
/**
|
|
62
|
+
* Composes the extension project sub-generator if the base app is unsupported.
|
|
63
|
+
*
|
|
64
|
+
* @param {ExtProjectGenProps} options - Required options for composing the generator.
|
|
65
|
+
* @param {ConfigAnswers} options.configAnswers - The collected config prompt answers.
|
|
66
|
+
* @param {AttributesAnswers} options.attributeAnswers - The collected attribute prompt answers.
|
|
67
|
+
* @param {SystemLookup} options.systemLookup - Instance of the system lookup.
|
|
68
|
+
* @param {Generator['composeWith']} composeWith - `composeWith` method provided by Yeoman Generator instance.
|
|
69
|
+
* @param {ILogWrapper} logger - Logger instance for tracking operations and errors.
|
|
70
|
+
* @param {AppWizard} appWizard - AppWizard instance for interacting with the UI (optional).
|
|
71
|
+
*/
|
|
72
|
+
export declare function addExtProjectGen({ configAnswers, attributeAnswers, systemLookup }: ExtProjectGenProps, composeWith: Generator['composeWith'], logger: ILogWrapper, appWizard?: AppWizard): Promise<void>;
|
|
73
|
+
export {};
|
|
74
|
+
//# sourceMappingURL=subgenHelpers.d.ts.map
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addFlpGen = addFlpGen;
|
|
4
|
+
exports.addDeployGen = addDeployGen;
|
|
5
|
+
exports.addExtProjectGen = addExtProjectGen;
|
|
6
|
+
const i18n_1 = require("./i18n");
|
|
7
|
+
const extension_project_1 = require("../app/extension-project");
|
|
8
|
+
/**
|
|
9
|
+
* Composes the FLP config sub-generator using `composeWith`. This generator is used to scaffold
|
|
10
|
+
* the FLP (Fiori Launchpad) configuration for the project.
|
|
11
|
+
*
|
|
12
|
+
* @param {FlpGenProps} options - Configuration object for the FLP generator.
|
|
13
|
+
* @param {string} options.projectRootPath - Full path to the root of the project.
|
|
14
|
+
* @param {string} options.system - System identifier string.
|
|
15
|
+
* @param {Manifest} options.manifest - The manifest object to pass to the FLP generator.
|
|
16
|
+
* @param {Generator['composeWith']} composeWith - `composeWith` method provided by Yeoman Generator instance.
|
|
17
|
+
* @param {ILogWrapper} logger - Logger instance for tracking operations and errors.
|
|
18
|
+
* @param {AppWizard} appWizard - AppWizard instance for interacting with the UI (optional).
|
|
19
|
+
*/
|
|
20
|
+
function addFlpGen({ projectRootPath, system, manifest }, composeWith, logger, appWizard) {
|
|
21
|
+
try {
|
|
22
|
+
/**
|
|
23
|
+
* We are using this namespace for now because '@sap-ux/adp-flp-config-sub-generator' is not yet bundled in '@sap/generator-fiori'.
|
|
24
|
+
*/
|
|
25
|
+
composeWith(require.resolve('@sap-ux/adp-flp-config-sub-generator/generators/app'), {
|
|
26
|
+
launchAsSubGen: true,
|
|
27
|
+
manifest,
|
|
28
|
+
system,
|
|
29
|
+
data: { projectRootPath },
|
|
30
|
+
appWizard
|
|
31
|
+
});
|
|
32
|
+
logger.info(`'@sap-ux/adp-flp-config-sub-generator' was called.`);
|
|
33
|
+
}
|
|
34
|
+
catch (e) {
|
|
35
|
+
logger.error(e);
|
|
36
|
+
throw new Error(`Could not call '@sap-ux/adp-flp-config-sub-generator' sub-generator: ${e.message}`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Composes the Fiori deploy-config sub-generator using `composeWith`. This sub-generator configures
|
|
41
|
+
* deployment for Fiori applications, such as to ABAP or Cloud Foundry environments.
|
|
42
|
+
*
|
|
43
|
+
* @param {DeployGenOptions} options - Deployment generator input options
|
|
44
|
+
* @param {string} options.projectName - Project name
|
|
45
|
+
* @param {string} options.targetFolder - Folder where project will be generated
|
|
46
|
+
* @param {string} options.applicationType - Type of application being deployed
|
|
47
|
+
* @param {string} options.client - (Optional) ABAP client number
|
|
48
|
+
* @param {string} options.connectedSystem - (Optional) Connected system data
|
|
49
|
+
* @param {string} options.destinationName - (Optional) Destination name for deployment
|
|
50
|
+
* @param {Generator['composeWith']} composeWith - Yeoman composeWith method from generator context
|
|
51
|
+
* @param {ILogWrapper} logger - Logger for info and error output
|
|
52
|
+
* @param {AppWizard} appWizard - Optional AppWizard instance for displaying UI messages
|
|
53
|
+
*/
|
|
54
|
+
function addDeployGen({ projectName, targetFolder, client, connectedSystem, destinationName }, composeWith, logger, appWizard) {
|
|
55
|
+
try {
|
|
56
|
+
const generatorOptions = {
|
|
57
|
+
launchDeployConfigAsSubGenerator: true,
|
|
58
|
+
projectName,
|
|
59
|
+
projectPath: targetFolder,
|
|
60
|
+
telemetryData: { appType: 'Fiori Adaptation' },
|
|
61
|
+
appWizard,
|
|
62
|
+
logWrapper: logger,
|
|
63
|
+
target: 'abap',
|
|
64
|
+
...(client && { appGenClient: client }),
|
|
65
|
+
...(connectedSystem && { connectedSystem }),
|
|
66
|
+
...(destinationName && { appGenDestination: destinationName })
|
|
67
|
+
};
|
|
68
|
+
composeWith('@sap/fiori:deploy-config', generatorOptions);
|
|
69
|
+
logger.info(`'@sap/fiori:deploy-config' was called.`);
|
|
70
|
+
}
|
|
71
|
+
catch (e) {
|
|
72
|
+
logger.error(e);
|
|
73
|
+
throw new Error(`Could not call '@sap/fiori:deploy-config' sub-generator: ${e.message}`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Composes the extension project sub-generator if the base app is unsupported.
|
|
78
|
+
*
|
|
79
|
+
* @param {ExtProjectGenProps} options - Required options for composing the generator.
|
|
80
|
+
* @param {ConfigAnswers} options.configAnswers - The collected config prompt answers.
|
|
81
|
+
* @param {AttributesAnswers} options.attributeAnswers - The collected attribute prompt answers.
|
|
82
|
+
* @param {SystemLookup} options.systemLookup - Instance of the system lookup.
|
|
83
|
+
* @param {Generator['composeWith']} composeWith - `composeWith` method provided by Yeoman Generator instance.
|
|
84
|
+
* @param {ILogWrapper} logger - Logger instance for tracking operations and errors.
|
|
85
|
+
* @param {AppWizard} appWizard - AppWizard instance for interacting with the UI (optional).
|
|
86
|
+
*/
|
|
87
|
+
async function addExtProjectGen({ configAnswers, attributeAnswers, systemLookup }, composeWith, logger, appWizard) {
|
|
88
|
+
try {
|
|
89
|
+
const data = await (0, extension_project_1.getExtensionProjectData)(configAnswers, attributeAnswers, systemLookup);
|
|
90
|
+
const generator = (0, extension_project_1.resolveNodeModuleGenerator)();
|
|
91
|
+
composeWith(generator, {
|
|
92
|
+
arguments: [JSON.stringify(data)],
|
|
93
|
+
appWizard
|
|
94
|
+
});
|
|
95
|
+
logger.info(`'@bas-dev/generator-extensibility-sub' was called.`);
|
|
96
|
+
}
|
|
97
|
+
catch (e) {
|
|
98
|
+
logger.info((0, i18n_1.t)('error.creatingExtensionProjectError'));
|
|
99
|
+
logger.error(e);
|
|
100
|
+
throw new Error(`Could not call '@bas-dev/generator-extensibility-sub' sub-generator: ${e.message}`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=subgenHelpers.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.isString = isString;
|
|
4
|
+
exports.isJsonInput = isJsonInput;
|
|
4
5
|
/**
|
|
5
6
|
* Type guard for a string values.
|
|
6
7
|
*
|
|
@@ -10,7 +11,6 @@ exports.isJsonInput = exports.isString = void 0;
|
|
|
10
11
|
function isString(value) {
|
|
11
12
|
return typeof value === 'string';
|
|
12
13
|
}
|
|
13
|
-
exports.isString = isString;
|
|
14
14
|
/**
|
|
15
15
|
* Type guard for an adaptation project configuration json.
|
|
16
16
|
*
|
|
@@ -31,7 +31,6 @@ function isJsonInput(value) {
|
|
|
31
31
|
isOptionalString(value.projectName) &&
|
|
32
32
|
isOptionalString(value.namespace));
|
|
33
33
|
}
|
|
34
|
-
exports.isJsonInput = isJsonInput;
|
|
35
34
|
/**
|
|
36
35
|
* Type guard for a plain javascript object.
|
|
37
36
|
*
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@sap-ux/generator-adp",
|
|
3
3
|
"displayName": "SAPUI5 Adaptation Project",
|
|
4
4
|
"description": "Adaptation project allows you to create an app variant for an existing SAP Fiori elements-based or SAPUI5 freestyle application, without changing the original application.",
|
|
5
|
-
"version": "0.3.
|
|
5
|
+
"version": "0.3.17",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
"yeoman-generator"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@sap-devx/yeoman-ui-types": "1.
|
|
27
|
+
"@sap-devx/yeoman-ui-types": "1.16.9",
|
|
28
28
|
"@sap-devx/feature-toggle-node": "2.0.3",
|
|
29
29
|
"i18next": "23.5.1",
|
|
30
30
|
"yeoman-generator": "5.10.0",
|
|
31
31
|
"uuid": "10.0.0",
|
|
32
|
-
"@sap-ux/adp-tooling": "0.14.
|
|
32
|
+
"@sap-ux/adp-tooling": "0.14.17",
|
|
33
33
|
"@sap-ux/axios-extension": "1.21.2",
|
|
34
34
|
"@sap-ux/btp-utils": "1.1.0",
|
|
35
35
|
"@sap-ux/feature-toggle": "0.3.0",
|
|
@@ -39,7 +39,8 @@
|
|
|
39
39
|
"@sap-ux/store": "1.1.0",
|
|
40
40
|
"@sap-ux/system-access": "0.6.2",
|
|
41
41
|
"@sap-ux/project-input-validator": "0.6.2",
|
|
42
|
-
"@sap-ux/fiori-generator-shared": "0.12.7"
|
|
42
|
+
"@sap-ux/fiori-generator-shared": "0.12.7",
|
|
43
|
+
"@sap-ux/adp-flp-config-sub-generator": "0.1.17"
|
|
43
44
|
},
|
|
44
45
|
"devDependencies": {
|
|
45
46
|
"@jest/types": "29.6.3",
|
|
@@ -53,8 +54,8 @@
|
|
|
53
54
|
"@vscode-logging/logger": "2.0.0",
|
|
54
55
|
"fs-extra": "10.0.0",
|
|
55
56
|
"rimraf": "5.0.5",
|
|
56
|
-
"
|
|
57
|
-
"
|
|
57
|
+
"yeoman-test": "6.3.0",
|
|
58
|
+
"@sap-ux/deploy-config-sub-generator": "0.3.7"
|
|
58
59
|
},
|
|
59
60
|
"engines": {
|
|
60
61
|
"node": ">=20.x"
|