@sap-ux/generator-adp 1.0.47 → 1.0.49
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/index.d.ts +4 -0
- package/generators/app/index.js +9 -1
- package/generators/app/types.d.ts +10 -5
- package/generators/utils/json-input-file.d.ts +9 -0
- package/generators/utils/json-input-file.js +38 -0
- package/generators/utils/type-guards.d.ts +8 -1
- package/generators/utils/type-guards.js +12 -3
- package/package.json +11 -11
|
@@ -56,6 +56,10 @@ export default class extends Generator {
|
|
|
56
56
|
* passed as a CLI argument.
|
|
57
57
|
*/
|
|
58
58
|
private readonly jsonInput?;
|
|
59
|
+
/**
|
|
60
|
+
* Parsed `{tmpdir}/{id}.txt` when JSON input includes `id`.
|
|
61
|
+
*/
|
|
62
|
+
private jsonInputFile?;
|
|
59
63
|
/**
|
|
60
64
|
* Instance of AbapServiceProvider.
|
|
61
65
|
*/
|
package/generators/app/index.js
CHANGED
|
@@ -16,6 +16,7 @@ const feature_toggle_1 = require("@sap-ux/feature-toggle");
|
|
|
16
16
|
const appWizardCache_js_1 = require("../utils/appWizardCache.js");
|
|
17
17
|
const deps_js_1 = require("../utils/deps.js");
|
|
18
18
|
const i18n_js_1 = require("../utils/i18n.js");
|
|
19
|
+
const json_input_file_js_1 = require("../utils/json-input-file.js");
|
|
19
20
|
const logger_js_1 = __importDefault(require("../utils/logger.js"));
|
|
20
21
|
const opts_js_1 = require("../utils/opts.js");
|
|
21
22
|
const parse_json_input_js_1 = require("../utils/parse-json-input.js");
|
|
@@ -92,6 +93,10 @@ class default_1 extends yeoman_generator_1.default {
|
|
|
92
93
|
* passed as a CLI argument.
|
|
93
94
|
*/
|
|
94
95
|
jsonInput;
|
|
96
|
+
/**
|
|
97
|
+
* Parsed `{tmpdir}/{id}.txt` when JSON input includes `id`.
|
|
98
|
+
*/
|
|
99
|
+
jsonInputFile;
|
|
95
100
|
/**
|
|
96
101
|
* Instance of AbapServiceProvider.
|
|
97
102
|
*/
|
|
@@ -318,7 +323,7 @@ class default_1 extends yeoman_generator_1.default {
|
|
|
318
323
|
const provider = this.jsonInput ? this.abapProvider : this.prompter.provider;
|
|
319
324
|
const publicVersions = this.jsonInput ? this.publicVersions : this.prompter.ui5.publicVersions;
|
|
320
325
|
const manifest = this.jsonInput ? this.manifest : this.prompter.manifest;
|
|
321
|
-
const keyUserChanges = this.jsonInput ? this.
|
|
326
|
+
const keyUserChanges = this.jsonInput ? this.jsonInputFile?.keyUserChanges : this.keyUserPrompter?.changes;
|
|
322
327
|
const projectType = this._getProjectType();
|
|
323
328
|
const packageJson = (0, deps_js_1.getPackageInfo)();
|
|
324
329
|
const config = await (0, adp_tooling_1.getConfig)({
|
|
@@ -616,6 +621,9 @@ class default_1 extends yeoman_generator_1.default {
|
|
|
616
621
|
if (!this.jsonInput) {
|
|
617
622
|
return;
|
|
618
623
|
}
|
|
624
|
+
if (this.jsonInput.id) {
|
|
625
|
+
this.jsonInputFile = await (0, json_input_file_js_1.readJsonInputFile)(this.jsonInput.id);
|
|
626
|
+
}
|
|
619
627
|
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;
|
|
620
628
|
await (0, validators_js_1.validateJsonInput)(this.systemLookup, this.isCustomerBase, {
|
|
621
629
|
projectName,
|
|
@@ -249,14 +249,13 @@ export interface ExtensionProjectData {
|
|
|
249
249
|
namespace: string;
|
|
250
250
|
}
|
|
251
251
|
/**
|
|
252
|
-
*
|
|
253
|
-
*
|
|
252
|
+
* CLI JSON for the adaptation project generator.
|
|
253
|
+
*
|
|
254
|
+
* When `id` is set, `{tmpdir}/{id}.txt` may also be loaded (see `readJsonInputFile`).
|
|
254
255
|
*/
|
|
255
256
|
export interface JsonInput {
|
|
256
257
|
/**
|
|
257
|
-
*
|
|
258
|
-
* generation outcome (project path on success, `Failure: <message>` on error) is written back
|
|
259
|
-
* under this key so the orchestrator can poll the result of an async headless generation.
|
|
258
|
+
* Orchestrator correlation id. Keys the result file and `{tmpdir}/{id}.txt`.
|
|
260
259
|
*/
|
|
261
260
|
id?: string;
|
|
262
261
|
system: string;
|
|
@@ -269,6 +268,12 @@ export interface JsonInput {
|
|
|
269
268
|
projectName?: string;
|
|
270
269
|
namespace?: string;
|
|
271
270
|
projectType?: AdaptationProjectType;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Extra JSON from `{tmpdir}/{id}.txt`. BAS writes a `.txt` file whose contents are JSON.
|
|
274
|
+
* Currently `keyUserChanges` only; extra fields are allowed.
|
|
275
|
+
*/
|
|
276
|
+
export interface JsonInputFile {
|
|
272
277
|
keyUserChanges?: KeyUserChangeContent[];
|
|
273
278
|
}
|
|
274
279
|
export declare enum SystemType {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { JsonInputFile } from '../app/types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Reads `{tmpdir}/{id}.txt` if it exists.
|
|
4
|
+
*
|
|
5
|
+
* @param {string} id - Correlation id used as the file name.
|
|
6
|
+
* @returns {Promise<JsonInputFile | undefined>} Parsed JSON, or undefined when the file is missing.
|
|
7
|
+
*/
|
|
8
|
+
export declare function readJsonInputFile(id: string): Promise<JsonInputFile | undefined>;
|
|
9
|
+
//# sourceMappingURL=json-input-file.d.ts.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readJsonInputFile = readJsonInputFile;
|
|
4
|
+
const node_fs_1 = require("node:fs");
|
|
5
|
+
const node_os_1 = require("node:os");
|
|
6
|
+
const node_path_1 = require("node:path");
|
|
7
|
+
const type_guards_js_1 = require("./type-guards.js");
|
|
8
|
+
/**
|
|
9
|
+
* Reads `{tmpdir}/{id}.txt` if it exists.
|
|
10
|
+
*
|
|
11
|
+
* @param {string} id - Correlation id used as the file name.
|
|
12
|
+
* @returns {Promise<JsonInputFile | undefined>} Parsed JSON, or undefined when the file is missing.
|
|
13
|
+
*/
|
|
14
|
+
async function readJsonInputFile(id) {
|
|
15
|
+
const filePath = (0, node_path_1.join)((0, node_os_1.tmpdir)(), `${id}.txt`);
|
|
16
|
+
if (!(0, node_fs_1.existsSync)(filePath)) {
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
let fileContent;
|
|
20
|
+
try {
|
|
21
|
+
fileContent = await node_fs_1.promises.readFile(filePath, 'utf8');
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
throw new Error('Failed to load JSON input file');
|
|
25
|
+
}
|
|
26
|
+
let parsed;
|
|
27
|
+
try {
|
|
28
|
+
parsed = JSON.parse(fileContent);
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
throw new Error('Failed to parse JSON input file');
|
|
32
|
+
}
|
|
33
|
+
if (!(0, type_guards_js_1.isJsonInputFile)(parsed)) {
|
|
34
|
+
throw new Error('Invalid JSON input file format');
|
|
35
|
+
}
|
|
36
|
+
return parsed;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=json-input-file.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { JsonInput } from '../app/types.js';
|
|
1
|
+
import type { JsonInput, JsonInputFile } from '../app/types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Type guard for a string values.
|
|
4
4
|
*
|
|
@@ -13,4 +13,11 @@ export declare function isString(value: unknown): value is string;
|
|
|
13
13
|
* @returns {boolean} True if the value conforms to the AdpJsonInput interface.
|
|
14
14
|
*/
|
|
15
15
|
export declare function isJsonInput(value: unknown): value is JsonInput;
|
|
16
|
+
/**
|
|
17
|
+
* Type guard for JsonInputFile.
|
|
18
|
+
*
|
|
19
|
+
* @param {unknown} value - The value being checked.
|
|
20
|
+
* @returns {boolean} True if the value is a valid JSON input file object.
|
|
21
|
+
*/
|
|
22
|
+
export declare function isJsonInputFile(value: unknown): value is JsonInputFile;
|
|
16
23
|
//# sourceMappingURL=type-guards.d.ts.map
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isString = isString;
|
|
4
4
|
exports.isJsonInput = isJsonInput;
|
|
5
|
+
exports.isJsonInputFile = isJsonInputFile;
|
|
5
6
|
/**
|
|
6
7
|
* Type guard for a string values.
|
|
7
8
|
*
|
|
@@ -30,14 +31,13 @@ function isJsonInput(value) {
|
|
|
30
31
|
isOptionalString(value.password) &&
|
|
31
32
|
isOptionalString(value.targetFolder) &&
|
|
32
33
|
isOptionalString(value.projectName) &&
|
|
33
|
-
isOptionalString(value.namespace)
|
|
34
|
-
isOptionalKeyUserChanges(value.keyUserChanges));
|
|
34
|
+
isOptionalString(value.namespace));
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
37
|
* Type guard for a plain javascript object.
|
|
38
38
|
*
|
|
39
39
|
* @param {unknown} value - The value being checked.
|
|
40
|
-
* @returns {boolean} True if the value is a plain
|
|
40
|
+
* @returns {boolean} True if the value is a plain javascript object.
|
|
41
41
|
*/
|
|
42
42
|
function isPlainObject(value) {
|
|
43
43
|
return typeof value === 'object' && value !== null && Object.getPrototypeOf(value) === Object.prototype;
|
|
@@ -68,4 +68,13 @@ function isOptionalKeyUserChanges(value) {
|
|
|
68
68
|
isPlainObject(item.content) &&
|
|
69
69
|
(item.texts === undefined || isPlainObject(item.texts)));
|
|
70
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* Type guard for JsonInputFile.
|
|
73
|
+
*
|
|
74
|
+
* @param {unknown} value - The value being checked.
|
|
75
|
+
* @returns {boolean} True if the value is a valid JSON input file object.
|
|
76
|
+
*/
|
|
77
|
+
function isJsonInputFile(value) {
|
|
78
|
+
return isPlainObject(value) && isOptionalKeyUserChanges(value.keyUserChanges);
|
|
79
|
+
}
|
|
71
80
|
//# sourceMappingURL=type-guards.js.map
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"displayName": "SAPUI5 Adaptation Project",
|
|
4
4
|
"homepage": "https://help.sap.com/viewer/584e0bcbfd4a4aff91c815cefa0bce2d/Cloud/en-US/ada9567b767941aba8d49fdb4fdedea7.html",
|
|
5
5
|
"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.",
|
|
6
|
-
"version": "1.0.
|
|
6
|
+
"version": "1.0.49",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -30,19 +30,19 @@
|
|
|
30
30
|
"i18next": "26.3.6",
|
|
31
31
|
"yeoman-generator": "5.10.0",
|
|
32
32
|
"uuid": "11.1.1",
|
|
33
|
-
"@sap-ux/adp-tooling": "1.0.
|
|
34
|
-
"@sap-ux/axios-extension": "2.0.
|
|
33
|
+
"@sap-ux/adp-tooling": "1.0.45",
|
|
34
|
+
"@sap-ux/axios-extension": "2.0.9",
|
|
35
35
|
"@sap-ux/btp-utils": "2.0.6",
|
|
36
36
|
"@sap-ux/feature-toggle": "1.0.5",
|
|
37
|
-
"@sap-ux/inquirer-common": "1.0.
|
|
37
|
+
"@sap-ux/inquirer-common": "1.0.32",
|
|
38
38
|
"@sap-ux/logger": "1.0.3",
|
|
39
|
-
"@sap-ux/project-access": "2.1.
|
|
39
|
+
"@sap-ux/project-access": "2.1.11",
|
|
40
40
|
"@sap-ux/store": "2.0.6",
|
|
41
|
-
"@sap-ux/system-access": "1.0.
|
|
42
|
-
"@sap-ux/project-input-validator": "1.0.
|
|
43
|
-
"@sap-ux/fiori-generator-shared": "1.2.
|
|
44
|
-
"@sap-ux/odata-service-writer": "1.0.
|
|
45
|
-
"@sap-ux/telemetry": "1.0.
|
|
41
|
+
"@sap-ux/system-access": "1.0.11",
|
|
42
|
+
"@sap-ux/project-input-validator": "1.0.16",
|
|
43
|
+
"@sap-ux/fiori-generator-shared": "1.2.7",
|
|
44
|
+
"@sap-ux/odata-service-writer": "1.0.19",
|
|
45
|
+
"@sap-ux/telemetry": "1.0.25"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@jest/globals": "30.4.1",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"fs-extra": "11.3.6",
|
|
59
59
|
"rimraf": "6.1.3",
|
|
60
60
|
"yeoman-test": "6.3.0",
|
|
61
|
-
"@sap-ux/deploy-config-sub-generator": "1.0.
|
|
61
|
+
"@sap-ux/deploy-config-sub-generator": "1.0.59"
|
|
62
62
|
},
|
|
63
63
|
"engines": {
|
|
64
64
|
"node": ">=22.x"
|