@zeesoft/i18n-verify 3.2.1 → 3.2.2

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/genrc.mjs CHANGED
@@ -1,11 +1,21 @@
1
- import { g as t, a, c as d, j as r, b as l, S as i } from "./executor.mjs";
2
- const o = t(), c = a(o);
3
- let s = "";
4
- if (c) {
5
- const n = JSON.parse(c), e = JSON.stringify({
6
- ...n?.dependencies || {},
7
- ...n?.devDependencies || {}
1
+ import { g as getRootProjectMainDir, a as getRootProjectPackageJson, c as checkAndExportConfig, j as joinPaths, b as CONFIG_FILE_NAME, S as SYSTEM_TYPES } from "./executor.mjs";
2
+ const projectDir = getRootProjectMainDir();
3
+ const packageJson = getRootProjectPackageJson(projectDir);
4
+ let type = "";
5
+ if (packageJson) {
6
+ const json = JSON.parse(packageJson);
7
+ const dependencies = JSON.stringify({
8
+ ...json?.dependencies || {},
9
+ ...json?.devDependencies || {}
8
10
  });
9
- e.includes('"nightwatch"') ? s = i.NIGHT_WATCH : e.includes('"cypress"') ? s = i.CYPRESS : e.includes('"selenium-webdriver"') ? s = i.SELENIUMJS : (e.includes('"@wdio"') || e.includes("@wdio")) && (s = i.WEB_DRIVER_IO);
11
+ if (dependencies.includes('"nightwatch"')) {
12
+ type = SYSTEM_TYPES.NIGHT_WATCH;
13
+ } else if (dependencies.includes('"cypress"')) {
14
+ type = SYSTEM_TYPES.CYPRESS;
15
+ } else if (dependencies.includes('"selenium-webdriver"')) {
16
+ type = SYSTEM_TYPES.SELENIUMJS;
17
+ } else if (dependencies.includes('"@wdio"') || dependencies.includes("@wdio")) {
18
+ type = SYSTEM_TYPES.WEB_DRIVER_IO;
19
+ }
10
20
  }
11
- d(r(o, l), s);
21
+ checkAndExportConfig(joinPaths(projectDir, CONFIG_FILE_NAME), type);
package/dist/index.mjs CHANGED
@@ -1,33 +1,46 @@
1
- import { C as e, L as i, S as g, l as r, R as o, E as l } from "./executor.mjs";
2
- const f = i, m = g, E = (t) => {
3
- e.setDriver(t), r();
4
- }, L = (t) => {
5
- e.setLocale(t), e.setIsLoaded(!1), r();
6
- }, p = () => {
7
- o.generateAsciiTable(), o.generateHtml();
8
- }, x = () => e.getLocale(), d = async ({
9
- verificationArea: t,
10
- staticLocators: a,
11
- useSmartSelector: n,
12
- description: c
1
+ import { C as Config, L as Logger, S as SYSTEM_TYPES, l as loadDependencies, R as Reports, E as Executor } from "./executor.mjs";
2
+ const logger = Logger;
3
+ const systems = SYSTEM_TYPES;
4
+ const setRuntime = (driver) => {
5
+ Config.setDriver(driver);
6
+ loadDependencies();
7
+ };
8
+ const setLocale = (locale) => {
9
+ Config.setLocale(locale);
10
+ Config.setIsLoaded(false);
11
+ loadDependencies();
12
+ };
13
+ const genReportTable = () => {
14
+ Reports.generateAsciiTable();
15
+ Reports.generateHtml();
16
+ };
17
+ const getLocale = () => {
18
+ return Config.getLocale();
19
+ };
20
+ const verify = async ({
21
+ verificationArea,
22
+ staticLocators,
23
+ useSmartSelector,
24
+ description
13
25
  }) => {
14
- const s = e.getExecutor();
15
- if (!s || !(s instanceof l))
26
+ const executor = Config.getExecutor();
27
+ if (!executor || !(executor instanceof Executor)) {
16
28
  throw new Error("Executor is missing, make sure to set configuration");
17
- await s.start({
18
- verificationArea: t,
19
- staticLocators: a,
20
- useSmartSelector: n,
21
- description: c
29
+ }
30
+ await executor.start({
31
+ verificationArea,
32
+ staticLocators,
33
+ useSmartSelector,
34
+ description
22
35
  });
23
36
  };
24
- e.init();
37
+ Config.init();
25
38
  export {
26
- p as genReportTable,
27
- x as getLocale,
28
- f as logger,
29
- L as setLocale,
30
- E as setRuntime,
31
- m as systems,
32
- d as verify
39
+ genReportTable,
40
+ getLocale,
41
+ logger,
42
+ setLocale,
43
+ setRuntime,
44
+ systems,
45
+ verify
33
46
  };
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@zeesoft/i18n-verify",
3
- "version": "3.2.1",
3
+ "version": "3.2.2",
4
4
  "description": "Library to perform I18n verification on Nightwatch, WebdriverIO or Selenium framework projects",
5
- "main": "dist/index.cjs",
5
+ "main": "dist/index.mjs",
6
6
  "module": "dist/index.mjs",
7
7
  "type": "module",
8
8
  "exports": {
9
9
  ".": {
10
10
  "import": "./dist/index.mjs",
11
- "require": "./dist/index.cjs"
11
+ "require": "./dist/index.mjs"
12
12
  },
13
13
  "./genrc": {
14
14
  "import": "./dist/genrc.mjs",
15
- "require": "./dist/genrc.cjs"
15
+ "require": "./dist/genrc.mjs"
16
16
  }
17
17
  },
18
18
  "scripts": {
@@ -58,12 +58,14 @@
58
58
  "luxon": "^3.4.4"
59
59
  },
60
60
  "devDependencies": {
61
+ "@rollup/plugin-commonjs": "^28.0.6",
62
+ "@rollup/plugin-json": "^6.1.0",
61
63
  "@types/nightwatch": "^2.3.31",
62
64
  "@types/node": "^22.10.1",
63
65
  "@types/selenium-webdriver": "^4.1.26",
64
66
  "@wdio/types": "^9.0.8",
65
- "vite": "^5.4.8",
66
- "rimraf": "^6.0.1"
67
+ "rimraf": "^6.0.1",
68
+ "vite": "^5.4.8"
67
69
  },
68
70
  "repository": {
69
71
  "type": "git",
package/postinstall.js CHANGED
@@ -25,4 +25,25 @@ projects automation framework. Please modify it as needed.
25
25
  Documentation: https://www.npmjs.com/package/@zeesoft/i18n-verify
26
26
  Gitlab: https://gitlab.com/zeesoft/qa
27
27
  ===============================================================================`);
28
+
29
+ // fix TLA issue in eld/languageDetector.js package
30
+ const fs = await moduleLoader('fs');
31
+ const path = await moduleLoader('path');
32
+ const filePath = path.join(
33
+ process.cwd(),
34
+ '..',
35
+ '..',
36
+ 'eld',
37
+ 'src',
38
+ 'languageDetector.js'
39
+ );
40
+
41
+ if (fs.existsSync(filePath)) {
42
+ const content = fs.readFileSync(filePath, 'utf8');
43
+ const updatedContent = content.replace(
44
+ /await loadNgrams\('ngramsM60\.js'\)/m,
45
+ "(async () => { await loadNgrams('ngramsM60.js'); })()"
46
+ );
47
+ fs.writeFileSync(filePath, updatedContent, 'utf8');
48
+ }
28
49
  })();