@zeesoft/i18n-verify 3.2.9 → 3.3.0
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/dist/executor.mjs +14 -2
- package/package.json +1 -1
package/dist/executor.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import fs, { existsSync, statSync, readFileSync, writeFileSync, readdirSync, mkdirSync, appendFileSync, copyFileSync } from "fs";
|
|
2
|
-
import path, { join, dirname, extname } from "path";
|
|
2
|
+
import path, { join, dirname, resolve, extname } from "path";
|
|
3
|
+
import { fileURLToPath } from "url";
|
|
3
4
|
import { Table } from "console-table-printer";
|
|
4
5
|
import CDP from "chrome-remote-interface";
|
|
5
6
|
import Globalize from "globalize";
|
|
@@ -329,6 +330,17 @@ const imageToBase64 = (imagePath) => {
|
|
|
329
330
|
const imgInput = readFileSync(imagePath);
|
|
330
331
|
return imgInput.toString("base64");
|
|
331
332
|
};
|
|
333
|
+
const findFileUpwards = (filename, startUrl = import.meta.url) => {
|
|
334
|
+
let dir = dirname(fileURLToPath(startUrl));
|
|
335
|
+
while (dir !== "/" && dir !== "." && dir !== "") {
|
|
336
|
+
const filePath = resolve(dir, filename);
|
|
337
|
+
if (existsSync(filePath)) {
|
|
338
|
+
return filePath;
|
|
339
|
+
}
|
|
340
|
+
dir = dirname(dir);
|
|
341
|
+
}
|
|
342
|
+
return null;
|
|
343
|
+
};
|
|
332
344
|
class ReportData {
|
|
333
345
|
/**
|
|
334
346
|
* @type {String}
|
|
@@ -6685,7 +6697,7 @@ const getRootProjectMainDir = () => {
|
|
|
6685
6697
|
};
|
|
6686
6698
|
const getRootProjectPackageJson = (rootProjectPath = getRootProjectMainDir()) => getFileContent(joinPaths(rootProjectPath, "package.json"));
|
|
6687
6699
|
const getRootProjectName = () => getRootProjectPackageJson()?.match(/"name": "([^"]+)",/)?.[1] || "";
|
|
6688
|
-
const getConfigFilePath = () =>
|
|
6700
|
+
const getConfigFilePath = () => findFileUpwards(CONFIG_FILE_NAME, import.meta.url);
|
|
6689
6701
|
const getConfigTemplate = (type = "") => `{
|
|
6690
6702
|
"appName": "${getRootProjectName()}",
|
|
6691
6703
|
"type": "${type}", // set automation framework type ${arr2Txt(
|
package/package.json
CHANGED