apex-code-coverage-transformer 1.6.0 → 1.6.1
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.
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
/* eslint-disable no-await-in-loop */
|
|
3
3
|
import * as fs from 'node:fs';
|
|
4
4
|
import * as path from 'node:path';
|
|
5
|
-
import { findSubFolder } from './findSubFolder.js';
|
|
6
5
|
import { getPackageDirectories } from './getPackageDirectories.js';
|
|
7
6
|
export async function findFilePath(fileName, dxConfigFile) {
|
|
8
7
|
const packageDirectories = await getPackageDirectories(dxConfigFile);
|
|
@@ -15,49 +14,40 @@ export async function findFilePath(fileName, dxConfigFile) {
|
|
|
15
14
|
}
|
|
16
15
|
return filePath;
|
|
17
16
|
}
|
|
18
|
-
async function
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
absoluteClassPath = path.resolve(relativeClassPath, fileName);
|
|
29
|
-
if (fs.existsSync(absoluteClassPath)) {
|
|
30
|
-
return path.join(relativeClassPath, fileName);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
else if (fileExtension === 'trigger' && relativeTriggerPath !== undefined) {
|
|
34
|
-
absoluteTriggerPath = path.resolve(relativeTriggerPath, fileName);
|
|
35
|
-
if (fs.existsSync(absoluteTriggerPath)) {
|
|
36
|
-
return path.join(relativeTriggerPath, fileName);
|
|
17
|
+
async function searchRecursively(fileName, dxDirectory) {
|
|
18
|
+
const files = await fs.promises.readdir(dxDirectory);
|
|
19
|
+
for (const file of files) {
|
|
20
|
+
const filePath = path.join(dxDirectory, file);
|
|
21
|
+
const stats = await fs.promises.stat(filePath);
|
|
22
|
+
if (stats.isDirectory()) {
|
|
23
|
+
const result = await searchRecursively(fileName, filePath);
|
|
24
|
+
if (result) {
|
|
25
|
+
return result;
|
|
26
|
+
}
|
|
37
27
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
absoluteFlowPath = path.resolve(relativeFlowPath, fileName);
|
|
41
|
-
if (fs.existsSync(absoluteFlowPath)) {
|
|
42
|
-
return path.join(relativeFlowPath, fileName);
|
|
28
|
+
else if (file === fileName) {
|
|
29
|
+
return filePath;
|
|
43
30
|
}
|
|
44
31
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return relativeClassPath;
|
|
54
|
-
}
|
|
55
|
-
else if (fs.existsSync(absoluteTriggerPath)) {
|
|
56
|
-
return relativeTriggerPath;
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
async function findFilePathinDirectory(fileName, dxDirectory) {
|
|
35
|
+
const fileExtension = fileName.split('.').slice(1).join('.');
|
|
36
|
+
let relativeFilePath;
|
|
37
|
+
if (fileExtension) {
|
|
38
|
+
// If file extension is defined, search recursively with that extension
|
|
39
|
+
relativeFilePath = await searchRecursively(fileName, dxDirectory);
|
|
57
40
|
}
|
|
58
|
-
else
|
|
59
|
-
|
|
41
|
+
else {
|
|
42
|
+
// If file extension is not defined, test each extension option
|
|
43
|
+
const fileExts = ['cls', 'trigger', 'flow-meta.xml'];
|
|
44
|
+
for (const ext of fileExts) {
|
|
45
|
+
relativeFilePath = await searchRecursively(`${fileName}.${ext}`, dxDirectory);
|
|
46
|
+
if (relativeFilePath !== undefined) {
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
60
50
|
}
|
|
61
|
-
return
|
|
51
|
+
return relativeFilePath;
|
|
62
52
|
}
|
|
63
53
|
//# sourceMappingURL=findFilePath.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findFilePath.js","sourceRoot":"","sources":["../../src/helpers/findFilePath.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,qCAAqC;AAErC,OA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I,MAAM,EAAE,CAAC;gBACX,OAAO,MAAM,CAAC;YAChB,CAAC;QACH,CAAC;aAAM,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC7B,OAAO,QAAQ,CAAC;QAClB,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,KAAK,UAAU,uBAAuB,CAAC,QAAgB,EAAE,WAAmB;IAC1E,MAAM,aAAa,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC7D,IAAI,gBAAoC,CAAC;IAEzC,IAAI,aAAa,EAAE,CAAC;QAClB,uEAAuE;QACvE,gBAAgB,GAAG,MAAM,iBAAiB,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IACpE,CAAC;SAAM,CAAC;QACN,+DAA+D;QAC/D,MAAM,QAAQ,GAAa,CAAC,KAAK,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC;QAC/D,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;YAC3B,gBAAgB,GAAG,MAAM,iBAAiB,CAAC,GAAG,QAAQ,IAAI,GAAG,EAAE,EAAE,WAAW,CAAC,CAAC;YAC9E,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;gBACnC,MAAM;YACR,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,gBAAgB,CAAC;AAC1B,CAAC"}
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function findSubFolder(parentDirectory: string, subFolderName: string): Promise<string>;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
/* eslint-disable no-await-in-loop */
|
|
3
|
-
import * as path from 'node:path';
|
|
4
|
-
import * as promises from 'node:fs/promises';
|
|
5
|
-
export async function findSubFolder(parentDirectory, subFolderName) {
|
|
6
|
-
const files = await promises.readdir(parentDirectory);
|
|
7
|
-
// Check if current directory contains the sub-folder
|
|
8
|
-
if (files.includes(subFolderName)) {
|
|
9
|
-
return path.join(parentDirectory, subFolderName);
|
|
10
|
-
}
|
|
11
|
-
// Recursively search sub-directories
|
|
12
|
-
for (const file of files) {
|
|
13
|
-
const filePath = path.join(parentDirectory, file);
|
|
14
|
-
const stats = await promises.stat(filePath);
|
|
15
|
-
if (stats.isDirectory()) {
|
|
16
|
-
const subFolderPath = await findSubFolder(filePath, subFolderName);
|
|
17
|
-
if (subFolderPath) {
|
|
18
|
-
return subFolderPath;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
// must be a string for the file-path check
|
|
23
|
-
return 'undefined';
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=findSubFolder.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"findSubFolder.js","sourceRoot":"","sources":["../../src/helpers/findSubFolder.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,qCAAqC;AAErC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAE7C,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,eAAuB,EAAE,aAAqB;IAChF,MAAM,KAAK,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IAEtD,qDAAqD;IACrD,IAAI,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC;QAClC,OAAO,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC;IACnD,CAAC;IAED,qCAAqC;IACrC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;QAClD,MAAM,KAAK,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC5C,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;YACxB,MAAM,aAAa,GAAG,MAAM,aAAa,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;YACnE,IAAI,aAAa,EAAE,CAAC;gBAClB,OAAO,aAAa,CAAC;YACvB,CAAC;QACH,CAAC;IACH,CAAC;IAED,2CAA2C;IAC3C,OAAO,WAAW,CAAC;AACrB,CAAC"}
|