@sap-ux/abap-deploy-config-sub-generator 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,19 @@
1
+ # @sap-ux/abap-deploy-config-sub-generator
2
+
3
+ ## Features
4
+
5
+ The ABAP deployment configuration sub-generator enables users to create deployment configuration files to a SAP Fiori application.
6
+
7
+ ## Installation
8
+
9
+ The ABAP deployment configuration sub-generator is installed as part of the [@sap/generator-fiori](https://www.npmjs.com/package/@sap/generator-fiori) generator and cannot be used stand alone. Furthermore, usage requires that the [SAP Fiori Tools Extension](https://marketplace.visualstudio.com/items?itemName=SAPSE.sap-ux-fiori-tools-extension-pack) pack is installed from the VSCode marketplace.
10
+
11
+ ## Launch the ABAP deployment configuration sub-generator
12
+
13
+ Open the Command Palette in MS Visual Studio Code ( CMD/CTRL + Shift + P ) and execute the Fiori: Add Deployment Configuration command.
14
+
15
+
16
+ ## Keywords
17
+ SAP Fiori Elements
18
+ Yeoman
19
+ Generator
@@ -0,0 +1,48 @@
1
+ import { DeploymentGenerator } from '@sap-ux/deploy-config-generator-shared';
2
+ import type { AbapDeployConfigOptions } from './types';
3
+ /**
4
+ * ABAP deploy config generator.
5
+ */
6
+ export default class extends DeploymentGenerator {
7
+ private readonly appWizard;
8
+ private readonly vscode;
9
+ private readonly launchDeployConfigAsSubGenerator;
10
+ private readonly launchStandaloneFromYui?;
11
+ private abort;
12
+ private backendConfig;
13
+ private indexGenerationAllowed;
14
+ private configExists;
15
+ private answers;
16
+ private projectType;
17
+ /**
18
+ * Constructor for the ABAP deploy config generator.
19
+ *
20
+ * @param args - arguments passed to the generator
21
+ * @param opts - options passed to the generator
22
+ */
23
+ constructor(args: string | string[], opts: AbapDeployConfigOptions);
24
+ initializing(): Promise<void>;
25
+ private _initDestinationRoot;
26
+ private _processProjectConfig;
27
+ private _processIndexHtmlConfig;
28
+ private _initBackendConfig;
29
+ private _initializing;
30
+ prompting(): Promise<void>;
31
+ private _processAbapTargetAnswers;
32
+ private _processBspAppAnswers;
33
+ /**
34
+ * Reconcile answers with options.
35
+ *
36
+ * Options may be passed from parent generator, or from the command line.
37
+ */
38
+ private _reconcileAnswersWithOptions;
39
+ writing(): Promise<void>;
40
+ private _writing;
41
+ install(): void;
42
+ private _install;
43
+ end(): Promise<void>;
44
+ }
45
+ export { getAbapQuestions } from './questions';
46
+ export { indexHtmlExists } from '../utils';
47
+ export { AbapDeployConfigOptions, DeployProjectType } from './types';
48
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,262 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeployProjectType = exports.indexHtmlExists = exports.getAbapQuestions = void 0;
4
+ const yeoman_ui_types_1 = require("@sap-devx/yeoman-ui-types");
5
+ const deploy_config_generator_shared_1 = require("@sap-ux/deploy-config-generator-shared");
6
+ const fiori_generator_shared_1 = require("@sap-ux/fiori-generator-shared");
7
+ const abap_deploy_config_inquirer_1 = require("@sap-ux/abap-deploy-config-inquirer");
8
+ const abap_deploy_config_writer_1 = require("@sap-ux/abap-deploy-config-writer");
9
+ const telemetry_1 = require("@sap-ux/telemetry");
10
+ const ui5_config_1 = require("@sap-ux/ui5-config");
11
+ const project_access_1 = require("@sap-ux/project-access");
12
+ const store_1 = require("@sap-ux/store");
13
+ const utils_1 = require("../utils");
14
+ const questions_1 = require("./questions");
15
+ const telemetryEvents_1 = require("../telemetryEvents");
16
+ const types_1 = require("./types");
17
+ const i18n_1 = require("../utils/i18n");
18
+ const feature_toggle_1 = require("@sap-ux/feature-toggle");
19
+ const btp_utils_1 = require("@sap-ux/btp-utils");
20
+ const constants_1 = require("@sap-ux/abap-deploy-config-inquirer/dist/constants");
21
+ /**
22
+ * ABAP deploy config generator.
23
+ */
24
+ class default_1 extends deploy_config_generator_shared_1.DeploymentGenerator {
25
+ appWizard;
26
+ vscode;
27
+ launchDeployConfigAsSubGenerator;
28
+ launchStandaloneFromYui;
29
+ abort = false;
30
+ backendConfig;
31
+ indexGenerationAllowed;
32
+ configExists;
33
+ answers;
34
+ projectType;
35
+ /**
36
+ * Constructor for the ABAP deploy config generator.
37
+ *
38
+ * @param args - arguments passed to the generator
39
+ * @param opts - options passed to the generator
40
+ */
41
+ constructor(args, opts) {
42
+ super(args, opts);
43
+ this.launchDeployConfigAsSubGenerator = opts.launchDeployConfigAsSubGenerator ?? false;
44
+ this.launchStandaloneFromYui = opts.launchStandaloneFromYui;
45
+ this.appWizard = opts.appWizard || yeoman_ui_types_1.AppWizard.create(opts);
46
+ this.vscode = opts.vscode;
47
+ this.options = opts;
48
+ }
49
+ async initializing() {
50
+ await super.initializing();
51
+ await (0, i18n_1.initI18n)();
52
+ if (this.env.conflicter) {
53
+ this.env.conflicter.force = this.options.force ?? true;
54
+ }
55
+ deploy_config_generator_shared_1.DeploymentGenerator.logger?.debug((0, utils_1.t)('debug.initTelemetry'));
56
+ await (0, telemetry_1.initTelemetrySettings)({
57
+ consumerModule: {
58
+ name: '@sap-ux/abap-deploy-config-sub-generator',
59
+ version: this.rootGeneratorVersion()
60
+ },
61
+ internalFeature: (0, feature_toggle_1.isInternalFeaturesSettingEnabled)(),
62
+ watchTelemetrySettingStore: false
63
+ });
64
+ if (!this.launchDeployConfigAsSubGenerator) {
65
+ await this._initializing();
66
+ }
67
+ }
68
+ _initDestinationRoot() {
69
+ if (this.options.appRootPath) {
70
+ this.destinationRoot(this.options.appRootPath);
71
+ deploy_config_generator_shared_1.DeploymentGenerator.logger?.debug((0, utils_1.t)('debug.appRootPath', { appRootPath: this.options.appRootPath }));
72
+ }
73
+ }
74
+ _processProjectConfig() {
75
+ this.options.base = this.options.base || project_access_1.FileName.Ui5Yaml;
76
+ this.options.config = this.options.config || project_access_1.FileName.UI5DeployYaml;
77
+ // check base exists
78
+ const baseExists = this.fs.exists(this.destinationPath(this.options.base));
79
+ if (!baseExists) {
80
+ this.abort = true;
81
+ (0, utils_1.handleProjectDoesNotExist)(this.appWizard, this.destinationPath(this.options.base));
82
+ }
83
+ // check config exists
84
+ this.configExists = this.fs.exists(this.destinationPath(this.options.config));
85
+ if (this.configExists) {
86
+ deploy_config_generator_shared_1.DeploymentGenerator.logger?.debug((0, utils_1.t)('debug.configExists', { configPath: this.destinationPath(this.options.config) }));
87
+ }
88
+ }
89
+ async _processIndexHtmlConfig() {
90
+ const htmlIndexExists = await (0, utils_1.indexHtmlExists)(this.fs, this.destinationPath());
91
+ if (htmlIndexExists) {
92
+ this.indexGenerationAllowed = false;
93
+ if (this.options.index) {
94
+ deploy_config_generator_shared_1.DeploymentGenerator.logger?.debug((0, utils_1.t)('debug.indexExists'));
95
+ }
96
+ delete this.options.index;
97
+ }
98
+ else {
99
+ this.indexGenerationAllowed = true;
100
+ }
101
+ }
102
+ async _initBackendConfig() {
103
+ const ui5Config = await ui5_config_1.UI5Config.newInstance(this.fs.read(this.destinationPath(this.options.base ?? project_access_1.FileName.Ui5Yaml)));
104
+ this.projectType =
105
+ ui5Config.getType() === 'library' ? types_1.DeployProjectType.Library : types_1.DeployProjectType.Application;
106
+ this.backendConfig = ui5Config.getBackendConfigsFromFioriToolsProxydMiddleware()[0];
107
+ }
108
+ async _initializing() {
109
+ this._initDestinationRoot();
110
+ try {
111
+ this._processProjectConfig();
112
+ await this._processIndexHtmlConfig();
113
+ await this._initBackendConfig();
114
+ }
115
+ catch (e) {
116
+ if (e === deploy_config_generator_shared_1.ErrorMessages.abortSignal) {
117
+ deploy_config_generator_shared_1.DeploymentGenerator.logger?.debug((0, utils_1.t)('debug.initFailed', { error: e }));
118
+ }
119
+ else {
120
+ throw e;
121
+ }
122
+ }
123
+ }
124
+ async prompting() {
125
+ this.answers = {};
126
+ if (this.abort) {
127
+ return;
128
+ }
129
+ if (!this.launchDeployConfigAsSubGenerator) {
130
+ const { prompts: abapDeployConfigPrompts, answers: abapAnswers = {} } = await (0, questions_1.getAbapQuestions)({
131
+ appRootPath: this.destinationRoot(),
132
+ connectedSystem: this.options.connectedSystem,
133
+ backendConfig: this.backendConfig,
134
+ configFile: this.options.config,
135
+ indexGenerationAllowed: this.indexGenerationAllowed,
136
+ showOverwriteQuestion: (0, deploy_config_generator_shared_1.showOverwriteQuestion)(this.launchDeployConfigAsSubGenerator, this.launchStandaloneFromYui, this.options.overwrite, this.configExists),
137
+ projectType: this.projectType,
138
+ logger: deploy_config_generator_shared_1.DeploymentGenerator.logger
139
+ });
140
+ const prompAnswers = await this.prompt(abapDeployConfigPrompts);
141
+ this.answers = (0, abap_deploy_config_inquirer_1.reconcileAnswers)(prompAnswers, abapAnswers);
142
+ }
143
+ this._reconcileAnswersWithOptions();
144
+ }
145
+ _processAbapTargetAnswers() {
146
+ this.answers.destination = this.options.destination || this.answers.destination;
147
+ this.answers.url = this.options.url || this.answers.url;
148
+ this.answers.client = this.options.client || this.answers.client;
149
+ this.answers.scp = this.options.scp || this.answers.scp;
150
+ this.answers.isS4HC = this.options.isS4HC || this.answers.isS4HC;
151
+ if (!(0, btp_utils_1.isAppStudio)() && this.answers.scp) {
152
+ // ensure there is no client for SCP on vscode
153
+ delete this.answers.client;
154
+ }
155
+ }
156
+ _processBspAppAnswers() {
157
+ this.answers.ui5AbapRepo = (this.options.ui5AbapRepo || this.answers.ui5AbapRepo)?.toUpperCase();
158
+ // Set package
159
+ if (!this.answers.package) {
160
+ this.answers.package =
161
+ (0, abap_deploy_config_inquirer_1.getPackageAnswer)(this.options, this.options.package) ||
162
+ (0, abap_deploy_config_inquirer_1.getPackageAnswer)(this.answers) ||
163
+ (this.answers.scp ? '' : constants_1.DEFAULT_PACKAGE_ABAP);
164
+ }
165
+ // Set transport
166
+ if (!this.answers.transport) {
167
+ this.answers.transport =
168
+ (0, abap_deploy_config_inquirer_1.getTransportAnswer)(this.options) || (0, abap_deploy_config_inquirer_1.getTransportAnswer)(this.answers);
169
+ }
170
+ }
171
+ /**
172
+ * Reconcile answers with options.
173
+ *
174
+ * Options may be passed from parent generator, or from the command line.
175
+ */
176
+ _reconcileAnswersWithOptions() {
177
+ this._processAbapTargetAnswers();
178
+ this._processBspAppAnswers();
179
+ this.answers.index = this.options.index || this.answers.index;
180
+ this.answers.description = this.options.description || this.answers.description;
181
+ this.answers.overwrite = this.options.overwrite || this.answers.overwrite;
182
+ }
183
+ async writing() {
184
+ if (!this.launchDeployConfigAsSubGenerator) {
185
+ await this._writing();
186
+ }
187
+ }
188
+ async _writing() {
189
+ if (this.abort || this.answers.overwrite === false) {
190
+ return;
191
+ }
192
+ await (0, abap_deploy_config_writer_1.generate)(this.destinationPath(), {
193
+ target: {
194
+ url: this.answers.url,
195
+ client: this.answers.client,
196
+ scp: this.answers.scp,
197
+ destination: this.answers.destination,
198
+ authenticationType: this.answers.isS4HC ? store_1.AuthenticationType.ReentranceTicket : undefined // only reentrance ticket is relevant for writing to deploy config
199
+ },
200
+ app: {
201
+ name: this.answers.ui5AbapRepo,
202
+ description: this.answers.description,
203
+ package: this.answers.package,
204
+ transport: this.answers.transport
205
+ },
206
+ index: this.answers.index
207
+ }, {
208
+ baseFile: this.options.base,
209
+ deployFile: this.options.config
210
+ }, this.fs);
211
+ }
212
+ install() {
213
+ if (!this.launchDeployConfigAsSubGenerator && this.answers.overwrite !== false) {
214
+ this._install();
215
+ }
216
+ }
217
+ _install() {
218
+ if (!this.options.skipInstall) {
219
+ this.spawnCommand('npm', [
220
+ 'install',
221
+ '--no-audit',
222
+ '--no-fund',
223
+ '--silent',
224
+ '--prefer-offline',
225
+ '--no-progress'
226
+ ]);
227
+ }
228
+ else {
229
+ deploy_config_generator_shared_1.DeploymentGenerator.logger?.info((0, utils_1.t)('info.skippedInstallation'));
230
+ }
231
+ }
232
+ async end() {
233
+ if (this.abort || this.answers.overwrite === false) {
234
+ return;
235
+ }
236
+ // Delayed process of deploy configuration generation if integrated with app generator
237
+ if (this.launchDeployConfigAsSubGenerator) {
238
+ await this._initializing();
239
+ await this._writing();
240
+ this._install();
241
+ }
242
+ if (this.launchStandaloneFromYui &&
243
+ (0, fiori_generator_shared_1.isExtensionInstalled)(this.vscode, fiori_generator_shared_1.YUI_EXTENSION_ID, fiori_generator_shared_1.YUI_MIN_VER_FILES_GENERATED_MSG)) {
244
+ this.appWizard?.showInformation((0, utils_1.t)('info.filesGenerated'), yeoman_ui_types_1.MessageType.notification);
245
+ }
246
+ // Send telemetry data after adding deployment configuration
247
+ (0, fiori_generator_shared_1.sendTelemetry)(telemetryEvents_1.EventName.DEPLOY_CONFIG, fiori_generator_shared_1.TelemetryHelper.createTelemetryData({
248
+ DeployTarget: 'ABAP',
249
+ ...this.options.telemetryData
250
+ }) ?? {}, this.destinationRoot())?.catch((error) => {
251
+ deploy_config_generator_shared_1.DeploymentGenerator.logger.error((0, utils_1.t)('error.telemetry', { error }));
252
+ });
253
+ }
254
+ }
255
+ exports.default = default_1;
256
+ var questions_2 = require("./questions");
257
+ Object.defineProperty(exports, "getAbapQuestions", { enumerable: true, get: function () { return questions_2.getAbapQuestions; } });
258
+ var utils_2 = require("../utils");
259
+ Object.defineProperty(exports, "indexHtmlExists", { enumerable: true, get: function () { return utils_2.indexHtmlExists; } });
260
+ var types_2 = require("./types");
261
+ Object.defineProperty(exports, "DeployProjectType", { enumerable: true, get: function () { return types_2.DeployProjectType; } });
262
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,33 @@
1
+ import type { ILogWrapper } from '@sap-ux/fiori-generator-shared';
2
+ import type { AbapDeployConfigAnswersInternal, AbapDeployConfigQuestion } from '@sap-ux/abap-deploy-config-inquirer';
3
+ import type { FioriToolsProxyConfigBackend } from '@sap-ux/ui5-config';
4
+ import type { ConnectedSystem } from '@sap-ux/deploy-config-generator-shared';
5
+ import { DeployProjectType } from './types';
6
+ /**
7
+ * Retrieves the ABAP prompt questions from the inquirer.
8
+ *
9
+ * @param params - the parameters required for retrieving the questions
10
+ * @param params.appRootPath - the path to the app
11
+ * @param params.connectedSystem - the connected system
12
+ * @param params.backendConfig - the backend configuration
13
+ * @param params.configFile - the deployment configuration file name
14
+ * @param params.indexGenerationAllowed - whether index generation is allowed
15
+ * @param params.showOverwriteQuestion - whether the overwrite question should be shown
16
+ * @param params.projectType - the project type
17
+ * @param params.logger - the logger
18
+ * @returns - the prompts and answers
19
+ */
20
+ export declare function getAbapQuestions({ appRootPath, connectedSystem, backendConfig, configFile, indexGenerationAllowed, showOverwriteQuestion, projectType, logger }: {
21
+ appRootPath: string;
22
+ connectedSystem?: ConnectedSystem;
23
+ backendConfig?: FioriToolsProxyConfigBackend;
24
+ configFile?: string;
25
+ indexGenerationAllowed?: boolean;
26
+ showOverwriteQuestion?: boolean;
27
+ projectType?: DeployProjectType;
28
+ logger?: ILogWrapper;
29
+ }): Promise<{
30
+ prompts: AbapDeployConfigQuestion[];
31
+ answers: Partial<AbapDeployConfigAnswersInternal>;
32
+ }>;
33
+ //# sourceMappingURL=questions.d.ts.map
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAbapQuestions = getAbapQuestions;
4
+ const abap_deploy_config_inquirer_1 = require("@sap-ux/abap-deploy-config-inquirer");
5
+ const project_access_1 = require("@sap-ux/project-access");
6
+ const fiori_generator_shared_1 = require("@sap-ux/fiori-generator-shared");
7
+ const btp_utils_1 = require("@sap-ux/btp-utils");
8
+ const constants_1 = require("../utils/constants");
9
+ const types_1 = require("./types");
10
+ /**
11
+ * Get the ABAP target based on the provided parameters.
12
+ *
13
+ * @param destination - the destination used during app generation
14
+ * @param backendSystem - the backend system used during app generation
15
+ * @param existingAbapDeployTask - possible existing deploy configuration (ui5-deploy.yaml)
16
+ * @param backendConfig - the existing base configuration (ui5.yaml)
17
+ * @returns - the ABAP target
18
+ */
19
+ function getAbapTarget(destination, backendSystem, existingAbapDeployTask, backendConfig) {
20
+ let url, scp, client, destinationName, authenticationType;
21
+ if ((0, btp_utils_1.isAppStudio)() && destination) {
22
+ // the destination used during app generation
23
+ destinationName = destination.Name;
24
+ }
25
+ else if (backendSystem) {
26
+ // the backend system used during app generation
27
+ url = backendSystem.url;
28
+ client = backendSystem.client;
29
+ scp = !!backendSystem.serviceKeys;
30
+ authenticationType = backendSystem.authenticationType;
31
+ }
32
+ else if (existingAbapDeployTask?.target) {
33
+ // possible existing deploy configuration (ui5-deploy.yaml)
34
+ url = existingAbapDeployTask.target.url;
35
+ client = existingAbapDeployTask.target.client;
36
+ scp = existingAbapDeployTask.target.scp;
37
+ authenticationType = existingAbapDeployTask.target.authenticationType;
38
+ destinationName = existingAbapDeployTask.target.destination;
39
+ }
40
+ else if (backendConfig) {
41
+ // the existing base configuration (ui5.yaml)
42
+ url = backendConfig.url;
43
+ scp = backendConfig.scp;
44
+ client = backendConfig.client;
45
+ authenticationType = backendConfig.authenticationType;
46
+ destinationName = backendConfig?.destination;
47
+ }
48
+ return {
49
+ url,
50
+ scp,
51
+ client: client || '', // Needs to default to empty string
52
+ destination: destinationName,
53
+ authenticationType
54
+ };
55
+ }
56
+ /**
57
+ * Retrieves the ABAP prompt questions from the inquirer.
58
+ *
59
+ * @param params - the parameters required for retrieving the questions
60
+ * @param params.appRootPath - the path to the app
61
+ * @param params.connectedSystem - the connected system
62
+ * @param params.backendConfig - the backend configuration
63
+ * @param params.configFile - the deployment configuration file name
64
+ * @param params.indexGenerationAllowed - whether index generation is allowed
65
+ * @param params.showOverwriteQuestion - whether the overwrite question should be shown
66
+ * @param params.projectType - the project type
67
+ * @param params.logger - the logger
68
+ * @returns - the prompts and answers
69
+ */
70
+ async function getAbapQuestions({ appRootPath, connectedSystem, backendConfig, configFile = project_access_1.FileName.UI5DeployYaml, indexGenerationAllowed = false, showOverwriteQuestion = false, projectType = types_1.DeployProjectType.Application, logger }) {
71
+ const { backendSystem, serviceProvider, destination } = connectedSystem || {};
72
+ let existingAbapDeployTask;
73
+ try {
74
+ const ui5DeployConfig = await (0, project_access_1.readUi5Yaml)(appRootPath, configFile);
75
+ existingAbapDeployTask = ui5DeployConfig.findCustomTask(constants_1.ABAP_DEPLOY_TASK)?.configuration;
76
+ }
77
+ catch {
78
+ // not an issue if the file does not exist
79
+ }
80
+ const abapTarget = getAbapTarget(destination, backendSystem, existingAbapDeployTask, backendConfig);
81
+ const deployAppConfig = existingAbapDeployTask?.app;
82
+ logger?.debug(`Retrieve ABAP prompts using: \n App path: ${appRootPath},
83
+ ABAPTarget: ${JSON.stringify(abapTarget)}, SystemName: ${backendSystem?.name},
84
+ ServiceProvider: ${!!serviceProvider}, showOverwriteQuestion ${showOverwriteQuestion}, indexGenerationAllowed ${indexGenerationAllowed}`);
85
+ return (0, abap_deploy_config_inquirer_1.getPrompts)({
86
+ backendTarget: {
87
+ abapTarget,
88
+ systemName: backendSystem?.name,
89
+ serviceProvider,
90
+ type: projectType
91
+ },
92
+ ui5AbapRepo: { default: deployAppConfig?.name },
93
+ description: { default: deployAppConfig?.description },
94
+ packageManual: { default: deployAppConfig?.package },
95
+ transportManual: { default: deployAppConfig?.transport },
96
+ index: { indexGenerationAllowed },
97
+ packageAutocomplete: { useAutocomplete: true },
98
+ overwrite: { hide: !showOverwriteQuestion }
99
+ }, logger, (0, fiori_generator_shared_1.getHostEnvironment)() !== fiori_generator_shared_1.hostEnvironment.cli);
100
+ }
101
+ //# sourceMappingURL=questions.js.map
@@ -0,0 +1,55 @@
1
+ import type { AbapDeployConfigAnswersInternal } from '@sap-ux/abap-deploy-config-inquirer';
2
+ import type { AppWizard } from '@sap-devx/yeoman-ui-types';
3
+ import type { ConnectedSystem } from '@sap-ux/deploy-config-generator-shared';
4
+ import type { TelemetryData } from '@sap-ux/fiori-generator-shared';
5
+ export interface AbapDeployConfigOptions extends AbapDeployConfigAnswersInternal {
6
+ /**
7
+ * VSCode instance
8
+ */
9
+ vscode?: unknown;
10
+ /**
11
+ * AppWizard instance
12
+ */
13
+ appWizard?: AppWizard;
14
+ /**
15
+ * Whether the generator is launched as a subgenerator
16
+ */
17
+ launchDeployConfigAsSubGenerator?: boolean;
18
+ /**
19
+ * Whether the generator is launched as a standalone generator in a YUI context
20
+ */
21
+ launchStandaloneFromYui?: boolean;
22
+ /**
23
+ * Path to the application root where the deployment configuration will be added.
24
+ */
25
+ appRootPath?: string;
26
+ /**
27
+ * The connected destination or backend system and service provider
28
+ */
29
+ connectedSystem?: ConnectedSystem;
30
+ /**
31
+ * The name of the base config file e.g. ui5.yaml
32
+ */
33
+ base?: string;
34
+ /**
35
+ * The name of the deploy config file e.g. ui5-deploy.yaml
36
+ */
37
+ config?: string;
38
+ /**
39
+ * Option to skip the installation of dependencies
40
+ */
41
+ skipInstall?: boolean;
42
+ /**
43
+ * Option to force the conflicter property of the yeoman environment (prevents additional prompt for overwriting files)
44
+ */
45
+ force?: boolean;
46
+ /**
47
+ * Telemetry data to be send after deployment configuration has been added
48
+ */
49
+ telemetryData?: TelemetryData;
50
+ }
51
+ export declare enum DeployProjectType {
52
+ Application = "application",
53
+ Library = "library"
54
+ }
55
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeployProjectType = void 0;
4
+ var DeployProjectType;
5
+ (function (DeployProjectType) {
6
+ DeployProjectType["Application"] = "application";
7
+ DeployProjectType["Library"] = "library";
8
+ })(DeployProjectType || (exports.DeployProjectType = DeployProjectType = {}));
9
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Event names for telemetry for the abap deploy config generator
3
+ */
4
+ export declare enum EventName {
5
+ DEPLOY_CONFIG = "DEPLOY_CONFIG"
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 abap deploy config generator
6
+ */
7
+ var EventName;
8
+ (function (EventName) {
9
+ EventName["DEPLOY_CONFIG"] = "DEPLOY_CONFIG";
10
+ })(EventName || (exports.EventName = EventName = {}));
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,17 @@
1
+ {
2
+ "error": {
3
+ "telemetry": "Failed to send telemetry data after deployment configuration has been added. {{- error}}"
4
+ },
5
+ "info": {
6
+ "filesGenerated": "The files have been generated.",
7
+ "skippedInstallation": "Option `--skipInstall` was specified. Installation of dependencies will be skipped."
8
+ },
9
+ "debug": {
10
+ "configExists": "Existing deployment configuration file found at {{- configPath}}",
11
+ "configNotFound": "No existing deployment configuration file found",
12
+ "indexExists": "'webapp/index.html' already exists and won't be overwritten",
13
+ "initFailed": "Initializing failed, unable to process project configuration. {{- error}}",
14
+ "initTelemetry": "Initializing telemetry",
15
+ "appRootPath": "App loaded from {{- appRootPath}}"
16
+ }
17
+ }
@@ -0,0 +1,2 @@
1
+ export declare const ABAP_DEPLOY_TASK = "deploy-to-abap";
2
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ABAP_DEPLOY_TASK = void 0;
4
+ exports.ABAP_DEPLOY_TASK = 'deploy-to-abap';
5
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1,9 @@
1
+ import type { AppWizard } from '@sap-devx/yeoman-ui-types';
2
+ /**
3
+ * Handle the case where the project does not exist.
4
+ *
5
+ * @param appWizard - the appWizard instance
6
+ * @param path - the path that does not exist
7
+ */
8
+ export declare function handleProjectDoesNotExist(appWizard: AppWizard, path: string): void;
9
+ //# sourceMappingURL=error-handler.d.ts.map
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.handleProjectDoesNotExist = handleProjectDoesNotExist;
4
+ const deploy_config_generator_shared_1 = require("@sap-ux/deploy-config-generator-shared");
5
+ /**
6
+ * Handle the case where the project does not exist.
7
+ *
8
+ * @param appWizard - the appWizard instance
9
+ * @param path - the path that does not exist
10
+ */
11
+ function handleProjectDoesNotExist(appWizard, path) {
12
+ const errorMsg = deploy_config_generator_shared_1.ErrorMessages.fileDoesNotExist(path);
13
+ (0, deploy_config_generator_shared_1.handleErrorMessage)(appWizard, errorMsg);
14
+ throw deploy_config_generator_shared_1.ErrorMessages.abortSignal;
15
+ }
16
+ //# sourceMappingURL=error-handler.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,33 @@
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.initI18n = initI18n;
7
+ exports.t = t;
8
+ const i18next_1 = __importDefault(require("i18next"));
9
+ const abap_deploy_config_sub_generator_i18n_json_1 = __importDefault(require("../translations/abap-deploy-config-sub-generator.i18n.json"));
10
+ const abapDeployGenI18nNamespace = 'abap-deploy-config-sub-generator';
11
+ /**
12
+ * Initialize i18next with the translations for this module.
13
+ */
14
+ async function initI18n() {
15
+ await i18next_1.default.init({ lng: 'en', fallbackLng: 'en' }, () => i18next_1.default.addResourceBundle('en', abapDeployGenI18nNamespace, abap_deploy_config_sub_generator_i18n_json_1.default));
16
+ }
17
+ /**
18
+ * Helper function facading the call to i18next. Unless a namespace option is provided the local namespace will be used.
19
+ *
20
+ * @param key i18n key
21
+ * @param options additional options
22
+ * @returns {string} localized string stored for the given key
23
+ */
24
+ function t(key, options) {
25
+ if (!options?.ns) {
26
+ options = Object.assign(options ?? {}, { ns: abapDeployGenI18nNamespace });
27
+ }
28
+ return i18next_1.default.t(key, options);
29
+ }
30
+ initI18n().catch(() => {
31
+ // Needed for lint
32
+ });
33
+ //# sourceMappingURL=i18n.js.map
@@ -0,0 +1,4 @@
1
+ export { indexHtmlExists } from './project';
2
+ export { handleProjectDoesNotExist } from './error-handler';
3
+ export { t } from './i18n';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.t = exports.handleProjectDoesNotExist = exports.indexHtmlExists = void 0;
4
+ var project_1 = require("./project");
5
+ Object.defineProperty(exports, "indexHtmlExists", { enumerable: true, get: function () { return project_1.indexHtmlExists; } });
6
+ var error_handler_1 = require("./error-handler");
7
+ Object.defineProperty(exports, "handleProjectDoesNotExist", { enumerable: true, get: function () { return error_handler_1.handleProjectDoesNotExist; } });
8
+ var i18n_1 = require("./i18n");
9
+ Object.defineProperty(exports, "t", { enumerable: true, get: function () { return i18n_1.t; } });
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,10 @@
1
+ import type { Editor } from 'mem-fs-editor';
2
+ /**
3
+ * Checks if index.html exists in Fiori project's custom webapp folder path.
4
+ *
5
+ * @param fs - the memfs editor instance
6
+ * @param path - the project path
7
+ * @returns true if index.html exists
8
+ */
9
+ export declare function indexHtmlExists(fs: Editor, path: string): Promise<boolean>;
10
+ //# sourceMappingURL=project.d.ts.map
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.indexHtmlExists = indexHtmlExists;
4
+ const project_access_1 = require("@sap-ux/project-access");
5
+ const path_1 = require("path");
6
+ /**
7
+ * Checks if index.html exists in Fiori project's custom webapp folder path.
8
+ *
9
+ * @param fs - the memfs editor instance
10
+ * @param path - the project path
11
+ * @returns true if index.html exists
12
+ */
13
+ async function indexHtmlExists(fs, path) {
14
+ const customWebappPath = await (0, project_access_1.getWebappPath)(path);
15
+ const indexHtmlPath = (0, path_1.join)(customWebappPath, 'index.html');
16
+ return fs.exists(indexHtmlPath);
17
+ }
18
+ //# sourceMappingURL=project.js.map
package/package.json ADDED
@@ -0,0 +1,60 @@
1
+ {
2
+ "name": "@sap-ux/abap-deploy-config-sub-generator",
3
+ "description": "Sub generator for ABAP deployment configuration",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "https://github.com/SAP/open-ux-tools.git",
7
+ "directory": "packages/abap-deploy-config-sub-generator"
8
+ },
9
+ "version": "0.0.1",
10
+ "license": "Apache-2.0",
11
+ "main": "generators/app/index.js",
12
+ "files": [
13
+ "LICENSE",
14
+ "generators",
15
+ "!generators/*.map",
16
+ "!generators/**/*.map"
17
+ ],
18
+ "engines": {
19
+ "node": ">=18.x"
20
+ },
21
+ "dependencies": {
22
+ "i18next": "23.5.1",
23
+ "@sap-devx/yeoman-ui-types": "1.14.4",
24
+ "@sap-ux/abap-deploy-config-inquirer": "1.1.9",
25
+ "@sap-ux/abap-deploy-config-writer": "0.0.68",
26
+ "@sap-ux/btp-utils": "0.17.1",
27
+ "@sap-ux/deploy-config-generator-shared": "0.0.5",
28
+ "@sap-ux/feature-toggle": "0.2.3",
29
+ "@sap-ux/fiori-generator-shared": "0.7.14",
30
+ "@sap-ux/logger": "0.6.0",
31
+ "@sap-ux/project-access": "1.28.9",
32
+ "@sap-ux/telemetry": "0.5.47",
33
+ "@sap-ux/ui5-config": "0.26.0"
34
+ },
35
+ "devDependencies": {
36
+ "@types/fs-extra": "9.0.13",
37
+ "@types/mem-fs": "1.1.2",
38
+ "@types/mem-fs-editor": "7.0.1",
39
+ "@types/yeoman-test": "4.0.6",
40
+ "fs-extra": "10.0.0",
41
+ "memfs": "3.4.13",
42
+ "mem-fs-editor": "9.4.0",
43
+ "unionfs": "4.4.0",
44
+ "yeoman-test": "6.3.0",
45
+ "@sap-ux/store": "0.9.3",
46
+ "@sap-ux/system-access": "0.5.22"
47
+ },
48
+ "scripts": {
49
+ "build": "tsc --build",
50
+ "watch": "tsc --watch",
51
+ "clean": "rimraf --glob generators test/test-output coverage *.tsbuildinfo",
52
+ "format": "prettier --write '**/*.{js,json,ts,yaml,yml}' --ignore-path ../../.prettierignore",
53
+ "lint": "eslint . --ext .ts",
54
+ "lint:fix": "eslint . --ext .ts --fix",
55
+ "test": "jest --ci --forceExit --detectOpenHandles --colors",
56
+ "test-u": "jest --ci --forceExit --detectOpenHandles --colors -u",
57
+ "link": "pnpm link --global",
58
+ "unlink": "pnpm unlink --global"
59
+ }
60
+ }