@sap-ux/adp-tooling 0.12.3 → 0.12.5

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.
@@ -6,7 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.promptTarget = exports.promptGeneratorInput = void 0;
7
7
  const prompts_1 = __importDefault(require("prompts"));
8
8
  const system_access_1 = require("@sap-ux/system-access");
9
+ const uuid_1 = require("uuid");
9
10
  const helper_1 = require("./helper");
11
+ const project_utils_1 = require("../writer/project-utils");
10
12
  /**
11
13
  * Prompt the user for the required properties for an adaptation project.
12
14
  *
@@ -160,10 +162,15 @@ async function fetchSystemInformation(target, ignoreCertErrors, logger) {
160
162
  logger.info('Fetching system information...');
161
163
  const ato = await provider.getAtoInfo();
162
164
  const layer = ato.tenantType === 'SAP' ? 'VENDOR' : 'CUSTOMER_BASE';
165
+ const packageJson = (0, project_utils_1.getPackageJSONInfo)();
163
166
  const customConfig = {
164
167
  adp: {
165
168
  environment: ato.operationsType ?? 'P',
166
- safeMode: true
169
+ support: {
170
+ id: packageJson.name,
171
+ version: packageJson.version,
172
+ toolsId: (0, uuid_1.v4)()
173
+ }
167
174
  }
168
175
  };
169
176
  logger.info(`Target layer: ${layer}`);
package/dist/types.d.ts CHANGED
@@ -10,6 +10,11 @@ export interface DescriptorVariant {
10
10
  namespace: string;
11
11
  content: object[];
12
12
  }
13
+ export interface ToolsSupport {
14
+ id: string;
15
+ version: string;
16
+ toolsId: string;
17
+ }
13
18
  /**
14
19
  * Reduce the options exposed as target configuration.
15
20
  */
@@ -361,8 +366,8 @@ export type DataSource = ManifestNamespace.DataSource & {
361
366
  };
362
367
  export interface CustomConfig {
363
368
  adp: {
364
- safeMode: boolean;
365
369
  environment: OperationsType;
370
+ support: ToolsSupport;
366
371
  };
367
372
  }
368
373
  export interface InboundChangeContentAddInboundId {
@@ -36,8 +36,8 @@ exports.enhanceUI5YamlWithCustomTask = enhanceUI5YamlWithCustomTask;
36
36
  */
37
37
  function enhanceUI5YamlWithCustomConfig(ui5Config, config) {
38
38
  if (config?.adp) {
39
- const { safeMode } = config.adp;
40
- ui5Config.addCustomConfiguration('adp', { safeMode });
39
+ const { support } = config.adp;
40
+ ui5Config.addCustomConfiguration('adp', { support });
41
41
  }
42
42
  }
43
43
  exports.enhanceUI5YamlWithCustomConfig = enhanceUI5YamlWithCustomConfig;
@@ -1,5 +1,15 @@
1
1
  import type { Editor } from 'mem-fs-editor';
2
2
  import type { AdpWriterConfig } from '../types';
3
+ type PackageJSON = {
4
+ name: string;
5
+ version: string;
6
+ };
7
+ /**
8
+ * Retrieves the package name and version from the package.json file located two levels up the directory tree.
9
+ *
10
+ * @returns {PackageJSON} An object containing the `name` and `version` of the package.
11
+ */
12
+ export declare function getPackageJSONInfo(): PackageJSON;
3
13
  /**
4
14
  * Writes a given project template files within a specified folder in the project directory.
5
15
  *
@@ -28,4 +38,5 @@ export declare function writeUI5Yaml(projectPath: string, data: AdpWriterConfig,
28
38
  * @returns {void}
29
39
  */
30
40
  export declare function writeUI5DeployYaml(projectPath: string, data: AdpWriterConfig, fs: Editor): Promise<void>;
41
+ export {};
31
42
  //# sourceMappingURL=project-utils.d.ts.map
@@ -1,9 +1,28 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.writeUI5DeployYaml = exports.writeUI5Yaml = exports.writeTemplateToFolder = void 0;
3
+ exports.writeUI5DeployYaml = exports.writeUI5Yaml = exports.writeTemplateToFolder = exports.getPackageJSONInfo = void 0;
4
4
  const path_1 = require("path");
5
+ const fs_1 = require("fs");
5
6
  const options_1 = require("./options");
6
7
  const ui5_config_1 = require("@sap-ux/ui5-config");
8
+ /**
9
+ * Retrieves the package name and version from the package.json file located two levels up the directory tree.
10
+ *
11
+ * @returns {PackageJSON} An object containing the `name` and `version` of the package.
12
+ */
13
+ function getPackageJSONInfo() {
14
+ const defaultPackage = {
15
+ name: '@sap-ux/adp-tooling',
16
+ version: 'NO_VERSION_FOUND'
17
+ };
18
+ try {
19
+ return JSON.parse((0, fs_1.readFileSync)((0, path_1.join)(__dirname, '../../package.json'), 'utf-8'));
20
+ }
21
+ catch (e) {
22
+ return defaultPackage;
23
+ }
24
+ }
25
+ exports.getPackageJSONInfo = getPackageJSONInfo;
7
26
  /**
8
27
  * Writes a given project template files within a specified folder in the project directory.
9
28
  *
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.3",
12
+ "version": "0.12.5",
13
13
  "license": "Apache-2.0",
14
14
  "author": "@SAP/ux-tools-team",
15
15
  "main": "dist/index.js",
@@ -31,11 +31,12 @@
31
31
  "mem-fs-editor": "9.4.0",
32
32
  "prompts": "2.4.2",
33
33
  "sanitize-filename": "1.6.3",
34
+ "uuid": "10.0.0",
34
35
  "@sap-ux/axios-extension": "1.15.1",
35
36
  "@sap-ux/btp-utils": "0.15.0",
36
37
  "@sap-ux/inquirer-common": "0.4.0",
37
38
  "@sap-ux/logger": "0.6.0",
38
- "@sap-ux/project-access": "1.25.0",
39
+ "@sap-ux/project-access": "1.25.1",
39
40
  "@sap-ux/system-access": "0.5.1",
40
41
  "@sap-ux/ui5-config": "0.23.0"
41
42
  },
@@ -48,6 +49,7 @@
48
49
  "@types/mem-fs-editor": "7.0.1",
49
50
  "@types/prompts": "2.4.4",
50
51
  "@types/supertest": "2.0.12",
52
+ "@types/uuid": "10.0.0",
51
53
  "dotenv": "16.3.1",
52
54
  "express": "4.19.2",
53
55
  "nock": "13.4.0",