@sap-ux/telemetry 0.6.12 → 0.6.14
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.
|
@@ -12,12 +12,4 @@ export declare function processToolsSuiteTelemetry(telemetryHelperProperties: Re
|
|
|
12
12
|
* @returns Common properties
|
|
13
13
|
*/
|
|
14
14
|
export declare function getCommonProperties(): Promise<CommonFioriProjectProperties>;
|
|
15
|
-
/**
|
|
16
|
-
* Spawn a command to find out node.js version used for the runtime.
|
|
17
|
-
*
|
|
18
|
-
* @param command command name
|
|
19
|
-
* @param commandArgs command arguments
|
|
20
|
-
* @returns Node.js version
|
|
21
|
-
*/
|
|
22
|
-
export declare function spawnCommand(command: string, commandArgs: string[]): Promise<string>;
|
|
23
15
|
//# sourceMappingURL=data-processor.d.ts.map
|
|
@@ -5,30 +5,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.processToolsSuiteTelemetry = processToolsSuiteTelemetry;
|
|
7
7
|
exports.getCommonProperties = getCommonProperties;
|
|
8
|
-
exports.spawnCommand = spawnCommand;
|
|
9
8
|
const btp_utils_1 = require("@sap-ux/btp-utils");
|
|
9
|
+
const nodejs_utils_1 = require("@sap-ux/nodejs-utils");
|
|
10
10
|
const ui5_config_1 = require("@sap-ux/ui5-config");
|
|
11
11
|
const axios_1 = __importDefault(require("axios"));
|
|
12
12
|
const fs_1 = __importDefault(require("fs"));
|
|
13
13
|
const path_1 = __importDefault(require("path"));
|
|
14
14
|
const yaml_1 = __importDefault(require("yaml"));
|
|
15
|
-
/**
|
|
16
|
-
* Import with Tree shaking behaviour '@sap/ux-project-access/dist/project/utils'
|
|
17
|
-
* performance optimization to remove unreachable code automatically from esbuild.
|
|
18
|
-
* Esbuild will only bundle parts of your packages that you actually use
|
|
19
|
-
*
|
|
20
|
-
* Note: Without Tree shaking import '@sap/ux-project-access'
|
|
21
|
-
* packages consuming telemetry need to add dependencies manually (for ex: sap/cds)
|
|
22
|
-
* Further, size of generated .vsix will be increased by esbuild
|
|
23
|
-
*/
|
|
24
|
-
const info_1 = require("@sap-ux/project-access/dist/project/info");
|
|
25
|
-
const search_1 = require("@sap-ux/project-access/dist/project/search");
|
|
26
|
-
const cap_1 = require("@sap-ux/project-access/dist/project/cap");
|
|
27
|
-
const types_1 = require("./types");
|
|
28
|
-
const child_process_1 = require("child_process");
|
|
29
|
-
const os_1 = __importDefault(require("os"));
|
|
30
|
-
const config_state_1 = require("./config-state");
|
|
31
15
|
const project_access_1 = require("@sap-ux/project-access");
|
|
16
|
+
const config_state_1 = require("./config-state");
|
|
17
|
+
const types_1 = require("./types");
|
|
32
18
|
/**
|
|
33
19
|
* Collect commone properties that needs to be added to telemetry event.
|
|
34
20
|
*
|
|
@@ -56,7 +42,7 @@ async function getCommonProperties() {
|
|
|
56
42
|
commonProperties[types_1.CommonProperties.InternlVsExternal] = getInternalVsExternal();
|
|
57
43
|
commonProperties[types_1.CommonProperties.InternlVsExternalBackwardCompatible] =
|
|
58
44
|
commonProperties[types_1.CommonProperties.InternlVsExternal];
|
|
59
|
-
commonProperties[types_1.CommonProperties.NodeVersion] =
|
|
45
|
+
commonProperties[types_1.CommonProperties.NodeVersion] = await getOSNodeVersion();
|
|
60
46
|
return commonProperties;
|
|
61
47
|
}
|
|
62
48
|
/**
|
|
@@ -98,14 +84,14 @@ async function getAppProperties(appPath) {
|
|
|
98
84
|
}
|
|
99
85
|
const templateType = await getTemplateType(appPath);
|
|
100
86
|
const deployTarget = await getDeployTarget(appPath);
|
|
101
|
-
const applicationType = await (0,
|
|
87
|
+
const applicationType = await (0, project_access_1.getAppType)(appPath);
|
|
102
88
|
let odataSource = await getODataSource(appPath);
|
|
103
89
|
// Correct logic in getAppType() implementation, if it's reuse lib type, odata source should be unknown
|
|
104
90
|
if (applicationType === 'Fiori Reuse') {
|
|
105
91
|
odataSource = types_1.ODataSource.UNKNOWN;
|
|
106
92
|
}
|
|
107
93
|
const sourceTemplate = await getSourceTemplate(appPath);
|
|
108
|
-
const appProgrammingLanguage = await (0,
|
|
94
|
+
const appProgrammingLanguage = await (0, project_access_1.getAppProgrammingLanguage)(appPath);
|
|
109
95
|
const output = {};
|
|
110
96
|
output[types_1.CommonProperties.TemplateType] = templateType;
|
|
111
97
|
output[types_1.CommonProperties.DeployTargetType] = deployTarget;
|
|
@@ -167,7 +153,7 @@ async function getODataSource(appPath) {
|
|
|
167
153
|
// is ABAP.
|
|
168
154
|
let projectRoot;
|
|
169
155
|
try {
|
|
170
|
-
projectRoot = await (0,
|
|
156
|
+
projectRoot = await (0, project_access_1.findProjectRoot)(appPath);
|
|
171
157
|
}
|
|
172
158
|
catch {
|
|
173
159
|
// No project root can be found
|
|
@@ -178,7 +164,7 @@ async function getODataSource(appPath) {
|
|
|
178
164
|
if (!projectRoot) {
|
|
179
165
|
try {
|
|
180
166
|
const appParentFolder = path_1.default.dirname(appPath);
|
|
181
|
-
projectRoot = await (0,
|
|
167
|
+
projectRoot = await (0, project_access_1.findProjectRoot)(appParentFolder, false);
|
|
182
168
|
}
|
|
183
169
|
catch (e) {
|
|
184
170
|
// No project root can be found at parent folder.
|
|
@@ -192,13 +178,13 @@ async function getODataSource(appPath) {
|
|
|
192
178
|
if (!projectRoot) {
|
|
193
179
|
const directParentFolder = path_1.default.dirname(appPath);
|
|
194
180
|
const twoLevelUpParentFolder = path_1.default.dirname(directParentFolder);
|
|
195
|
-
isCapJavaWithoutPackageJson = await (0,
|
|
181
|
+
isCapJavaWithoutPackageJson = await (0, project_access_1.isCapJavaProject)(twoLevelUpParentFolder);
|
|
196
182
|
projectRoot = isCapJavaWithoutPackageJson ? twoLevelUpParentFolder : appPath;
|
|
197
183
|
}
|
|
198
184
|
if (isCapJavaWithoutPackageJson) {
|
|
199
185
|
return types_1.ODataSource.CAPJava;
|
|
200
186
|
}
|
|
201
|
-
const projectType = await (0,
|
|
187
|
+
const projectType = await (0, project_access_1.getProjectType)(projectRoot);
|
|
202
188
|
return getProjectTypeForTelemetry(projectType);
|
|
203
189
|
}
|
|
204
190
|
catch (e) {
|
|
@@ -306,47 +292,17 @@ function populateSourceTemplate(sourceTemplate) {
|
|
|
306
292
|
};
|
|
307
293
|
}
|
|
308
294
|
/**
|
|
309
|
-
* Get node.js runtime version.
|
|
295
|
+
* Get node.js runtime version installed in the operating system.
|
|
310
296
|
*
|
|
311
|
-
* @returns Node.js version
|
|
297
|
+
* @returns Node.js version or 'unknown' if it cannot be determined.
|
|
312
298
|
*/
|
|
313
|
-
async function
|
|
299
|
+
async function getOSNodeVersion() {
|
|
314
300
|
try {
|
|
315
|
-
const
|
|
316
|
-
return
|
|
301
|
+
const nodeVer = (await new nodejs_utils_1.CommandRunner().run('node', ['-v'])) ?? 'unknown';
|
|
302
|
+
return nodeVer.replaceAll(/(?:^v)|([\r\n]{1,100})/g, '');
|
|
317
303
|
}
|
|
318
304
|
catch {
|
|
319
|
-
return
|
|
305
|
+
return 'unknown';
|
|
320
306
|
}
|
|
321
307
|
}
|
|
322
|
-
/**
|
|
323
|
-
* Spawn a command to find out node.js version used for the runtime.
|
|
324
|
-
*
|
|
325
|
-
* @param command command name
|
|
326
|
-
* @param commandArgs command arguments
|
|
327
|
-
* @returns Node.js version
|
|
328
|
-
*/
|
|
329
|
-
function spawnCommand(command, commandArgs) {
|
|
330
|
-
const spawnOptions = process.platform.startsWith('win')
|
|
331
|
-
? { windowsVerbatimArguments: true, shell: true, cwd: os_1.default.homedir() }
|
|
332
|
-
: { cwd: os_1.default.homedir() };
|
|
333
|
-
return new Promise((resolve, reject) => {
|
|
334
|
-
let output = '';
|
|
335
|
-
const spawnProcess = (0, child_process_1.spawn)(command, commandArgs, spawnOptions);
|
|
336
|
-
spawnProcess.stdout.on('data', (data) => {
|
|
337
|
-
const newData = data.toString();
|
|
338
|
-
output += newData;
|
|
339
|
-
});
|
|
340
|
-
spawnProcess.stderr.on('data', (data) => {
|
|
341
|
-
const newData = data.toString();
|
|
342
|
-
output += newData;
|
|
343
|
-
});
|
|
344
|
-
spawnProcess.on('exit', () => {
|
|
345
|
-
resolve(output);
|
|
346
|
-
});
|
|
347
|
-
spawnProcess.on('error', (error) => {
|
|
348
|
-
reject(error);
|
|
349
|
-
});
|
|
350
|
-
});
|
|
351
|
-
}
|
|
352
308
|
//# sourceMappingURL=data-processor.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ProjectInfo, TelemetryMeasurements, TelemetryProperties } from '../base/types';
|
|
2
|
-
import type { AppType } from '@sap-ux/project-access
|
|
2
|
+
import type { AppType } from '@sap-ux/project-access';
|
|
3
3
|
export type TelemetryHelperProperties = {
|
|
4
4
|
appPath: string;
|
|
5
5
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap-ux/telemetry",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.14",
|
|
4
4
|
"description": "Library for sending usage telemetry data",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -19,10 +19,11 @@
|
|
|
19
19
|
"performance-now": "2.1.0",
|
|
20
20
|
"yaml": "2.3.3",
|
|
21
21
|
"@sap-ux/store": "1.1.2",
|
|
22
|
-
"@sap-ux/project-access": "1.30.
|
|
22
|
+
"@sap-ux/project-access": "1.30.10",
|
|
23
23
|
"@sap-ux/btp-utils": "1.1.0",
|
|
24
|
-
"@sap-ux/ui5-config": "0.29.
|
|
25
|
-
"@sap-ux/logger": "0.7.0"
|
|
24
|
+
"@sap-ux/ui5-config": "0.29.1",
|
|
25
|
+
"@sap-ux/logger": "0.7.0",
|
|
26
|
+
"@sap-ux/nodejs-utils": "0.2.2"
|
|
26
27
|
},
|
|
27
28
|
"devDependencies": {
|
|
28
29
|
"jest-extended": "6.0.0",
|