@sap-ux/adp-tooling 0.5.5 → 0.7.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.
- package/dist/base/prompt.d.ts +9 -8
- package/dist/base/prompt.js +36 -8
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -2
- package/dist/preview/adp-preview.d.ts +2 -1
- package/dist/preview/adp-preview.js +1 -0
- package/dist/preview/routes-handler.d.ts +9 -1
- package/dist/preview/routes-handler.js +54 -1
- package/dist/types.d.ts +53 -0
- package/dist/writer/index.d.ts +1 -1
- package/dist/writer/index.js +14 -43
- package/dist/writer/options.d.ts +31 -0
- package/dist/writer/options.js +113 -0
- package/package.json +3 -3
- package/templates/project/package.json +10 -7
package/dist/base/prompt.d.ts
CHANGED
|
@@ -3,18 +3,19 @@ export declare const enum flexLayer {
|
|
|
3
3
|
CUSTOMER_BASE = "CUSTOMER_BASE",
|
|
4
4
|
VENDOR = "VENDOR"
|
|
5
5
|
}
|
|
6
|
+
export type PromptDefaults = {
|
|
7
|
+
id?: string;
|
|
8
|
+
reference?: string;
|
|
9
|
+
url?: string;
|
|
10
|
+
ft?: boolean;
|
|
11
|
+
package?: string;
|
|
12
|
+
transport?: string;
|
|
13
|
+
};
|
|
6
14
|
/**
|
|
7
15
|
* Prompt the user for the required properties for an adaptation project.
|
|
8
16
|
*
|
|
9
17
|
* @param defaults optional default values for the prompts
|
|
10
|
-
* @param defaults.id initial id to be used for the new adaptation id prompt
|
|
11
|
-
* @param defaults.reference initial id used for the original application id prompt
|
|
12
|
-
* @param defaults.url initial url used for the target url prompt
|
|
13
18
|
* @returns a configuration for the adp writer
|
|
14
19
|
*/
|
|
15
|
-
export declare function promptGeneratorInput(
|
|
16
|
-
id?: string;
|
|
17
|
-
reference?: string;
|
|
18
|
-
url?: string;
|
|
19
|
-
}): Promise<AdpWriterConfig>;
|
|
20
|
+
export declare function promptGeneratorInput(defaults?: PromptDefaults): Promise<AdpWriterConfig>;
|
|
20
21
|
//# sourceMappingURL=prompt.d.ts.map
|
package/dist/base/prompt.js
CHANGED
|
@@ -18,12 +18,10 @@ const prompts_1 = __importDefault(require("prompts"));
|
|
|
18
18
|
* Prompt the user for the required properties for an adaptation project.
|
|
19
19
|
*
|
|
20
20
|
* @param defaults optional default values for the prompts
|
|
21
|
-
* @param defaults.id initial id to be used for the new adaptation id prompt
|
|
22
|
-
* @param defaults.reference initial id used for the original application id prompt
|
|
23
|
-
* @param defaults.url initial url used for the target url prompt
|
|
24
21
|
* @returns a configuration for the adp writer
|
|
25
22
|
*/
|
|
26
|
-
function promptGeneratorInput(
|
|
23
|
+
function promptGeneratorInput(defaults = {}) {
|
|
24
|
+
var _a;
|
|
27
25
|
return __awaiter(this, void 0, void 0, function* () {
|
|
28
26
|
const app = yield (0, prompts_1.default)([
|
|
29
27
|
{
|
|
@@ -46,7 +44,7 @@ function promptGeneratorInput({ id, reference, url } = {}) {
|
|
|
46
44
|
return 'New adaptation id:';
|
|
47
45
|
}
|
|
48
46
|
},
|
|
49
|
-
initial: id,
|
|
47
|
+
initial: defaults.id,
|
|
50
48
|
format: (input, values) => {
|
|
51
49
|
if (values.layer === "CUSTOMER_BASE" /* flexLayer.CUSTOMER_BASE */ && !input.startsWith('customer.')) {
|
|
52
50
|
return `customer.${input}`;
|
|
@@ -61,7 +59,7 @@ function promptGeneratorInput({ id, reference, url } = {}) {
|
|
|
61
59
|
type: 'text',
|
|
62
60
|
name: 'reference',
|
|
63
61
|
message: 'Original application id:',
|
|
64
|
-
initial: reference,
|
|
62
|
+
initial: defaults.reference,
|
|
65
63
|
validate: (input) => (input === null || input === void 0 ? void 0 : input.length) > 0
|
|
66
64
|
},
|
|
67
65
|
{
|
|
@@ -75,11 +73,41 @@ function promptGeneratorInput({ id, reference, url } = {}) {
|
|
|
75
73
|
type: 'text',
|
|
76
74
|
name: 'url',
|
|
77
75
|
message: 'Target system url:',
|
|
78
|
-
initial: url,
|
|
76
|
+
initial: defaults.url,
|
|
77
|
+
validate: (input) => (input === null || input === void 0 ? void 0 : input.length) > 0
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
type: 'text',
|
|
81
|
+
name: 'client',
|
|
82
|
+
message: 'Client (optional):',
|
|
83
|
+
validate: (input) => (input ? input.length < 4 : true)
|
|
84
|
+
}
|
|
85
|
+
]);
|
|
86
|
+
const deploy = yield (0, prompts_1.default)([
|
|
87
|
+
{
|
|
88
|
+
type: 'text',
|
|
89
|
+
name: 'package',
|
|
90
|
+
message: 'Deployment package:',
|
|
91
|
+
initial: (_a = defaults.package) !== null && _a !== void 0 ? _a : '$TMP',
|
|
92
|
+
validate: (input) => (input === null || input === void 0 ? void 0 : input.length) > 0
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
type: 'text',
|
|
96
|
+
name: 'transport',
|
|
97
|
+
message: 'Transport request (optional):',
|
|
98
|
+
initial: defaults.transport
|
|
99
|
+
}
|
|
100
|
+
]);
|
|
101
|
+
const options = yield (0, prompts_1.default)([
|
|
102
|
+
{
|
|
103
|
+
type: 'confirm',
|
|
104
|
+
name: 'fioriTools',
|
|
105
|
+
message: 'Enable Fiori tools?',
|
|
106
|
+
initial: defaults.ft !== false,
|
|
79
107
|
validate: (input) => (input === null || input === void 0 ? void 0 : input.length) > 0
|
|
80
108
|
}
|
|
81
109
|
]);
|
|
82
|
-
return { app, target };
|
|
110
|
+
return { app, target, options, deploy };
|
|
83
111
|
});
|
|
84
112
|
}
|
|
85
113
|
exports.promptGeneratorInput = promptGeneratorInput;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { AdpPreviewConfig, AdpWriterConfig } from './types';
|
|
2
2
|
export * from './preview/adp-preview';
|
|
3
3
|
export { generate } from './writer';
|
|
4
|
-
export
|
|
4
|
+
export { promptGeneratorInput, PromptDefaults } from './base/prompt';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -14,9 +14,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.generate = void 0;
|
|
17
|
+
exports.promptGeneratorInput = exports.generate = void 0;
|
|
18
18
|
__exportStar(require("./preview/adp-preview"), exports);
|
|
19
19
|
var writer_1 = require("./writer");
|
|
20
20
|
Object.defineProperty(exports, "generate", { enumerable: true, get: function () { return writer_1.generate; } });
|
|
21
|
-
|
|
21
|
+
var prompt_1 = require("./base/prompt");
|
|
22
|
+
Object.defineProperty(exports, "promptGeneratorInput", { enumerable: true, get: function () { return prompt_1.promptGeneratorInput; } });
|
|
22
23
|
//# sourceMappingURL=index.js.map
|
|
@@ -7,7 +7,8 @@ import type { MergedAppDescriptor } from '@sap-ux/axios-extension';
|
|
|
7
7
|
import type { AdpPreviewConfig, DescriptorVariant } from '../types';
|
|
8
8
|
export declare const enum ApiRoutes {
|
|
9
9
|
FRAGMENT = "/adp/api/fragment",
|
|
10
|
-
CONTROLLER = "/adp/api/controller"
|
|
10
|
+
CONTROLLER = "/adp/api/controller",
|
|
11
|
+
CODE_EXT = "/adp/api/code_ext/:controllerName"
|
|
11
12
|
}
|
|
12
13
|
/**
|
|
13
14
|
* Instance of an adaptation project handling requests and data transformation.
|
|
@@ -126,6 +126,7 @@ class AdpPreview {
|
|
|
126
126
|
router.post("/adp/api/fragment" /* ApiRoutes.FRAGMENT */, express_1.default.json(), this.routesHandler.handleWriteFragment);
|
|
127
127
|
router.get("/adp/api/controller" /* ApiRoutes.CONTROLLER */, this.routesHandler.handleReadAllControllers);
|
|
128
128
|
router.post("/adp/api/controller" /* ApiRoutes.CONTROLLER */, express_1.default.json(), this.routesHandler.handleWriteControllerExt);
|
|
129
|
+
router.get("/adp/api/code_ext/:controllerName" /* ApiRoutes.CODE_EXT */, this.routesHandler.handleGetControllerExtensionData);
|
|
129
130
|
}
|
|
130
131
|
}
|
|
131
132
|
exports.AdpPreview = AdpPreview;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { ReaderCollection } from '@ui5/fs';
|
|
2
1
|
import type { ToolsLogger } from '@sap-ux/logger';
|
|
3
2
|
import type { MiddlewareUtils } from '@ui5/server';
|
|
3
|
+
import type { ReaderCollection } from '@ui5/fs';
|
|
4
4
|
import type { NextFunction, Request, Response } from 'express';
|
|
5
5
|
/**
|
|
6
6
|
* @description Handles API Routes
|
|
@@ -65,6 +65,14 @@ export default class RoutesHandler {
|
|
|
65
65
|
* @param next Next Function
|
|
66
66
|
*/
|
|
67
67
|
handleReadAllControllers: (_: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
68
|
+
/**
|
|
69
|
+
* Handler for retrieving existing controller extension data from the workspace.
|
|
70
|
+
*
|
|
71
|
+
* @param req Request
|
|
72
|
+
* @param res Response
|
|
73
|
+
* @param next Next Function
|
|
74
|
+
*/
|
|
75
|
+
handleGetControllerExtensionData: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
68
76
|
/**
|
|
69
77
|
* Handler for writing a controller extension file to the workspace.
|
|
70
78
|
*
|
|
@@ -36,9 +36,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
36
|
};
|
|
37
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
38
|
const fs = __importStar(require("fs"));
|
|
39
|
+
const os = __importStar(require("os"));
|
|
39
40
|
const path = __importStar(require("path"));
|
|
40
|
-
const sanitize_filename_1 = __importDefault(require("sanitize-filename"));
|
|
41
41
|
const ejs_1 = require("ejs");
|
|
42
|
+
const sanitize_filename_1 = __importDefault(require("sanitize-filename"));
|
|
42
43
|
/**
|
|
43
44
|
* @description Handles API Routes
|
|
44
45
|
*/
|
|
@@ -141,6 +142,58 @@ class RoutesHandler {
|
|
|
141
142
|
this.handleErrorMessage(res, next, e);
|
|
142
143
|
}
|
|
143
144
|
});
|
|
145
|
+
/**
|
|
146
|
+
* Handler for retrieving existing controller extension data from the workspace.
|
|
147
|
+
*
|
|
148
|
+
* @param req Request
|
|
149
|
+
* @param res Response
|
|
150
|
+
* @param next Next Function
|
|
151
|
+
*/
|
|
152
|
+
this.handleGetControllerExtensionData = (req, res, next) => __awaiter(this, void 0, void 0, function* () {
|
|
153
|
+
try {
|
|
154
|
+
const params = req.params;
|
|
155
|
+
const controllerName = (0, sanitize_filename_1.default)(params.controllerName);
|
|
156
|
+
const codeExtFiles = yield this.readAllFilesByGlob('/**/changes/*_codeExt.change');
|
|
157
|
+
let controllerExists = false;
|
|
158
|
+
let controllerPath = '';
|
|
159
|
+
let controllerPathFromRoot = '';
|
|
160
|
+
const project = this.util.getProject();
|
|
161
|
+
const sourcePath = project.getSourcePath();
|
|
162
|
+
const projectName = project.getName();
|
|
163
|
+
const getPath = (projectPath, fileName) => path
|
|
164
|
+
.join(projectPath, "changes" /* FolderNames.Changes */, "coding" /* FolderNames.Coding */, fileName)
|
|
165
|
+
.split(path.sep)
|
|
166
|
+
.join(path.posix.sep);
|
|
167
|
+
for (const file of codeExtFiles) {
|
|
168
|
+
const fileStr = yield file.getString();
|
|
169
|
+
const change = JSON.parse(fileStr);
|
|
170
|
+
if (change.selector.controllerName === controllerName) {
|
|
171
|
+
const fileName = change.content.codeRef.replace('coding/', '');
|
|
172
|
+
controllerPath = getPath(sourcePath, fileName);
|
|
173
|
+
controllerPathFromRoot = getPath(projectName, fileName);
|
|
174
|
+
controllerExists = true;
|
|
175
|
+
break;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
if (controllerExists && !fs.existsSync(controllerPath)) {
|
|
179
|
+
const errorMsg = `Controller extension file was not found at ${controllerPath}`;
|
|
180
|
+
this.logger.debug(errorMsg);
|
|
181
|
+
res.status(404 /* HttpStatusCodes.NOT_FOUND */).send({ message: errorMsg });
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
this.sendFilesResponse(res, {
|
|
185
|
+
controllerExists,
|
|
186
|
+
controllerPath: os.platform() === 'win32' ? `/${controllerPath}` : controllerPath,
|
|
187
|
+
controllerPathFromRoot
|
|
188
|
+
});
|
|
189
|
+
this.logger.debug(controllerExists
|
|
190
|
+
? `Controller exists at '${controllerPath}'`
|
|
191
|
+
: `Controller with controllerName '${controllerName}' does not exist`);
|
|
192
|
+
}
|
|
193
|
+
catch (e) {
|
|
194
|
+
this.handleErrorMessage(res, next, e);
|
|
195
|
+
}
|
|
196
|
+
});
|
|
144
197
|
/**
|
|
145
198
|
* Handler for writing a controller extension file to the workspace.
|
|
146
199
|
*
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { UI5FlexLayer } from '@sap-ux/project-access';
|
|
2
2
|
import type { DestinationAbapTarget, UrlAbapTarget } from '@sap-ux/system-access';
|
|
3
|
+
import type { Adp } from '@sap-ux/ui5-config';
|
|
3
4
|
export interface DescriptorVariant {
|
|
4
5
|
layer: UI5FlexLayer;
|
|
5
6
|
reference: string;
|
|
@@ -33,6 +34,16 @@ export interface AdpWriterConfig {
|
|
|
33
34
|
name?: string;
|
|
34
35
|
description?: string;
|
|
35
36
|
};
|
|
37
|
+
/**
|
|
38
|
+
* Optional: configuration for deployment to ABAP
|
|
39
|
+
*/
|
|
40
|
+
deploy?: Adp;
|
|
41
|
+
options?: {
|
|
42
|
+
/**
|
|
43
|
+
* Optional: if set to true then the generated project will be recognized by the SAP Fiori tools
|
|
44
|
+
*/
|
|
45
|
+
fioriTools?: boolean;
|
|
46
|
+
};
|
|
36
47
|
}
|
|
37
48
|
export interface ManifestAppdescr {
|
|
38
49
|
fileName: string;
|
|
@@ -49,6 +60,48 @@ export interface Content {
|
|
|
49
60
|
content: object;
|
|
50
61
|
texts?: object;
|
|
51
62
|
}
|
|
63
|
+
interface CommonChangeProperties {
|
|
64
|
+
changeType: string;
|
|
65
|
+
reference: string;
|
|
66
|
+
namespace: string;
|
|
67
|
+
projectId: string;
|
|
68
|
+
moduleName: string;
|
|
69
|
+
support: {
|
|
70
|
+
generator: string;
|
|
71
|
+
sapui5Version: string;
|
|
72
|
+
command?: string;
|
|
73
|
+
};
|
|
74
|
+
originalLanguage: string;
|
|
75
|
+
layer: string;
|
|
76
|
+
fileType: string;
|
|
77
|
+
fileName: string;
|
|
78
|
+
texts: Record<string, unknown>;
|
|
79
|
+
}
|
|
80
|
+
export interface AddXMLChange extends CommonChangeProperties {
|
|
81
|
+
changeType: 'addXML';
|
|
82
|
+
creation: string;
|
|
83
|
+
packageName: string;
|
|
84
|
+
content: {
|
|
85
|
+
targetAggregation: string;
|
|
86
|
+
index: number;
|
|
87
|
+
fragmentPath: string;
|
|
88
|
+
};
|
|
89
|
+
selector: {
|
|
90
|
+
id: string;
|
|
91
|
+
idIsLocal: boolean;
|
|
92
|
+
};
|
|
93
|
+
dependentSelector: Record<string, unknown>;
|
|
94
|
+
jsOnly: boolean;
|
|
95
|
+
}
|
|
96
|
+
export interface CodeExtChange extends CommonChangeProperties {
|
|
97
|
+
changeType: 'codeExt';
|
|
98
|
+
content: {
|
|
99
|
+
codeRef: string;
|
|
100
|
+
};
|
|
101
|
+
selector: {
|
|
102
|
+
controllerName: string;
|
|
103
|
+
};
|
|
104
|
+
}
|
|
52
105
|
export declare const enum FolderNames {
|
|
53
106
|
Changes = "changes",
|
|
54
107
|
Fragments = "fragments",
|
package/dist/writer/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Editor } from 'mem-fs-editor';
|
|
2
2
|
import type { AdpWriterConfig } from '../types';
|
|
3
3
|
/**
|
|
4
|
-
* Writes the adp-project template to the
|
|
4
|
+
* Writes the adp-project template to the mem-fs-editor instance.
|
|
5
5
|
*
|
|
6
6
|
* @param basePath - the base path
|
|
7
7
|
* @param config - the writer configuration
|
package/dist/writer/index.js
CHANGED
|
@@ -14,6 +14,7 @@ const path_1 = require("path");
|
|
|
14
14
|
const mem_fs_1 = require("mem-fs");
|
|
15
15
|
const mem_fs_editor_1 = require("mem-fs-editor");
|
|
16
16
|
const ui5_config_1 = require("@sap-ux/ui5-config");
|
|
17
|
+
const options_1 = require("./options");
|
|
17
18
|
/**
|
|
18
19
|
* Set default values for optional properties.
|
|
19
20
|
*
|
|
@@ -26,7 +27,9 @@ function setDefaults(config) {
|
|
|
26
27
|
const configWithDefaults = {
|
|
27
28
|
app: Object.assign({}, config.app),
|
|
28
29
|
target: Object.assign({}, config.target),
|
|
29
|
-
ui5: Object.assign({}, config.ui5)
|
|
30
|
+
ui5: Object.assign({}, config.ui5),
|
|
31
|
+
deploy: config.deploy ? Object.assign({}, config.deploy) : undefined,
|
|
32
|
+
options: Object.assign({}, config.options)
|
|
30
33
|
};
|
|
31
34
|
(_a = (_f = configWithDefaults.app).title) !== null && _a !== void 0 ? _a : (_f.title = `Adaptation of ${config.app.reference}`);
|
|
32
35
|
(_b = (_g = configWithDefaults.app).layer) !== null && _b !== void 0 ? _b : (_g.layer = 'CUSTOMER_BASE');
|
|
@@ -36,7 +39,7 @@ function setDefaults(config) {
|
|
|
36
39
|
return configWithDefaults;
|
|
37
40
|
}
|
|
38
41
|
/**
|
|
39
|
-
* Writes the adp-project template to the
|
|
42
|
+
* Writes the adp-project template to the mem-fs-editor instance.
|
|
40
43
|
*
|
|
41
44
|
* @param basePath - the base path
|
|
42
45
|
* @param config - the writer configuration
|
|
@@ -56,48 +59,16 @@ function generate(basePath, config, fs) {
|
|
|
56
59
|
});
|
|
57
60
|
// ui5.yaml
|
|
58
61
|
const ui5ConfigPath = (0, path_1.join)(basePath, 'ui5.yaml');
|
|
59
|
-
const
|
|
60
|
-
ui5Config.
|
|
61
|
-
|
|
62
|
-
name: 'preview-middleware',
|
|
63
|
-
afterMiddleware: 'compression',
|
|
64
|
-
configuration: {
|
|
65
|
-
adp: {
|
|
66
|
-
target: fullConfig.target,
|
|
67
|
-
ignoreCertErrors: false
|
|
68
|
-
},
|
|
69
|
-
rta: {
|
|
70
|
-
editors: [
|
|
71
|
-
{
|
|
72
|
-
path: '/local/editor.html',
|
|
73
|
-
developerMode: true
|
|
74
|
-
}
|
|
75
|
-
]
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
name: 'ui5-proxy-middleware',
|
|
81
|
-
afterMiddleware: 'preview-middleware',
|
|
82
|
-
configuration: {
|
|
83
|
-
ui5: {
|
|
84
|
-
path: ['/resources', '/test-resources'],
|
|
85
|
-
url: 'https://ui5.sap.com'
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
name: 'backend-proxy-middleware',
|
|
91
|
-
afterMiddleware: 'preview-middleware',
|
|
92
|
-
configuration: {
|
|
93
|
-
backend: Object.assign(Object.assign({}, fullConfig.target), { path: '/sap' }),
|
|
94
|
-
options: {
|
|
95
|
-
secure: true
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
]);
|
|
62
|
+
const baseUi5ConfigContent = fs.read(ui5ConfigPath);
|
|
63
|
+
const ui5Config = yield ui5_config_1.UI5Config.newInstance(baseUi5ConfigContent);
|
|
64
|
+
(0, options_1.enhanceUI5Yaml)(ui5Config, fullConfig);
|
|
100
65
|
fs.write(ui5ConfigPath, ui5Config.toString());
|
|
66
|
+
// ui5-deploy.yaml
|
|
67
|
+
if ((0, options_1.hasDeployConfig)(fullConfig)) {
|
|
68
|
+
const ui5DeployConfig = yield ui5_config_1.UI5Config.newInstance(baseUi5ConfigContent);
|
|
69
|
+
(0, options_1.enhanceUI5DeployYaml)(ui5DeployConfig, fullConfig);
|
|
70
|
+
fs.write((0, path_1.join)(basePath, 'ui5-deploy.yaml'), ui5DeployConfig.toString());
|
|
71
|
+
}
|
|
101
72
|
return fs;
|
|
102
73
|
});
|
|
103
74
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { UI5Config } from '@sap-ux/ui5-config';
|
|
2
|
+
import type { AdpWriterConfig } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Generate the configuration for the middlewares required for the ui5.yaml.
|
|
5
|
+
*
|
|
6
|
+
* @param ui5Config configuration representing the ui5.yaml
|
|
7
|
+
* @param config full project configuration
|
|
8
|
+
*/
|
|
9
|
+
export declare function enhanceUI5Yaml(ui5Config: UI5Config, config: AdpWriterConfig): void;
|
|
10
|
+
/**
|
|
11
|
+
* Writer configuration with deploy configuration.
|
|
12
|
+
*/
|
|
13
|
+
type AdpWriterConfigWithDeploy = AdpWriterConfig & {
|
|
14
|
+
deploy: NonNullable<AdpWriterConfig['deploy']>;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Checks if a writer config has a deploy configuration.
|
|
18
|
+
*
|
|
19
|
+
* @param config a writer configuration
|
|
20
|
+
* @returns typecasted config if it contains a deploy config
|
|
21
|
+
*/
|
|
22
|
+
export declare function hasDeployConfig(config: AdpWriterConfig): config is AdpWriterConfigWithDeploy;
|
|
23
|
+
/**
|
|
24
|
+
* Generate the configuration for the tasks required for the ui5-deploy.yaml.
|
|
25
|
+
*
|
|
26
|
+
* @param ui5Config configuration representing the ui5.yaml
|
|
27
|
+
* @param config full project configuration
|
|
28
|
+
*/
|
|
29
|
+
export declare function enhanceUI5DeployYaml(ui5Config: UI5Config, config: AdpWriterConfigWithDeploy): void;
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=options.d.ts.map
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.enhanceUI5DeployYaml = exports.hasDeployConfig = exports.enhanceUI5Yaml = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Generate the configuration for the middlewares required for the ui5.yaml.
|
|
6
|
+
*
|
|
7
|
+
* @param ui5Config configuration representing the ui5.yaml
|
|
8
|
+
* @param config full project configuration
|
|
9
|
+
*/
|
|
10
|
+
function enhanceUI5Yaml(ui5Config, config) {
|
|
11
|
+
var _a;
|
|
12
|
+
const middlewares = ((_a = config.options) === null || _a === void 0 ? void 0 : _a.fioriTools) ? getFioriToolsMiddlwares(config) : getOpenSourceMiddlewares(config);
|
|
13
|
+
ui5Config.addCustomMiddleware(middlewares);
|
|
14
|
+
}
|
|
15
|
+
exports.enhanceUI5Yaml = enhanceUI5Yaml;
|
|
16
|
+
/**
|
|
17
|
+
* Checks if a writer config has a deploy configuration.
|
|
18
|
+
*
|
|
19
|
+
* @param config a writer configuration
|
|
20
|
+
* @returns typecasted config if it contains a deploy config
|
|
21
|
+
*/
|
|
22
|
+
function hasDeployConfig(config) {
|
|
23
|
+
return !!config.deploy;
|
|
24
|
+
}
|
|
25
|
+
exports.hasDeployConfig = hasDeployConfig;
|
|
26
|
+
/**
|
|
27
|
+
* Generate the configuration for the tasks required for the ui5-deploy.yaml.
|
|
28
|
+
*
|
|
29
|
+
* @param ui5Config configuration representing the ui5.yaml
|
|
30
|
+
* @param config full project configuration
|
|
31
|
+
*/
|
|
32
|
+
function enhanceUI5DeployYaml(ui5Config, config) {
|
|
33
|
+
var _a;
|
|
34
|
+
ui5Config.addAbapDeployTask(config.target, config.deploy, ((_a = config.options) === null || _a === void 0 ? void 0 : _a.fioriTools) === true);
|
|
35
|
+
}
|
|
36
|
+
exports.enhanceUI5DeployYaml = enhanceUI5DeployYaml;
|
|
37
|
+
/**
|
|
38
|
+
* Get a list of required middlewares using the Fiori tools.
|
|
39
|
+
*
|
|
40
|
+
* @param config full project configuration
|
|
41
|
+
* @returns list of required middlewares.
|
|
42
|
+
*/
|
|
43
|
+
function getFioriToolsMiddlwares(config) {
|
|
44
|
+
return [
|
|
45
|
+
{
|
|
46
|
+
name: 'fiori-tools-preview',
|
|
47
|
+
afterMiddleware: 'compression',
|
|
48
|
+
configuration: {
|
|
49
|
+
adp: {
|
|
50
|
+
target: config.target,
|
|
51
|
+
ignoreCertErrors: false
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: 'fiori-tools-proxy',
|
|
57
|
+
afterMiddleware: 'fiori-tools-preview',
|
|
58
|
+
configuration: {
|
|
59
|
+
ignoreCertErrors: false,
|
|
60
|
+
ui5: {
|
|
61
|
+
path: ['/resources', '/test-resources'],
|
|
62
|
+
url: 'https://ui5.sap.com'
|
|
63
|
+
},
|
|
64
|
+
backend: [
|
|
65
|
+
Object.assign(Object.assign({}, config.target), { path: '/sap' })
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
];
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Get a list of required middlewares using the open source middlewares.
|
|
73
|
+
*
|
|
74
|
+
* @param config full project configuration
|
|
75
|
+
* @returns list of required middlewares.
|
|
76
|
+
*/
|
|
77
|
+
function getOpenSourceMiddlewares(config) {
|
|
78
|
+
return [
|
|
79
|
+
{
|
|
80
|
+
name: 'preview-middleware',
|
|
81
|
+
afterMiddleware: 'compression',
|
|
82
|
+
configuration: {
|
|
83
|
+
adp: {
|
|
84
|
+
target: config.target,
|
|
85
|
+
ignoreCertErrors: false
|
|
86
|
+
},
|
|
87
|
+
rta: {
|
|
88
|
+
editors: [
|
|
89
|
+
{
|
|
90
|
+
path: '/test/adaptation-editor.html',
|
|
91
|
+
developerMode: true
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
name: 'ui5-proxy-middleware',
|
|
99
|
+
afterMiddleware: 'preview-middleware'
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
name: 'backend-proxy-middleware',
|
|
103
|
+
afterMiddleware: 'preview-middleware',
|
|
104
|
+
configuration: {
|
|
105
|
+
backend: Object.assign(Object.assign({}, config.target), { path: '/sap' }),
|
|
106
|
+
options: {
|
|
107
|
+
secure: true
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
];
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=options.js.map
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"bugs": {
|
|
10
10
|
"url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Aadp-tooling"
|
|
11
11
|
},
|
|
12
|
-
"version": "0.
|
|
12
|
+
"version": "0.7.0",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"author": "@SAP/ux-tools-team",
|
|
15
15
|
"main": "dist/index.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@sap-ux/axios-extension": "1.7.3",
|
|
33
33
|
"@sap-ux/logger": "0.4.0",
|
|
34
34
|
"@sap-ux/system-access": "0.3.5",
|
|
35
|
-
"@sap-ux/ui5-config": "0.
|
|
35
|
+
"@sap-ux/ui5-config": "0.21.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/ejs": "3.1.2",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"nock": "13.2.1",
|
|
47
47
|
"rimraf": "5.0.1",
|
|
48
48
|
"supertest": "6.3.3",
|
|
49
|
-
"@sap-ux/project-access": "1.15.
|
|
49
|
+
"@sap-ux/project-access": "1.15.4",
|
|
50
50
|
"@sap-ux/store": "0.4.0"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
@@ -5,19 +5,22 @@
|
|
|
5
5
|
"description": "<%= package.description %>",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"ui5",
|
|
8
|
-
"
|
|
9
|
-
"
|
|
8
|
+
"sapui5",
|
|
9
|
+
"adaptation-project"
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {},
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"@sap-ux/backend-proxy-middleware": "^0.
|
|
14
|
-
"@sap-ux/preview-middleware": "^0.
|
|
15
|
-
"@sap-ux/ui5-proxy-middleware": "^1.
|
|
13
|
+
<%if (locals.options?.fioriTools) {%>"@sap/ux-ui5-tooling": "^1.11.4"<%} else {%>"@sap-ux/backend-proxy-middleware": "^0.7.5",
|
|
14
|
+
"@sap-ux/preview-middleware": "^0.11.1",
|
|
15
|
+
"@sap-ux/ui5-proxy-middleware": "^1.3.0",
|
|
16
|
+
"@sap-ux/deploy-tooling": "^0.11.7"<%}%>,
|
|
16
17
|
"@ui5/cli": "^3.6.0"
|
|
17
18
|
},
|
|
18
19
|
"scripts": {
|
|
19
20
|
"build": "ui5 build --exclude-task generateFlexChangesBundle generateComponentPreload --clean-dest",
|
|
20
|
-
"start": "ui5 serve --open /test/flp.html#app-preview",
|
|
21
|
-
"editor": "ui5 serve --open /
|
|
21
|
+
"start": "<%= locals.options?.fioriTools ? 'fiori run' : 'ui5 serve' %> --open /test/flp.html#app-preview",
|
|
22
|
+
"start-editor": "<%= locals.options?.fioriTools ? 'fiori run' : 'ui5 serve' %> --open /test/adaptation-editor.html"<%if (locals.deploy) {%>,
|
|
23
|
+
"deploy": "ui5 build --config ui5-deploy.yaml --exclude-task <%= locals.options?.fioriTools ? 'deploy-to-abap' : 'abap-deploy-task' %> generateFlexChangesBundle generateComponentPreload --clean-dest && <%= locals.options?.fioriTools ? 'fiori deploy' : 'deploy' %> --config ui5-deploy.yaml",
|
|
24
|
+
"undeploy": "<%= locals.options?.fioriTools ? 'fiori undeploy' : 'undeploy' %> --config ui5-deploy.yaml --lrep 'apps/<%= app.reference %>/appVariants/<%= app.id %>/'"<%}%>
|
|
22
25
|
}
|
|
23
26
|
}
|