@mablhq/mabl-cli 1.16.11 → 1.16.16
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.
- package/commands/tests/testsUtil.js +3 -3
- package/execution/index.js +1 -1
- package/mablApi/index.js +1 -1
- package/mablscriptFind/index.js +1 -1
- package/package.json +1 -1
- package/resources/mablFind.js +1 -1
- package/util/resourceUtil.js +21 -6
package/util/resourceUtil.js
CHANGED
|
@@ -22,15 +22,30 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
22
22
|
exports.findNodeModulesDirectory = exports.findDirectory = exports.findResource = void 0;
|
|
23
23
|
const path = __importStar(require("path"));
|
|
24
24
|
const fs = __importStar(require("fs"));
|
|
25
|
-
function findResource(pathInResource) {
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return unpackedPath;
|
|
25
|
+
function findResource(pathInResource, resourcesPathOverride) {
|
|
26
|
+
const pathsToCheck = [];
|
|
27
|
+
if (resourcesPathOverride) {
|
|
28
|
+
pathsToCheck.push(`${resourcesPathOverride}/${pathInResource}`);
|
|
30
29
|
}
|
|
31
|
-
|
|
30
|
+
pathsToCheck.push(`${__dirname}/../../resources/${pathInResource}`);
|
|
31
|
+
pathsToCheck.push(`${__dirname}/../resources/${pathInResource}`);
|
|
32
|
+
const foundPath = pathsToCheck
|
|
33
|
+
.map((p) => path.normalize(path.resolve(p)))
|
|
34
|
+
.find(safeExistSync);
|
|
35
|
+
if (foundPath) {
|
|
36
|
+
return foundPath;
|
|
37
|
+
}
|
|
38
|
+
return path.normalize(pathsToCheck[0]);
|
|
32
39
|
}
|
|
33
40
|
exports.findResource = findResource;
|
|
41
|
+
function safeExistSync(path) {
|
|
42
|
+
try {
|
|
43
|
+
return fs.existsSync(path);
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
34
49
|
function findDirectory(pathFromBase) {
|
|
35
50
|
const unpackedPath = path.normalize(path.resolve(`${__dirname}/../../${pathFromBase}`));
|
|
36
51
|
const packedPath = path.normalize(path.resolve(`${__dirname}/../${pathFromBase}`));
|