@sap-ux/cf-deploy-config-writer 0.2.10 → 0.2.11
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/cf-writer/app-config.js +10 -15
- package/dist/cf-writer/base-config.d.ts +1 -1
- package/dist/cf-writer/base-config.js +3 -3
- package/dist/mta-config/index.d.ts +1 -13
- package/dist/mta-config/index.js +5 -31
- package/dist/mta-config/mta.d.ts +19 -3
- package/dist/mta-config/mta.js +41 -1
- package/dist/utils.d.ts +4 -10
- package/dist/utils.js +9 -23
- package/package.json +1 -1
|
@@ -157,8 +157,6 @@ async function generateDeployConfig(cfAppConfig, fs) {
|
|
|
157
157
|
// Generate MTA Config, LCAP will generate the mta.yaml on the fly so we don't care about it!
|
|
158
158
|
if (!config.lcapMode) {
|
|
159
159
|
await generateMTAFile(config, fs);
|
|
160
|
-
await (0, utils_1.generateSupportingConfig)(config, fs);
|
|
161
|
-
await updateMtaConfig(config, fs);
|
|
162
160
|
}
|
|
163
161
|
// Generate HTML5 config
|
|
164
162
|
await appendCloudFoundryConfigurations(config, fs);
|
|
@@ -175,6 +173,7 @@ async function generateDeployConfig(cfAppConfig, fs) {
|
|
|
175
173
|
* @param fs reference to a mem-fs editor
|
|
176
174
|
*/
|
|
177
175
|
async function generateMTAFile(cfConfig, fs) {
|
|
176
|
+
// Step1. Create mta.yaml
|
|
178
177
|
if (!cfConfig.mtaId) {
|
|
179
178
|
if (cfConfig.isCap) {
|
|
180
179
|
await (0, mta_config_1.generateCAPMTA)({ ...cfConfig, mtaPath: cfConfig.rootPath }, fs);
|
|
@@ -185,14 +184,18 @@ async function generateMTAFile(cfConfig, fs) {
|
|
|
185
184
|
cfConfig.mtaId = cfConfig.appId;
|
|
186
185
|
cfConfig.mtaPath = cfConfig.rootPath;
|
|
187
186
|
}
|
|
187
|
+
// Step2. Append the approuter and destination to mta.yaml
|
|
188
|
+
await appendAppRouter(cfConfig, fs);
|
|
189
|
+
// Step3. Create any missing resources like package.json / xs-security.json / .gitignore
|
|
190
|
+
await (0, utils_1.generateSupportingConfig)(cfConfig, fs);
|
|
188
191
|
}
|
|
189
192
|
/**
|
|
190
|
-
* Updates the MTA configuration file.
|
|
193
|
+
* Updates the MTA configuration file with the app router and destination.
|
|
191
194
|
*
|
|
192
195
|
* @param cfConfig writer configuration
|
|
193
196
|
* @param fs reference to a mem-fs editor
|
|
194
197
|
*/
|
|
195
|
-
async function
|
|
198
|
+
async function appendAppRouter(cfConfig, fs) {
|
|
196
199
|
const mtaInstance = await (0, mta_config_1.getMtaConfig)(cfConfig.rootPath);
|
|
197
200
|
if (mtaInstance) {
|
|
198
201
|
await mtaInstance.addRoutingModules({
|
|
@@ -203,23 +206,13 @@ async function updateMtaConfig(cfConfig, fs) {
|
|
|
203
206
|
const appModule = cfConfig.appId;
|
|
204
207
|
const appRelativePath = (0, utils_1.toPosixPath)((0, path_1.relative)(cfConfig.rootPath, cfConfig.appPath));
|
|
205
208
|
await mtaInstance.addApp(appModule, appRelativePath ?? '.');
|
|
206
|
-
if (mtaInstance.hasAppFrontendRouter()) {
|
|
207
|
-
cfConfig.addAppFrontendRouter = true;
|
|
208
|
-
}
|
|
209
|
-
await (0, mta_config_1.addMtaDeployParameters)(mtaInstance);
|
|
210
209
|
if ((cfConfig.addMtaDestination && cfConfig.isCap) || cfConfig.destinationName === constants_1.DefaultMTADestination) {
|
|
211
210
|
// If the destination instance identifier is passed, create a destination instance
|
|
212
211
|
cfConfig.destinationName =
|
|
213
212
|
cfConfig.destinationName === constants_1.DefaultMTADestination
|
|
214
213
|
? mtaInstance.getFormattedPrefix(constants_1.ResourceMTADestination)
|
|
215
214
|
: cfConfig.destinationName;
|
|
216
|
-
|
|
217
|
-
// Append destination directly to app frontend
|
|
218
|
-
await mtaInstance.appendAppfrontCAPDestination(cfConfig.destinationName);
|
|
219
|
-
}
|
|
220
|
-
else {
|
|
221
|
-
await mtaInstance.appendInstanceBasedDestination(cfConfig.destinationName);
|
|
222
|
-
}
|
|
215
|
+
await mtaInstance.addDestinationToAppRouter(cfConfig.destinationName);
|
|
223
216
|
// This is required where a managed or standalone router hasn't been added yet to mta.yaml
|
|
224
217
|
if (!mtaInstance.hasManagedXsuaaResource()) {
|
|
225
218
|
cfConfig.destinationAuthentication = btp_utils_1.Authentication.NO_AUTHENTICATION;
|
|
@@ -227,7 +220,9 @@ async function updateMtaConfig(cfConfig, fs) {
|
|
|
227
220
|
}
|
|
228
221
|
cleanupStandaloneRoutes(cfConfig, mtaInstance, fs);
|
|
229
222
|
await saveMta(cfConfig, mtaInstance);
|
|
223
|
+
// Modify existing config, required in later steps
|
|
230
224
|
cfConfig.cloudServiceName = mtaInstance.cloudServiceName;
|
|
225
|
+
cfConfig.addAppFrontendRouter = mtaInstance.hasAppFrontendRouter();
|
|
231
226
|
}
|
|
232
227
|
}
|
|
233
228
|
/**
|
|
@@ -2,7 +2,7 @@ import { type Editor } from 'mem-fs-editor';
|
|
|
2
2
|
import { type Logger } from '@sap-ux/logger';
|
|
3
3
|
import { type CFBaseConfig } from '../types';
|
|
4
4
|
/**
|
|
5
|
-
* Add a standalone | managed | app
|
|
5
|
+
* Add a standalone | managed | frontend app router to an empty target folder.
|
|
6
6
|
*
|
|
7
7
|
* @param config writer configuration
|
|
8
8
|
* @param fs an optional reference to a mem-fs editor
|
|
@@ -4,15 +4,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.generateBaseConfig = generateBaseConfig;
|
|
7
|
+
const path_1 = require("path");
|
|
7
8
|
const mem_fs_1 = require("mem-fs");
|
|
8
9
|
const mem_fs_editor_1 = require("mem-fs-editor");
|
|
9
10
|
const utils_1 = require("../utils");
|
|
10
11
|
const logger_helper_1 = __importDefault(require("../logger-helper"));
|
|
11
12
|
const mta_config_1 = require("../mta-config");
|
|
12
|
-
const path_1 = require("path");
|
|
13
13
|
const i18n_1 = require("../i18n");
|
|
14
14
|
/**
|
|
15
|
-
* Add a standalone | managed | app
|
|
15
|
+
* Add a standalone | managed | frontend app router to an empty target folder.
|
|
16
16
|
*
|
|
17
17
|
* @param config writer configuration
|
|
18
18
|
* @param fs an optional reference to a mem-fs editor
|
|
@@ -33,7 +33,7 @@ async function generateBaseConfig(config, fs, logger) {
|
|
|
33
33
|
}
|
|
34
34
|
(0, mta_config_1.createMTA)(config);
|
|
35
35
|
await (0, mta_config_1.addRoutingConfig)(config, fs);
|
|
36
|
-
(0, utils_1.
|
|
36
|
+
await (0, utils_1.generateSupportingConfig)(config, fs);
|
|
37
37
|
logger_helper_1.default.logger?.debug(`CF Config ${JSON.stringify(config, null, 2)}`);
|
|
38
38
|
return fs;
|
|
39
39
|
}
|
|
@@ -28,18 +28,6 @@ export declare function toMtaModuleName(appId: string): string;
|
|
|
28
28
|
* @param config writer configuration
|
|
29
29
|
*/
|
|
30
30
|
export declare function createMTA(config: MTABaseConfig): void;
|
|
31
|
-
/**
|
|
32
|
-
* Add the build parameters to the MTA configuration.
|
|
33
|
-
*
|
|
34
|
-
* @param mtaInstance MTA instance
|
|
35
|
-
*/
|
|
36
|
-
export declare function addMtaBuildParams(mtaInstance: MtaConfig): Promise<void>;
|
|
37
|
-
/**
|
|
38
|
-
* Add the deployment parameters to the MTA configuration.
|
|
39
|
-
*
|
|
40
|
-
* @param mtaInstance MTA instance
|
|
41
|
-
*/
|
|
42
|
-
export declare function addMtaDeployParameters(mtaInstance: MtaConfig): Promise<void>;
|
|
43
31
|
/**
|
|
44
32
|
* Validate MTA binary is available.
|
|
45
33
|
*
|
|
@@ -57,7 +45,7 @@ export declare function doesCDSBinaryExist(): void;
|
|
|
57
45
|
*/
|
|
58
46
|
export declare function validateMtaConfig(config: CFBaseConfig): void;
|
|
59
47
|
/**
|
|
60
|
-
* Add standalone | managed |
|
|
48
|
+
* Add standalone | managed | frontend app router to the target folder.
|
|
61
49
|
*
|
|
62
50
|
* @param config writer configuration
|
|
63
51
|
* @param fs reference to a mem-fs editor
|
package/dist/mta-config/index.js
CHANGED
|
@@ -21,8 +21,6 @@ exports.getMtaId = getMtaId;
|
|
|
21
21
|
exports.getMtaConfig = getMtaConfig;
|
|
22
22
|
exports.toMtaModuleName = toMtaModuleName;
|
|
23
23
|
exports.createMTA = createMTA;
|
|
24
|
-
exports.addMtaBuildParams = addMtaBuildParams;
|
|
25
|
-
exports.addMtaDeployParameters = addMtaDeployParameters;
|
|
26
24
|
exports.doesMTABinaryExist = doesMTABinaryExist;
|
|
27
25
|
exports.doesCDSBinaryExist = doesCDSBinaryExist;
|
|
28
26
|
exports.validateMtaConfig = validateMtaConfig;
|
|
@@ -87,41 +85,18 @@ function toMtaModuleName(appId) {
|
|
|
87
85
|
* @param config writer configuration
|
|
88
86
|
*/
|
|
89
87
|
function createMTA(config) {
|
|
88
|
+
const mtaId = `${config.mtaId.slice(0, 128)}`;
|
|
90
89
|
const mtaTemplate = (0, fs_1.readFileSync)((0, utils_1.getTemplatePath)(`app/${project_access_1.FileName.MtaYaml}`), 'utf-8');
|
|
91
90
|
const mtaContents = (0, ejs_1.render)(mtaTemplate, {
|
|
92
|
-
id:
|
|
91
|
+
id: mtaId,
|
|
93
92
|
mtaDescription: config.mtaDescription ?? constants_1.MTADescription,
|
|
94
93
|
mtaVersion: config.mtaVersion ?? constants_1.MTAVersion
|
|
95
94
|
});
|
|
95
|
+
config.mtaId = mtaId;
|
|
96
96
|
// Written to disk immediately! Subsequent calls are dependent on it being on the file system i.e mta-lib.
|
|
97
97
|
(0, fs_1.writeFileSync)((0, path_1.join)(config.mtaPath, project_access_1.FileName.MtaYaml), mtaContents);
|
|
98
98
|
logger_helper_1.default.logger?.debug((0, i18n_1.t)('debug.mtaCreated', { mtaPath: config.mtaPath }));
|
|
99
99
|
}
|
|
100
|
-
/**
|
|
101
|
-
* Add the build parameters to the MTA configuration.
|
|
102
|
-
*
|
|
103
|
-
* @param mtaInstance MTA instance
|
|
104
|
-
*/
|
|
105
|
-
async function addMtaBuildParams(mtaInstance) {
|
|
106
|
-
let params = await mtaInstance.getBuildParameters();
|
|
107
|
-
params = { ...(params || {}), ...{} };
|
|
108
|
-
params['before-all'] ||= [];
|
|
109
|
-
const buildParams = { builder: 'custom', commands: ['npm install'] };
|
|
110
|
-
params['before-all'].push(buildParams);
|
|
111
|
-
await mtaInstance.updateBuildParams(params);
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Add the deployment parameters to the MTA configuration.
|
|
115
|
-
*
|
|
116
|
-
* @param mtaInstance MTA instance
|
|
117
|
-
*/
|
|
118
|
-
async function addMtaDeployParameters(mtaInstance) {
|
|
119
|
-
let params = await mtaInstance.getParameters();
|
|
120
|
-
params = { ...(params || {}), ...{} };
|
|
121
|
-
params[constants_1.deployMode] = 'html5-repo';
|
|
122
|
-
params[constants_1.enableParallelDeployments] = true;
|
|
123
|
-
await mtaInstance.updateParameters(params);
|
|
124
|
-
}
|
|
125
100
|
/**
|
|
126
101
|
* Validate MTA binary is available.
|
|
127
102
|
*
|
|
@@ -189,7 +164,7 @@ async function createCAPMTAAppFrontend(config, fs) {
|
|
|
189
164
|
logger_helper_1.default.logger?.debug((0, i18n_1.t)('debug.mtaCreated', { mtaPath: config.mtaPath }));
|
|
190
165
|
}
|
|
191
166
|
/**
|
|
192
|
-
* Add standalone
|
|
167
|
+
* Add standalone app router to the target folder.
|
|
193
168
|
*
|
|
194
169
|
* @param cfConfig writer configuration
|
|
195
170
|
* @param mtaInstance MTA configuration instance
|
|
@@ -223,7 +198,7 @@ async function addStandaloneRouter(cfConfig, mtaInstance, fs) {
|
|
|
223
198
|
}
|
|
224
199
|
}
|
|
225
200
|
/**
|
|
226
|
-
* Add standalone | managed |
|
|
201
|
+
* Add standalone | managed | frontend app router to the target folder.
|
|
227
202
|
*
|
|
228
203
|
* @param config writer configuration
|
|
229
204
|
* @param fs reference to a mem-fs editor
|
|
@@ -237,7 +212,6 @@ async function addRoutingConfig(config, fs) {
|
|
|
237
212
|
else {
|
|
238
213
|
await mtaConfigInstance.addRouterType({ routerType: config.routerType, addMissingModules: false });
|
|
239
214
|
}
|
|
240
|
-
await addMtaDeployParameters(mtaConfigInstance);
|
|
241
215
|
await mtaConfigInstance.save();
|
|
242
216
|
logger_helper_1.default.logger?.debug((0, i18n_1.t)('debug.capMtaUpdated'));
|
|
243
217
|
}
|
package/dist/mta-config/mta.d.ts
CHANGED
|
@@ -236,19 +236,25 @@ export declare class MtaConfig {
|
|
|
236
236
|
key: string;
|
|
237
237
|
value: string;
|
|
238
238
|
}): Promise<void>;
|
|
239
|
+
/**
|
|
240
|
+
* Add a destination to the approuter.
|
|
241
|
+
*
|
|
242
|
+
* @param cfDestination The name of the destination to be appended
|
|
243
|
+
*/
|
|
244
|
+
addDestinationToAppRouter(cfDestination: string | undefined): Promise<void>;
|
|
239
245
|
/**
|
|
240
246
|
* Add destination to App Frontend router.
|
|
241
247
|
*
|
|
242
248
|
* @param cfDestination Then name of the destination to be appended
|
|
243
249
|
*/
|
|
244
|
-
appendAppfrontCAPDestination
|
|
250
|
+
private appendAppfrontCAPDestination;
|
|
245
251
|
/**
|
|
246
252
|
* Append a destination instance to the mta.yaml file, required by consumers of CAP services when using Standalone or Managed approuter.
|
|
247
253
|
*
|
|
248
254
|
* @param {string} cfDestination The new destination instance name
|
|
249
255
|
* @returns {Promise<void>} A promise that resolves when the change request has been processed
|
|
250
256
|
*/
|
|
251
|
-
appendInstanceBasedDestination
|
|
257
|
+
private appendInstanceBasedDestination;
|
|
252
258
|
/**
|
|
253
259
|
* Save changes to the mta.yaml file.
|
|
254
260
|
*
|
|
@@ -280,11 +286,21 @@ export declare class MtaConfig {
|
|
|
280
286
|
*/
|
|
281
287
|
getFormattedPrefix(formatString: string): string;
|
|
282
288
|
/**
|
|
283
|
-
* Retrieve the app-content module, different types can be found.
|
|
289
|
+
* Retrieve the app-content module, different types can be found depending on the router type configuration.
|
|
284
290
|
*
|
|
285
291
|
* @returns {mta.Module} return the app-content module
|
|
286
292
|
*/
|
|
287
293
|
private getAppContentModule;
|
|
294
|
+
/**
|
|
295
|
+
* Add the build parameters to the MTA configuration.
|
|
296
|
+
*
|
|
297
|
+
*/
|
|
298
|
+
addMtaBuildParameters(): Promise<void>;
|
|
299
|
+
/**
|
|
300
|
+
* Add the deployment parameters to the MTA configuration.
|
|
301
|
+
*
|
|
302
|
+
*/
|
|
303
|
+
addMtaDeployParameters(): Promise<void>;
|
|
288
304
|
}
|
|
289
305
|
/**
|
|
290
306
|
* Returns true if there's an MTA configuration file in the supplied directory.
|
package/dist/mta-config/mta.js
CHANGED
|
@@ -520,6 +520,7 @@ class MtaConfig {
|
|
|
520
520
|
this.log?.debug((0, i18n_1.t)('debug.html5AppAdded', { appName }));
|
|
521
521
|
}
|
|
522
522
|
await this.syncHtml5Apps();
|
|
523
|
+
await this.addMtaDeployParameters();
|
|
523
524
|
}
|
|
524
525
|
async syncHtml5Apps() {
|
|
525
526
|
// Need to handle where existing HTML5 apps are added by `cds` which follow a different naming convention when added to mta
|
|
@@ -596,6 +597,7 @@ class MtaConfig {
|
|
|
596
597
|
}
|
|
597
598
|
await this.cleanupModules();
|
|
598
599
|
}
|
|
600
|
+
await this.addMtaDeployParameters();
|
|
599
601
|
}
|
|
600
602
|
/**
|
|
601
603
|
* Append different routers to mta configuration.
|
|
@@ -801,6 +803,20 @@ class MtaConfig {
|
|
|
801
803
|
}
|
|
802
804
|
}
|
|
803
805
|
}
|
|
806
|
+
/**
|
|
807
|
+
* Add a destination to the approuter.
|
|
808
|
+
*
|
|
809
|
+
* @param cfDestination The name of the destination to be appended
|
|
810
|
+
*/
|
|
811
|
+
async addDestinationToAppRouter(cfDestination) {
|
|
812
|
+
if (this.hasAppFrontendRouter()) {
|
|
813
|
+
// Append destination directly to app frontend
|
|
814
|
+
await this.appendAppfrontCAPDestination(cfDestination);
|
|
815
|
+
}
|
|
816
|
+
else {
|
|
817
|
+
await this.appendInstanceBasedDestination(cfDestination);
|
|
818
|
+
}
|
|
819
|
+
}
|
|
804
820
|
/**
|
|
805
821
|
* Add destination to App Frontend router.
|
|
806
822
|
*
|
|
@@ -1039,7 +1055,7 @@ class MtaConfig {
|
|
|
1039
1055
|
return (0, util_1.format)(formatString, this.prefix).replace(/[^\w-]/g, '_');
|
|
1040
1056
|
}
|
|
1041
1057
|
/**
|
|
1042
|
-
* Retrieve the app-content module, different types can be found.
|
|
1058
|
+
* Retrieve the app-content module, different types can be found depending on the router type configuration.
|
|
1043
1059
|
*
|
|
1044
1060
|
* @returns {mta.Module} return the app-content module
|
|
1045
1061
|
*/
|
|
@@ -1048,6 +1064,30 @@ class MtaConfig {
|
|
|
1048
1064
|
return (this.modules.get('com.sap.application.content:resource') ??
|
|
1049
1065
|
this.modules.get('com.sap.application.content:appfront'));
|
|
1050
1066
|
}
|
|
1067
|
+
/**
|
|
1068
|
+
* Add the build parameters to the MTA configuration.
|
|
1069
|
+
*
|
|
1070
|
+
*/
|
|
1071
|
+
async addMtaBuildParameters() {
|
|
1072
|
+
const params = (await this.getBuildParameters()) ?? {};
|
|
1073
|
+
params['before-all'] ??= [];
|
|
1074
|
+
params['before-all'].push({
|
|
1075
|
+
builder: 'custom',
|
|
1076
|
+
commands: ['npm install']
|
|
1077
|
+
});
|
|
1078
|
+
await this.updateBuildParams(params);
|
|
1079
|
+
}
|
|
1080
|
+
/**
|
|
1081
|
+
* Add the deployment parameters to the MTA configuration.
|
|
1082
|
+
*
|
|
1083
|
+
*/
|
|
1084
|
+
async addMtaDeployParameters() {
|
|
1085
|
+
let params = await this.getParameters();
|
|
1086
|
+
params = { ...(params ?? {}), ...{} };
|
|
1087
|
+
params[constants_1.deployMode] = 'html5-repo';
|
|
1088
|
+
params[constants_1.enableParallelDeployments] = true;
|
|
1089
|
+
await this.updateParameters(params);
|
|
1090
|
+
}
|
|
1051
1091
|
}
|
|
1052
1092
|
exports.MtaConfig = MtaConfig;
|
|
1053
1093
|
/**
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import type { Editor } from 'mem-fs-editor';
|
|
1
2
|
import { type Authentication, type Destinations } from '@sap-ux/btp-utils';
|
|
2
3
|
import { type Manifest } from '@sap-ux/project-access';
|
|
3
|
-
import type
|
|
4
|
-
import { type MTABaseConfig, type CFConfig, type CFBaseConfig, type CFAppConfig } from './types';
|
|
4
|
+
import { type MTABaseConfig, type CFBaseConfig, type CFAppConfig } from './types';
|
|
5
5
|
/**
|
|
6
6
|
* Read manifest file for processing.
|
|
7
7
|
*
|
|
@@ -93,15 +93,9 @@ export declare function addCommonPackageDependencies(targetPath: string, fs: Edi
|
|
|
93
93
|
*
|
|
94
94
|
* @param config writer configuration
|
|
95
95
|
* @param fs reference to a mem-fs editor
|
|
96
|
+
* @param addTenant If true, append tenant to the xs-security.json file
|
|
96
97
|
*/
|
|
97
|
-
export declare function generateSupportingConfig(config:
|
|
98
|
-
/**
|
|
99
|
-
* Add supporting configuration to the target folder.
|
|
100
|
-
*
|
|
101
|
-
* @param config writer configuration
|
|
102
|
-
* @param fs reference to a mem-fs editor
|
|
103
|
-
*/
|
|
104
|
-
export declare function addSupportingConfig(config: MTABaseConfig, fs: Editor): void;
|
|
98
|
+
export declare function generateSupportingConfig(config: MTABaseConfig, fs: Editor, addTenant?: boolean): Promise<void>;
|
|
105
99
|
/**
|
|
106
100
|
* Update the writer configuration with defaults.
|
|
107
101
|
*
|
package/dist/utils.js
CHANGED
|
@@ -12,7 +12,6 @@ exports.addGitIgnore = addGitIgnore;
|
|
|
12
12
|
exports.addRootPackage = addRootPackage;
|
|
13
13
|
exports.addCommonPackageDependencies = addCommonPackageDependencies;
|
|
14
14
|
exports.generateSupportingConfig = generateSupportingConfig;
|
|
15
|
-
exports.addSupportingConfig = addSupportingConfig;
|
|
16
15
|
exports.setMtaDefaults = setMtaDefaults;
|
|
17
16
|
exports.updateRootPackage = updateRootPackage;
|
|
18
17
|
exports.enforceValidRouterConfig = enforceValidRouterConfig;
|
|
@@ -21,10 +20,10 @@ exports.runCommand = runCommand;
|
|
|
21
20
|
exports.fileExists = fileExists;
|
|
22
21
|
const path_1 = require("path");
|
|
23
22
|
const semver_1 = require("semver");
|
|
23
|
+
const nodejs_utils_1 = require("@sap-ux/nodejs-utils");
|
|
24
24
|
const btp_utils_1 = require("@sap-ux/btp-utils");
|
|
25
25
|
const project_access_1 = require("@sap-ux/project-access");
|
|
26
26
|
const constants_1 = require("./constants");
|
|
27
|
-
const nodejs_utils_1 = require("@sap-ux/nodejs-utils");
|
|
28
27
|
let cachedDestinationsList = {};
|
|
29
28
|
/**
|
|
30
29
|
* Read manifest file for processing.
|
|
@@ -158,33 +157,20 @@ async function addCommonPackageDependencies(targetPath, fs) {
|
|
|
158
157
|
*
|
|
159
158
|
* @param config writer configuration
|
|
160
159
|
* @param fs reference to a mem-fs editor
|
|
160
|
+
* @param addTenant If true, append tenant to the xs-security.json file
|
|
161
161
|
*/
|
|
162
|
-
async function generateSupportingConfig(config, fs) {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
addRootPackage(mtaConfig, fs);
|
|
162
|
+
async function generateSupportingConfig(config, fs, addTenant = true) {
|
|
163
|
+
if (config.mtaId && !fs.exists((0, path_1.join)(config.mtaPath, 'package.json'))) {
|
|
164
|
+
addRootPackage(config, fs);
|
|
166
165
|
}
|
|
167
|
-
if (
|
|
168
|
-
|
|
169
|
-
!fileExists(fs, (0, path_1.join)(config.rootPath, project_access_1.FileName.XSSecurityJson))) {
|
|
170
|
-
addXSSecurityConfig(mtaConfig, fs, true);
|
|
166
|
+
if (config.mtaId && !fs.exists((0, path_1.join)(config.mtaPath, project_access_1.FileName.XSSecurityJson))) {
|
|
167
|
+
addXSSecurityConfig(config, fs, addTenant);
|
|
171
168
|
}
|
|
172
169
|
// Be a good citizen and add a .gitignore if missing from the existing project root
|
|
173
|
-
if (!
|
|
174
|
-
addGitIgnore(config.
|
|
170
|
+
if (!fs.exists((0, path_1.join)(config.mtaPath, '.gitignore'))) {
|
|
171
|
+
addGitIgnore(config.mtaPath, fs);
|
|
175
172
|
}
|
|
176
173
|
}
|
|
177
|
-
/**
|
|
178
|
-
* Add supporting configuration to the target folder.
|
|
179
|
-
*
|
|
180
|
-
* @param config writer configuration
|
|
181
|
-
* @param fs reference to a mem-fs editor
|
|
182
|
-
*/
|
|
183
|
-
function addSupportingConfig(config, fs) {
|
|
184
|
-
addRootPackage(config, fs);
|
|
185
|
-
addGitIgnore(config.mtaPath, fs);
|
|
186
|
-
addXSSecurityConfig(config, fs);
|
|
187
|
-
}
|
|
188
174
|
/**
|
|
189
175
|
* Update the writer configuration with defaults.
|
|
190
176
|
*
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap-ux/cf-deploy-config-writer",
|
|
3
3
|
"description": "Add or amend Cloud Foundry and ABAP deployment configuration for SAP projects",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.11",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/SAP/open-ux-tools.git",
|