@zeesoft/i18n-verify 3.2.9 → 3.3.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.
Files changed (2) hide show
  1. package/dist/executor.mjs +15 -3
  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}
@@ -6610,7 +6622,7 @@ class Resource {
6610
6622
  const bundle = {};
6611
6623
  if (Config.getOptions()?.l10nResourcePath) {
6612
6624
  const resourcePath = joinPaths(
6613
- process.cwd(),
6625
+ Config.getOptions()?.isSelfManagedRun ? "" : process.cwd(),
6614
6626
  Config.getOptions()?.l10nResourcePath
6615
6627
  );
6616
6628
  if (fileExists(resourcePath)) {
@@ -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 = () => process.env.I18N_RC_CONFIG_PATH ? process.env.I18N_RC_CONFIG_PATH : joinPaths(process.cwd(), CONFIG_FILE_NAME);
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeesoft/i18n-verify",
3
- "version": "3.2.9",
3
+ "version": "3.3.1",
4
4
  "description": "Library to perform I18n verification on Nightwatch, WebdriverIO or Selenium framework projects",
5
5
  "main": "dist/index.mjs",
6
6
  "module": "dist/index.mjs",