@sap-ux/adp-tooling 0.16.2 → 0.16.4

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.
@@ -74,7 +74,7 @@ async function getHtml5RepoCredentials(spaceGuid, logger) {
74
74
  names: [HTML5_APPS_REPO_RUNTIME]
75
75
  }, logger);
76
76
  if (!serviceKeys?.credentials?.length) {
77
- await (0, api_1.createService)(spaceGuid, 'app-runtime', HTML5_APPS_REPO_RUNTIME, ['html5-apps-repo-rt'], undefined, undefined, logger);
77
+ await (0, api_1.createService)(spaceGuid, 'app-runtime', HTML5_APPS_REPO_RUNTIME, ['html5-apps-repo-rt'], undefined, undefined, undefined, logger);
78
78
  serviceKeys = await (0, api_1.getServiceInstanceKeys)({ names: [HTML5_APPS_REPO_RUNTIME] }, logger);
79
79
  if (!serviceKeys?.credentials?.length) {
80
80
  logger.debug((0, i18n_1.t)('error.noUaaCredentialsFoundForHtml5Repo'));
@@ -43,9 +43,10 @@ export declare function getAppParamsFromUI5Yaml(projectPath: string): AppParamsE
43
43
  *
44
44
  * @param {AdjustMtaYamlParams} params - The parameters.
45
45
  * @param {Editor} memFs - The mem-fs editor instance.
46
+ * @param {string} [templatePathOverwrite] - The template path overwrite.
46
47
  * @param {ToolsLogger} logger - The logger.
47
48
  * @returns {Promise<void>} The promise.
48
49
  */
49
- export declare function adjustMtaYaml({ projectPath, moduleName, appRouterType, businessSolutionName, businessService, spaceGuid }: AdjustMtaYamlParams, memFs: Editor, logger?: ToolsLogger): Promise<void>;
50
+ export declare function adjustMtaYaml({ projectPath, moduleName, appRouterType, businessSolutionName, businessService, spaceGuid }: AdjustMtaYamlParams, memFs: Editor, templatePathOverwrite?: string, logger?: ToolsLogger): Promise<void>;
50
51
  export {};
51
52
  //# sourceMappingURL=yaml.d.ts.map
@@ -396,10 +396,11 @@ function adjustMtaYamlFlpModule(yamlContent, projectName, businessService) {
396
396
  *
397
397
  * @param {AdjustMtaYamlParams} params - The parameters.
398
398
  * @param {Editor} memFs - The mem-fs editor instance.
399
+ * @param {string} [templatePathOverwrite] - The template path overwrite.
399
400
  * @param {ToolsLogger} logger - The logger.
400
401
  * @returns {Promise<void>} The promise.
401
402
  */
402
- async function adjustMtaYaml({ projectPath, moduleName, appRouterType, businessSolutionName, businessService, spaceGuid }, memFs, logger) {
403
+ async function adjustMtaYaml({ projectPath, moduleName, appRouterType, businessSolutionName, businessService, spaceGuid }, memFs, templatePathOverwrite, logger) {
403
404
  const timestamp = Date.now().toString();
404
405
  const mtaYamlPath = path.join(projectPath, 'mta.yaml');
405
406
  const loadedYamlContent = (0, yaml_loader_1.getYamlContent)(mtaYamlPath);
@@ -428,7 +429,7 @@ async function adjustMtaYaml({ projectPath, moduleName, appRouterType, businessS
428
429
  adjustMtaYamlOwnModule(yamlContent, moduleName);
429
430
  // should go last since it sorts the modules (workaround, should be removed after fixed in deployment module)
430
431
  adjustMtaYamlFlpModule(yamlContent, projectName, businessService);
431
- await (0, api_1.createServices)(projectPath, yamlContent, initialServices, timestamp, spaceGuid, logger);
432
+ await (0, api_1.createServices)(projectPath, yamlContent, initialServices, timestamp, spaceGuid, templatePathOverwrite, logger);
432
433
  const updatedYamlContent = js_yaml_1.default.dump(yamlContent);
433
434
  memFs.write(mtaYamlPath, updatedYamlContent);
434
435
  logger?.debug(`Adjusted MTA YAML for project ${projectPath}`);
@@ -36,12 +36,13 @@ export declare function getFDCApps(appHostIds: string[], cfConfig: CfConfig, log
36
36
  * @param {object} [security] - Security configuration.
37
37
  * @param {string | null} security.filePath - The security file path.
38
38
  * @param {string} [security.xsappname] - The XS app name.
39
+ * @param {string} [templatePathOverwrite] - The template path overwrite.
39
40
  * @param {ToolsLogger} [logger] - The logger.
40
41
  */
41
42
  export declare function createService(spaceGuid: string, plan: string, serviceInstanceName: string, tags: string[], serviceName: string | undefined, security?: {
42
43
  filePath: string | null;
43
44
  xsappname?: string;
44
- }, logger?: ToolsLogger): Promise<void>;
45
+ }, templatePathOverwrite?: string, logger?: ToolsLogger): Promise<void>;
45
46
  /**
46
47
  * Creates the services.
47
48
  *
@@ -50,10 +51,11 @@ export declare function createService(spaceGuid: string, plan: string, serviceIn
50
51
  * @param {string[]} initialServices - The initial services.
51
52
  * @param {string} timestamp - The timestamp.
52
53
  * @param {string} spaceGuid - The space GUID.
54
+ * @param {string} [templatePathOverwrite] - The template path overwrite.
53
55
  * @param {ToolsLogger} logger - The logger.
54
56
  * @returns {Promise<void>} The promise.
55
57
  */
56
- export declare function createServices(projectPath: string, yamlContent: MtaYaml, initialServices: string[], timestamp: string, spaceGuid: string, logger?: ToolsLogger): Promise<void>;
58
+ export declare function createServices(projectPath: string, yamlContent: MtaYaml, initialServices: string[], timestamp: string, spaceGuid: string, templatePathOverwrite?: string, logger?: ToolsLogger): Promise<void>;
57
59
  /**
58
60
  * Gets the service instance keys.
59
61
  *
@@ -151,9 +151,10 @@ async function getFDCApps(appHostIds, cfConfig, logger) {
151
151
  * @param {object} [security] - Security configuration.
152
152
  * @param {string | null} security.filePath - The security file path.
153
153
  * @param {string} [security.xsappname] - The XS app name.
154
+ * @param {string} [templatePathOverwrite] - The template path overwrite.
154
155
  * @param {ToolsLogger} [logger] - The logger.
155
156
  */
156
- async function createService(spaceGuid, plan, serviceInstanceName, tags, serviceName, security, logger) {
157
+ async function createService(spaceGuid, plan, serviceInstanceName, tags, serviceName, security, templatePathOverwrite, logger) {
157
158
  try {
158
159
  const { filePath, xsappname } = security ?? {};
159
160
  if (!serviceName) {
@@ -166,7 +167,9 @@ async function createService(spaceGuid, plan, serviceInstanceName, tags, service
166
167
  if (filePath) {
167
168
  let xsSecurity = null;
168
169
  try {
169
- const filePath = path.resolve(__dirname, '../../../templates/cf/xs-security.json');
170
+ const baseTmplPath = path.join(__dirname, '../../../templates');
171
+ const templatePath = templatePathOverwrite ?? baseTmplPath;
172
+ const filePath = path.resolve(templatePath, 'cf/xs-security.json');
170
173
  const xsContent = fs.readFileSync(filePath, 'utf-8');
171
174
  xsSecurity = JSON.parse(xsContent);
172
175
  xsSecurity.xsappname = xsappname;
@@ -193,20 +196,21 @@ async function createService(spaceGuid, plan, serviceInstanceName, tags, service
193
196
  * @param {string[]} initialServices - The initial services.
194
197
  * @param {string} timestamp - The timestamp.
195
198
  * @param {string} spaceGuid - The space GUID.
199
+ * @param {string} [templatePathOverwrite] - The template path overwrite.
196
200
  * @param {ToolsLogger} logger - The logger.
197
201
  * @returns {Promise<void>} The promise.
198
202
  */
199
- async function createServices(projectPath, yamlContent, initialServices, timestamp, spaceGuid, logger) {
203
+ async function createServices(projectPath, yamlContent, initialServices, timestamp, spaceGuid, templatePathOverwrite, logger) {
200
204
  const excludeServices = new Set([...initialServices, 'portal', 'html5-apps-repo']);
201
205
  const xsSecurityPath = path.join(projectPath, 'xs-security.json');
202
206
  const xsSecurityProjectName = (0, project_1.getProjectNameForXsSecurity)(yamlContent, timestamp);
203
207
  for (const resource of yamlContent.resources ?? []) {
204
208
  if (!excludeServices.has(resource?.parameters?.service ?? '')) {
205
209
  if (resource?.parameters?.service === 'xsuaa') {
206
- await createService(spaceGuid, resource.parameters['service-plan'] ?? '', resource.parameters['service-name'] ?? '', [], resource.parameters.service, { filePath: xsSecurityPath, xsappname: xsSecurityProjectName }, logger);
210
+ await createService(spaceGuid, resource.parameters['service-plan'] ?? '', resource.parameters['service-name'] ?? '', [], resource.parameters.service, { filePath: xsSecurityPath, xsappname: xsSecurityProjectName }, templatePathOverwrite, logger);
207
211
  }
208
212
  else {
209
- await createService(spaceGuid, resource.parameters['service-plan'] ?? '', resource.parameters['service-name'] ?? '', [], resource.parameters.service, { filePath: null, xsappname: xsSecurityProjectName }, logger);
213
+ await createService(spaceGuid, resource.parameters['service-plan'] ?? '', resource.parameters['service-name'] ?? '', [], resource.parameters.service, { filePath: null, xsappname: xsSecurityProjectName }, templatePathOverwrite, logger);
210
214
  }
211
215
  }
212
216
  }
package/dist/writer/cf.js CHANGED
@@ -30,7 +30,7 @@ async function generateCf(basePath, config, logger, fs) {
30
30
  businessSolutionName: cf.businessSolutionName ?? '',
31
31
  businessService: cf.businessService,
32
32
  spaceGuid: cf.space.GUID
33
- }, fs, logger);
33
+ }, fs, config.options?.templatePathOverwrite, logger);
34
34
  if (fullConfig.app.i18nModels) {
35
35
  (0, i18n_1.writeI18nModels)(basePath, fullConfig.app.i18nModels, fs);
36
36
  }
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.16.2",
12
+ "version": "0.16.4",
13
13
  "license": "Apache-2.0",
14
14
  "author": "@SAP/ux-tools-team",
15
15
  "main": "dist/index.js",
@@ -39,7 +39,7 @@
39
39
  "@sap-ux/axios-extension": "1.23.0",
40
40
  "@sap-ux/btp-utils": "1.1.4",
41
41
  "@sap-ux/i18n": "0.3.4",
42
- "@sap-ux/inquirer-common": "0.7.51",
42
+ "@sap-ux/inquirer-common": "0.8.0",
43
43
  "@sap-ux/logger": "0.7.0",
44
44
  "@sap-ux/nodejs-utils": "0.2.7",
45
45
  "@sap-ux/odata-service-writer": "0.27.25",