@sap-ux/telemetry 0.6.25 → 0.6.27
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.
|
@@ -9,8 +9,8 @@ const btp_utils_1 = require("@sap-ux/btp-utils");
|
|
|
9
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
|
-
const
|
|
13
|
-
const
|
|
12
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
13
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
14
14
|
const yaml_1 = __importDefault(require("yaml"));
|
|
15
15
|
const project_access_1 = require("@sap-ux/project-access");
|
|
16
16
|
const config_state_1 = require("./config-state");
|
|
@@ -110,18 +110,18 @@ async function getAppProperties(appPath) {
|
|
|
110
110
|
* @returns Template type used in the Fiori app
|
|
111
111
|
*/
|
|
112
112
|
async function getTemplateType(appPath) {
|
|
113
|
-
const readmeFilePath =
|
|
114
|
-
const appGenInfoPath =
|
|
113
|
+
const readmeFilePath = node_path_1.default.join(appPath, 'README.md');
|
|
114
|
+
const appGenInfoPath = node_path_1.default.join(appPath, '.appGenInfo.json');
|
|
115
115
|
// N.B.: Keep this order i.e .appGenInfo.json file is read first, then README.md.
|
|
116
|
-
if (
|
|
117
|
-
const appGenInfo = await
|
|
116
|
+
if (node_fs_1.default.existsSync(appGenInfoPath)) {
|
|
117
|
+
const appGenInfo = await node_fs_1.default.promises.readFile(appGenInfoPath, 'utf-8');
|
|
118
118
|
const appGenInfoParsed = JSON.parse(appGenInfo);
|
|
119
119
|
if (appGenInfoParsed?.generationParameters?.template) {
|
|
120
120
|
return appGenInfoParsed.generationParameters.template.trim();
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
-
if (
|
|
124
|
-
const readmeContent = await
|
|
123
|
+
if (node_fs_1.default.existsSync(readmeFilePath)) {
|
|
124
|
+
const readmeContent = await node_fs_1.default.promises.readFile(readmeFilePath, 'utf-8');
|
|
125
125
|
if (readmeContent) {
|
|
126
126
|
let templateType = '';
|
|
127
127
|
const lines = readmeContent.split(/\r?\n/);
|
|
@@ -163,7 +163,7 @@ async function getODataSource(appPath) {
|
|
|
163
163
|
// use appPath as project root.
|
|
164
164
|
if (!projectRoot) {
|
|
165
165
|
try {
|
|
166
|
-
const appParentFolder =
|
|
166
|
+
const appParentFolder = node_path_1.default.dirname(appPath);
|
|
167
167
|
projectRoot = await (0, project_access_1.findProjectRoot)(appParentFolder, false);
|
|
168
168
|
}
|
|
169
169
|
catch (e) {
|
|
@@ -176,8 +176,8 @@ async function getODataSource(appPath) {
|
|
|
176
176
|
// a better solution
|
|
177
177
|
let isCapJavaWithoutPackageJson = false;
|
|
178
178
|
if (!projectRoot) {
|
|
179
|
-
const directParentFolder =
|
|
180
|
-
const twoLevelUpParentFolder =
|
|
179
|
+
const directParentFolder = node_path_1.default.dirname(appPath);
|
|
180
|
+
const twoLevelUpParentFolder = node_path_1.default.dirname(directParentFolder);
|
|
181
181
|
isCapJavaWithoutPackageJson = await (0, project_access_1.isCapJavaProject)(twoLevelUpParentFolder);
|
|
182
182
|
projectRoot = isCapJavaWithoutPackageJson ? twoLevelUpParentFolder : appPath;
|
|
183
183
|
}
|
|
@@ -219,10 +219,10 @@ function getProjectTypeForTelemetry(projectType) {
|
|
|
219
219
|
*/
|
|
220
220
|
async function getDeployTarget(appPath) {
|
|
221
221
|
let deployTarget = types_1.DeployTarget.NO_DEPLOY_CONFIG;
|
|
222
|
-
const deployConfigPath =
|
|
222
|
+
const deployConfigPath = node_path_1.default.join(appPath, 'ui5-deploy.yaml');
|
|
223
223
|
try {
|
|
224
|
-
await
|
|
225
|
-
const deployConfigContent = await
|
|
224
|
+
await node_fs_1.default.promises.access(deployConfigPath);
|
|
225
|
+
const deployConfigContent = await node_fs_1.default.promises.readFile(deployConfigPath, 'utf-8');
|
|
226
226
|
const deployConfig = yaml_1.default.parse(deployConfigContent);
|
|
227
227
|
const customTasks = deployConfig?.builder?.customTasks;
|
|
228
228
|
if (customTasks) {
|
|
@@ -256,18 +256,18 @@ function getInternalVsExternal() {
|
|
|
256
256
|
async function getSourceTemplate(appPath) {
|
|
257
257
|
const webappPath = await (0, project_access_1.getWebappPath)(appPath);
|
|
258
258
|
const paths = {
|
|
259
|
-
manifest:
|
|
260
|
-
appdescr:
|
|
261
|
-
ui5Yaml:
|
|
259
|
+
manifest: node_path_1.default.join(webappPath, 'manifest.json'),
|
|
260
|
+
appdescr: node_path_1.default.join(webappPath, 'manifest.appdescr_variant'),
|
|
261
|
+
ui5Yaml: node_path_1.default.join(appPath, 'ui5.yaml')
|
|
262
262
|
};
|
|
263
263
|
try {
|
|
264
|
-
if (
|
|
265
|
-
const manifestStr = await
|
|
264
|
+
if (node_fs_1.default.existsSync(paths.manifest)) {
|
|
265
|
+
const manifestStr = await node_fs_1.default.promises.readFile(paths.manifest, 'utf-8');
|
|
266
266
|
const manifest = JSON.parse(manifestStr);
|
|
267
267
|
return populateSourceTemplate(manifest['sap.app']?.sourceTemplate ?? {});
|
|
268
268
|
}
|
|
269
|
-
if (
|
|
270
|
-
const baseUi5ConfigContent = await
|
|
269
|
+
if (node_fs_1.default.existsSync(paths.appdescr) && node_fs_1.default.existsSync(paths.ui5Yaml)) {
|
|
270
|
+
const baseUi5ConfigContent = await node_fs_1.default.promises.readFile(paths.ui5Yaml, 'utf-8');
|
|
271
271
|
const ui5Config = await ui5_config_1.UI5Config.newInstance(baseUi5ConfigContent);
|
|
272
272
|
const adp = ui5Config.getCustomConfiguration('adp');
|
|
273
273
|
return populateSourceTemplate(adp?.support ?? {});
|
|
@@ -9,9 +9,9 @@ exports.getTelemetrySetting = getTelemetrySetting;
|
|
|
9
9
|
const reporting_1 = require("../base/utils/reporting");
|
|
10
10
|
const store_1 = require("@sap-ux/store");
|
|
11
11
|
const btp_utils_1 = require("@sap-ux/btp-utils");
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
12
|
+
const node_os_1 = __importDefault(require("node:os"));
|
|
13
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
14
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
15
15
|
const data_processor_1 = require("./data-processor");
|
|
16
16
|
const config_state_1 = require("../base/config-state");
|
|
17
17
|
const config_state_2 = require("./config-state");
|
|
@@ -37,8 +37,8 @@ const definePath = (paths) => {
|
|
|
37
37
|
// no path for unknown platform settings path
|
|
38
38
|
return null;
|
|
39
39
|
}
|
|
40
|
-
const homedir =
|
|
41
|
-
return
|
|
40
|
+
const homedir = node_os_1.default.homedir();
|
|
41
|
+
return node_path_1.default.join(homedir, settingsPath);
|
|
42
42
|
};
|
|
43
43
|
/**
|
|
44
44
|
* Read telemetry settings from file store.
|
|
@@ -65,7 +65,7 @@ async function readEnableTelemetry(storeService) {
|
|
|
65
65
|
// If deprecated vscode setting exists, set central telemetry setting to false if any of vscode setting was false
|
|
66
66
|
let content;
|
|
67
67
|
try {
|
|
68
|
-
content = await
|
|
68
|
+
content = await node_fs_1.default.promises.readFile(deprecatedSettingPath, 'utf-8');
|
|
69
69
|
const deprecatedSetting = JSON.parse(content);
|
|
70
70
|
const propValues = deprecatedExtensionPropKeys.map((propKey) => (deprecatedSetting[propKey] ?? true));
|
|
71
71
|
const deprecatedEnableTelemetrySetting = propValues.reduce((prevValue, currentValue) => prevValue && currentValue, true);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap-ux/telemetry",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.27",
|
|
4
4
|
"description": "Library for sending usage telemetry data",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,12 +18,12 @@
|
|
|
18
18
|
"axios": "1.12.2",
|
|
19
19
|
"performance-now": "2.1.0",
|
|
20
20
|
"yaml": "2.3.3",
|
|
21
|
-
"@sap-ux/store": "1.1.
|
|
22
|
-
"@sap-ux/project-access": "1.32.
|
|
23
|
-
"@sap-ux/btp-utils": "1.1.
|
|
24
|
-
"@sap-ux/ui5-config": "0.29.
|
|
21
|
+
"@sap-ux/store": "1.1.5",
|
|
22
|
+
"@sap-ux/project-access": "1.32.3",
|
|
23
|
+
"@sap-ux/btp-utils": "1.1.4",
|
|
24
|
+
"@sap-ux/ui5-config": "0.29.7",
|
|
25
25
|
"@sap-ux/logger": "0.7.0",
|
|
26
|
-
"@sap-ux/nodejs-utils": "0.2.
|
|
26
|
+
"@sap-ux/nodejs-utils": "0.2.7"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"jest-extended": "6.0.0",
|