@sap-ux/deploy-tooling 0.18.10 → 0.18.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.
@@ -1,5 +1,6 @@
1
1
  import type { AbapDeployConfig } from '../types';
2
2
  import type { BspConfig } from '@sap-ux/axios-extension';
3
+ import type { Logger } from '@sap-ux/logger';
3
4
  /**
4
5
  * Clones the given config and removes secrets so that it can be printed to a log file.
5
6
  *
@@ -26,7 +27,8 @@ export declare function isBspConfig(config: Partial<BspConfig>): config is BspCo
26
27
  * Validate the given config. If anything mandatory is missing throw an error.
27
28
  *
28
29
  * @param config - the config to be validated
30
+ * @param logger Logger used by deploy tooling
29
31
  * @returns reference to the given config
30
32
  */
31
- export declare function validateConfig(config: AbapDeployConfig | undefined): AbapDeployConfig;
33
+ export declare function validateConfig(config: AbapDeployConfig | undefined, logger?: Logger): AbapDeployConfig;
32
34
  //# sourceMappingURL=config.d.ts.map
@@ -61,12 +61,18 @@ function isBspConfig(config) {
61
61
  * Validate the given config. If anything mandatory is missing throw an error.
62
62
  *
63
63
  * @param config - the config to be validated
64
+ * @param logger Logger used by deploy tooling
64
65
  * @returns reference to the given config
65
66
  */
66
- function validateConfig(config) {
67
+ function validateConfig(config, logger) {
67
68
  if (!config) {
68
69
  throw new Error('The deployment configuration is missing.');
69
70
  }
71
+ if (config.app.package && config.app.package !== config.app.package.toUpperCase()) {
72
+ const normalized = config.app.package.toUpperCase();
73
+ logger?.warn(`Package name '${config.app.package}' was normalized to '${normalized}'. Lowercase package names may cause deployment failures.`);
74
+ config.app.package = normalized;
75
+ }
70
76
  if (config.target) {
71
77
  config.target = validateTarget(config.target);
72
78
  }
@@ -1,5 +1,4 @@
1
1
  import type { AbapDeployConfig, CliOptions } from '../types';
2
- import type { Logger } from '@sap-ux/logger';
3
2
  /**
4
3
  * Tries to read the version of the modules package.json but in case of an error, it returns the manually maintained version matching major.minor of the module.
5
4
  *
@@ -18,8 +17,7 @@ export declare function getDeploymentConfig(path: string): Promise<AbapDeployCon
18
17
  *
19
18
  * @param taskConfig - base configuration from the file
20
19
  * @param options - CLI options
21
- * @param logger - optional logger for warnings
22
20
  * @returns the merged config
23
21
  */
24
- export declare function mergeConfig(taskConfig: AbapDeployConfig, options: CliOptions, logger?: Logger): Promise<AbapDeployConfig>;
22
+ export declare function mergeConfig(taskConfig: AbapDeployConfig, options: CliOptions): Promise<AbapDeployConfig>;
25
23
  //# sourceMappingURL=config.d.ts.map
@@ -157,21 +157,15 @@ function mergeCredentials(taskConfig, options) {
157
157
  *
158
158
  * @param taskConfig - base configuration from the file
159
159
  * @param options - CLI options
160
- * @param logger - optional logger for warnings
161
160
  * @returns the merged config
162
161
  */
163
- async function mergeConfig(taskConfig, options, logger) {
162
+ async function mergeConfig(taskConfig, options) {
164
163
  const app = {
165
164
  name: options.name ?? taskConfig.app?.name,
166
165
  description: options.description ?? taskConfig.app?.description,
167
166
  package: options.package ?? taskConfig.app?.package,
168
167
  transport: options.transport ?? taskConfig.app?.transport
169
168
  };
170
- if (app.package && app.package !== app.package.toUpperCase()) {
171
- const normalized = app.package.toUpperCase();
172
- logger?.warn(`Package name '${app.package}' was normalized to '${normalized}'. Lowercase package names may cause deployment failures.`);
173
- app.package = normalized;
174
- }
175
169
  const target = mergeTarget(taskConfig.target, options);
176
170
  const config = { app, target, credentials: mergeCredentials(taskConfig, options) };
177
171
  config.test = mergeFlag(options.test, taskConfig.test);
package/dist/cli/index.js CHANGED
@@ -74,7 +74,7 @@ function createCommand(name) {
74
74
  return command.version((0, config_1.getVersion)(), '-v, --version', 'version of the deploy tooling');
75
75
  }
76
76
  /**
77
- * Prepare the run of the task based on on the configured command i.e. read and validate configuration and create logger.
77
+ * Prepare the run of the task based on the configured command i.e. read and validate configuration and create logger.
78
78
  *
79
79
  * @param cmd - CLI command configuration to be executed
80
80
  * @returns a set of objects required for the command execution
@@ -93,7 +93,7 @@ async function prepareRun(cmd) {
93
93
  });
94
94
  // Handle empty config when not passed in
95
95
  const taskConfig = options.config ? await (0, config_1.getDeploymentConfig)(options.config) : {};
96
- const config = await (0, config_1.mergeConfig)(taskConfig, options, logger);
96
+ const config = await (0, config_1.mergeConfig)(taskConfig, options);
97
97
  if (logLevel >= logger_1.LogLevel.Debug) {
98
98
  logger.debug((0, base_1.getConfigForLogging)(config));
99
99
  }
package/dist/ui5/index.js CHANGED
@@ -5,6 +5,28 @@ const base_1 = require("../base");
5
5
  const archive_1 = require("./archive");
6
6
  const dotenv_1 = require("dotenv");
7
7
  const ui5_config_1 = require("@sap-ux/ui5-config");
8
+ /**
9
+ * Resolves a log level value from ui5.yaml configuration to a LogLevel enum value.
10
+ * ui5.yaml delivers all scalar values as strings (e.g. "verbose"), but LogLevel is
11
+ * a numeric enum. A numeric value is returned as-is; a string is matched
12
+ * case-insensitively against the enum keys. Falls back to LogLevel.Info if
13
+ * the value is absent or unrecognised.
14
+ *
15
+ * @param value - raw value from options.configuration.log
16
+ * @returns resolved LogLevel
17
+ */
18
+ function resolveLogLevel(value) {
19
+ if (typeof value === 'number') {
20
+ return value;
21
+ }
22
+ if (typeof value === 'string') {
23
+ const key = Object.keys(logger_1.LogLevel).find((k) => k.toLowerCase() === value.toLowerCase());
24
+ if (key !== undefined) {
25
+ return logger_1.LogLevel[key];
26
+ }
27
+ }
28
+ return logger_1.LogLevel.Info;
29
+ }
8
30
  /**
9
31
  * Custom task to upload the build result to the UI5 ABAP Repository.
10
32
  *
@@ -14,15 +36,13 @@ const ui5_config_1 = require("@sap-ux/ui5-config");
14
36
  */
15
37
  async function task({ workspace, options }) {
16
38
  (0, dotenv_1.config)();
17
- const logLevel = options.configuration?.log ?? logger_1.LogLevel.Info;
18
- const logger = new logger_1.ToolsLogger({
19
- transports: [new logger_1.UI5ToolingTransport({ moduleName: `${types_1.NAME} ${options.projectName}` })],
20
- logLevel: options.configuration?.log ?? logger_1.LogLevel.Info
21
- });
39
+ const moduleName = `${types_1.NAME} ${options.projectName}`;
40
+ const logLevel = resolveLogLevel(options.configuration?.log);
41
+ const logger = new logger_1.ToolsLogger({ transports: [new logger_1.UI5ToolingTransport({ moduleName })], logLevel });
22
42
  if (logLevel >= logger_1.LogLevel.Debug) {
23
43
  logger.debug({ ...options.configuration, credentials: undefined });
24
44
  }
25
- const config = (0, base_1.validateConfig)(options.configuration);
45
+ const config = (0, base_1.validateConfig)(options.configuration, logger);
26
46
  (0, ui5_config_1.replaceEnvVariables)(config);
27
47
  // The calling client can use either the projectNamespace or projectName when creating the workspace, needs to match when creating the archive.
28
48
  const archive = await (0, archive_1.createUi5Archive)(logger, workspace, options.projectNamespace ?? options.projectName, config.exclude);
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%3Adeploy-tooling"
11
11
  },
12
- "version": "0.18.10",
12
+ "version": "0.18.11",
13
13
  "license": "Apache-2.0",
14
14
  "author": "@SAP/ux-tools-team",
15
15
  "main": "dist/index.js",
@@ -33,9 +33,9 @@
33
33
  "adm-zip": "0.5.16",
34
34
  "chalk": "4.1.2",
35
35
  "@sap-ux/axios-extension": "1.25.28",
36
- "@sap-ux/btp-utils": "1.1.12",
37
36
  "@sap-ux/inquirer-common": "0.11.33",
38
37
  "@sap-ux/logger": "0.8.4",
38
+ "@sap-ux/btp-utils": "1.1.12",
39
39
  "@sap-ux/system-access": "0.7.4",
40
40
  "@sap-ux/ui5-config": "0.30.1",
41
41
  "@sap-ux/project-input-validator": "0.6.74"