@zeesoft/i18n-verify 2.0.1 → 2.1.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/driver/adapters/cypress.js +2 -1
- package/dist/driver/adapters/nightwatch.js +43 -2
- package/dist/driver/baseDriver.js +24 -0
- package/dist/index.js +10 -5
- package/dist/lib/i18n.js +126 -44
- package/dist/{utils → lib}/reports.js +42 -27
- package/dist/lib/validator/string.js +2 -2
- package/dist/template/report.html +1678 -0
- package/dist/utils/cache.js +15 -15
- package/dist/utils/constants.js +8 -5
- package/dist/utils/file.js +8 -4
- package/dist/utils/{2Dgraphic.js → graphic.js} +1 -1
- package/dist/utils/logs.js +30 -11
- package/dist/utils/objects/cacheData.js +14 -33
- package/dist/utils/objects/metaData.js +7 -26
- package/dist/utils/objects/reportData.js +0 -18
- package/dist/utils/objects/statData.js +43 -28
- package/dist/utils/objects/stringData.js +4 -7
- package/dist/utils/reportFactory/base.js +15 -7
- package/dist/utils/reportFactory/html/index.js +13 -9
- package/dist/utils/reportFactory/html/template/body.js +110 -0
- package/dist/utils/reportFactory/html/template/css.js +446 -409
- package/dist/utils/reportFactory/html/template/html.js +15 -112
- package/dist/utils/reportFactory/html/template/javascript/data.js +59 -1
- package/dist/utils/reportFactory/html/template/javascript/global.js +19 -0
- package/dist/utils/reportFactory/html/template/javascript/grid.js +54 -80
- package/dist/utils/reportFactory/html/template/javascript/index.js +7 -7
- package/dist/utils/reportFactory/html/template/javascript/insight.js +226 -201
- package/dist/utils/reportFactory/html/template/javascript/menuBar.js +40 -35
- package/dist/utils/reportFactory/html/template/javascript/overview.js +725 -533
- package/dist/utils/reportFactory/index.js +4 -6
- package/dist/utils/reportFactory/table.js +95 -0
- package/dist/utils/resource.js +10 -6
- package/dist/utils/runtime.js +23 -3
- package/dist/utils/scripts/postinstall.js +3 -2
- package/package.json +8 -3
- package/types/index.d.ts +46 -0
- package/dist/utils/reportsTable.js +0 -71
package/dist/utils/cache.js
CHANGED
|
@@ -5,43 +5,43 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _config = _interopRequireDefault(require("../lib/config.js"));
|
|
8
|
+
var _reports = _interopRequireDefault(require("../lib/reports.js"));
|
|
8
9
|
var _constants = require("./constants.js");
|
|
9
10
|
var _file = require("./file.js");
|
|
10
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
12
|
class Cache {
|
|
13
|
+
/** @type {String} */
|
|
12
14
|
static #cachePath;
|
|
13
|
-
static
|
|
14
|
-
|
|
15
|
-
Cache.#
|
|
15
|
+
static #cacheDirPath;
|
|
16
|
+
static init() {
|
|
17
|
+
Cache.#cacheDirPath = (0, _file.joinPaths)(_reports.default.getReportPath(), _config.default.getLocale());
|
|
18
|
+
Cache.#cachePath = (0, _file.joinPaths)(Cache.#cacheDirPath, _constants.CACHE_FILE_NAME);
|
|
19
|
+
this.#ensureFileExists();
|
|
16
20
|
}
|
|
17
21
|
static exists() {
|
|
18
22
|
return (0, _file.fileExists)(Cache.#cachePath);
|
|
19
23
|
}
|
|
20
24
|
static save(data) {
|
|
21
|
-
(
|
|
22
|
-
|
|
25
|
+
this.#ensureFileExists();
|
|
26
|
+
const source = `!window.rawData && (window.rawData={'${_config.default.getLocale()}':{}});window.rawData['${_config.default.getLocale()}']=${JSON.stringify(data)};`;
|
|
27
|
+
(0, _file.saveToFile)(Cache.#cachePath, source);
|
|
23
28
|
}
|
|
24
29
|
static getData() {
|
|
25
30
|
if (!this.exists()) {
|
|
26
31
|
return {};
|
|
27
32
|
} else {
|
|
28
33
|
try {
|
|
29
|
-
return JSON.parse((0, _file.getFileContent)(Cache.#cachePath));
|
|
34
|
+
return JSON.parse((0, _file.getFileContent)(Cache.#cachePath).replace(new RegExp(`(\\!window.rawData && \\(window\\.rawData=\\{'${_config.default.getLocale()}':\\{\\}\\}\\);window\\.rawData\\['${_config.default.getLocale()}'\\]=)|(;$)`, 'g'), ''));
|
|
30
35
|
} catch (ex) {
|
|
31
36
|
return {};
|
|
32
37
|
}
|
|
33
38
|
}
|
|
34
39
|
}
|
|
35
|
-
static
|
|
36
|
-
(0, _file.
|
|
37
|
-
(0, _file.ensureDirectoryExists)(_constants.CACHE_DIR_PATH, false);
|
|
40
|
+
static #ensureFileExists() {
|
|
41
|
+
(0, _file.ensureDirectoryExists)(Cache.#cacheDirPath);
|
|
38
42
|
}
|
|
39
|
-
static
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
static generatePath = timeStamp => (0, _file.joinPaths)(_constants.CACHE_DIR_PATH, Cache.#generateFileName(timeStamp));
|
|
43
|
-
static #generateFileName(timeStamp) {
|
|
44
|
-
return `${Buffer.from(timeStamp).toString('base64')}.cache`;
|
|
43
|
+
static getCacheDirPath() {
|
|
44
|
+
return Cache.#cacheDirPath;
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
exports.default = Cache;
|
package/dist/utils/constants.js
CHANGED
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.USER_INPUT_PRE_FIX = exports.SYSTEM_TYPES = exports.STATUS_INFO = exports.STATUS_COLOR = exports.RES_FILE_EXTENSIONS = exports.REPORT_COUNTS = exports.PATTERNS = exports.
|
|
7
|
-
var _path = _interopRequireDefault(require("path"));
|
|
8
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
6
|
+
exports.USER_INPUT_PRE_FIX = exports.SYSTEM_TYPES = exports.SUPPORTED_REPORT_TYPES = exports.STATUS_INFO = exports.STATUS_COLOR = exports.RES_FILE_EXTENSIONS = exports.REPORT_COUNTS = exports.PATTERNS = exports.I18N_STATUS = exports.GARBLED_CHARACTERS = exports.DEFAULT_REPORT_NAME = exports.DEBUG_MODE = exports.CONFIG_FILE_NAME = exports.COMMON_XPATH = exports.COLOR = exports.CACHE_FILE_NAME = void 0;
|
|
9
7
|
const SYSTEM_TYPES = exports.SYSTEM_TYPES = {
|
|
10
8
|
NIGHT_WATCH: 'nightwatch',
|
|
11
9
|
WEB_DRIVER_IO: 'webio',
|
|
@@ -140,6 +138,11 @@ const USER_INPUT_PRE_FIX = exports.USER_INPUT_PRE_FIX = 'zqa_';
|
|
|
140
138
|
const RES_FILE_EXTENSIONS = exports.RES_FILE_EXTENSIONS = ['.txt', '.json'];
|
|
141
139
|
const COMMON_XPATH = exports.COMMON_XPATH = `//*[string-length(normalize-space(text())) > 0 and not(ancestor-or-self::*/@style[contains(.,'display:none')]) or @placeholder] | //input[@type='checkbox']/parent::*[text() and not(ancestor-or-self::*/@style[contains(.,'display:none')])]`;
|
|
142
140
|
const DEBUG_MODE = exports.DEBUG_MODE = true;
|
|
143
|
-
const LOG_FILE_PATH = exports.LOG_FILE_PATH = _path.default.resolve(__dirname, '../logs');
|
|
144
141
|
const GARBLED_CHARACTERS = exports.GARBLED_CHARACTERS = ['☐', '�', '', 'â€', 'î', 'ÃÂ', 'ÃÂ', 'ü', 'é', 'é', 'æ•°', 'æ®', 'ラã'];
|
|
145
|
-
const CONFIG_FILE_NAME = exports.CONFIG_FILE_NAME = '.i18n-verify.rc';
|
|
142
|
+
const CONFIG_FILE_NAME = exports.CONFIG_FILE_NAME = '.i18n-verify.rc';
|
|
143
|
+
const SUPPORTED_REPORT_TYPES = exports.SUPPORTED_REPORT_TYPES = {
|
|
144
|
+
HTML: 'html',
|
|
145
|
+
ASCII_TABLE: 'ascii_table'
|
|
146
|
+
};
|
|
147
|
+
const CACHE_FILE_NAME = exports.CACHE_FILE_NAME = 'metrics.cache';
|
|
148
|
+
const DEFAULT_REPORT_NAME = exports.DEFAULT_REPORT_NAME = 'report';
|
package/dist/utils/file.js
CHANGED
|
@@ -3,9 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.saveToFile = exports.pathExists = exports.joinPaths = exports.getFileName = exports.getFileExtenstion = exports.getFileContent = exports.getDirContents = exports.fileExists = exports.ensureDirectoryExists = exports.dirExists = exports.deleteFile = exports.createFolder = exports.addContentToFile = void 0;
|
|
6
|
+
exports.saveToFile = exports.pathExists = exports.joinPaths = exports.getFileName = exports.getFileExtenstion = exports.getFileContent = exports.getDirPath = exports.getDirContents = exports.fileExists = exports.ensureDirectoryExists = exports.dirExists = exports.deleteFile = exports.createFolder = exports.addContentToFile = void 0;
|
|
7
7
|
var _fs = require("fs");
|
|
8
8
|
var _path = require("path");
|
|
9
|
+
var _logs = _interopRequireDefault(require("./logs.js"));
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
11
|
const getFileName = path => (0, _path.basename)(path);
|
|
10
12
|
exports.getFileName = getFileName;
|
|
11
13
|
const dirExists = path => pathExists(path) && (0, _fs.statSync)(path).isDirectory();
|
|
@@ -20,7 +22,7 @@ const createFolder = path => !pathExists(path) && (0, _fs.mkdirSync)(path, {
|
|
|
20
22
|
exports.createFolder = createFolder;
|
|
21
23
|
const ensureDirectoryExists = (path, log = true) => {
|
|
22
24
|
if (!pathExists(path) || !dirExists(path)) {
|
|
23
|
-
log &&
|
|
25
|
+
log && _logs.default.debug(`Folder doesn't exists, creating \x1b[34m${path}\x1b[0m`);
|
|
24
26
|
createFolder(path);
|
|
25
27
|
}
|
|
26
28
|
};
|
|
@@ -47,11 +49,13 @@ const addContentToFile = (path, content, encoding = 'utf-8') => {
|
|
|
47
49
|
flag: 'a'
|
|
48
50
|
});
|
|
49
51
|
} catch (err) {
|
|
50
|
-
|
|
52
|
+
_logs.default.error(err);
|
|
51
53
|
}
|
|
52
54
|
};
|
|
53
55
|
exports.addContentToFile = addContentToFile;
|
|
54
56
|
const deleteFile = (path, recursive = false) => pathExists(path) && (0, _fs.rmSync)(path, {
|
|
55
57
|
recursive
|
|
56
58
|
});
|
|
57
|
-
exports.deleteFile = deleteFile;
|
|
59
|
+
exports.deleteFile = deleteFile;
|
|
60
|
+
const getDirPath = filePath => (0, _path.dirname)(filePath);
|
|
61
|
+
exports.getDirPath = getDirPath;
|
|
@@ -7,7 +7,7 @@ exports.default = void 0;
|
|
|
7
7
|
var _jimp = _interopRequireDefault(require("jimp"));
|
|
8
8
|
var _path = _interopRequireDefault(require("path"));
|
|
9
9
|
var _fs = _interopRequireDefault(require("fs"));
|
|
10
|
-
var _logs = _interopRequireDefault(require("
|
|
10
|
+
var _logs = _interopRequireDefault(require("./logs.js"));
|
|
11
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
12
|
class Graphic {
|
|
13
13
|
/**
|
package/dist/utils/logs.js
CHANGED
|
@@ -4,12 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _path = _interopRequireDefault(require("path"));
|
|
8
7
|
var _constants = require("../utils/constants.js");
|
|
9
8
|
var _file = require("./file.js");
|
|
9
|
+
var _reports = _interopRequireDefault(require("../lib/reports.js"));
|
|
10
|
+
var _config = _interopRequireDefault(require("../lib/config.js"));
|
|
10
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
12
|
const fs = require('fs');
|
|
12
13
|
class Logger {
|
|
14
|
+
static #suppressLogging = false;
|
|
13
15
|
static info(message) {
|
|
14
16
|
Logger.#print('info', message);
|
|
15
17
|
}
|
|
@@ -17,14 +19,21 @@ class Logger {
|
|
|
17
19
|
Logger.#print('warn', message);
|
|
18
20
|
}
|
|
19
21
|
static error(message) {
|
|
20
|
-
Logger.#print('
|
|
22
|
+
Logger.#print('errr', message);
|
|
21
23
|
}
|
|
22
24
|
static debug(message) {
|
|
23
|
-
Logger.#print('
|
|
25
|
+
Logger.#print('dbug', message);
|
|
24
26
|
}
|
|
25
27
|
static #print(type, message) {
|
|
28
|
+
const colors = {
|
|
29
|
+
INFO: '\x1b[37m',
|
|
30
|
+
WARN: '\x1b[33m',
|
|
31
|
+
ERRR: '\x1b[31m',
|
|
32
|
+
DBUG: '\x1b[34m'
|
|
33
|
+
};
|
|
26
34
|
type = type.toUpperCase();
|
|
27
|
-
let
|
|
35
|
+
let color = colors[type] || colors.DEFAULT;
|
|
36
|
+
let logMessage = `[${new Date().toLocaleString()}] [${color}${type}\x1b[0m] [${_config.default.getLocale()}] - ${message}`;
|
|
28
37
|
switch (type) {
|
|
29
38
|
case 'INFO':
|
|
30
39
|
_constants.DEBUG_MODE && console.info(logMessage);
|
|
@@ -32,10 +41,10 @@ class Logger {
|
|
|
32
41
|
case 'WARN':
|
|
33
42
|
_constants.DEBUG_MODE && console.warn(logMessage);
|
|
34
43
|
break;
|
|
35
|
-
case '
|
|
44
|
+
case 'ERRR':
|
|
36
45
|
console.error(logMessage);
|
|
37
46
|
break;
|
|
38
|
-
case '
|
|
47
|
+
case 'DBUG':
|
|
39
48
|
_constants.DEBUG_MODE && console.debug(logMessage);
|
|
40
49
|
break;
|
|
41
50
|
default:
|
|
@@ -45,16 +54,26 @@ class Logger {
|
|
|
45
54
|
Logger.#customLog(`${logMessage}\n`);
|
|
46
55
|
}
|
|
47
56
|
static #customLog = message => {
|
|
48
|
-
|
|
57
|
+
if (Logger.#suppressLogging) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const LOGS_DIR = (0, _file.joinPaths)(_reports.default.getReportPath(), 'logs');
|
|
49
61
|
const logFilePath = (0, _file.joinPaths)(LOGS_DIR, 'log.log');
|
|
62
|
+
Logger.#suppressLogging = true;
|
|
50
63
|
(0, _file.ensureDirectoryExists)(LOGS_DIR, _constants.DEBUG_MODE);
|
|
64
|
+
Logger.#suppressLogging = false;
|
|
51
65
|
if (!(0, _file.fileExists)(logFilePath)) {
|
|
52
66
|
fs.writeFileSync(logFilePath, '');
|
|
53
67
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
68
|
+
new Promise((resolve, reject) => {
|
|
69
|
+
fs.appendFile(logFilePath, message, err => {
|
|
70
|
+
if (err) {
|
|
71
|
+
Logger.error('Error writing to log file:', err, true);
|
|
72
|
+
reject(err);
|
|
73
|
+
} else {
|
|
74
|
+
resolve();
|
|
75
|
+
}
|
|
76
|
+
});
|
|
58
77
|
});
|
|
59
78
|
};
|
|
60
79
|
}
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _cache = _interopRequireDefault(require("../cache.js"));
|
|
8
8
|
var _metaData = _interopRequireDefault(require("./metaData.js"));
|
|
9
|
-
var _statData = _interopRequireDefault(require("./statData.js"));
|
|
10
9
|
var _stringData = _interopRequireDefault(require("./stringData.js"));
|
|
11
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
11
|
class CacheData {
|
|
@@ -15,16 +14,12 @@ class CacheData {
|
|
|
15
14
|
*/
|
|
16
15
|
#metaData;
|
|
17
16
|
/**
|
|
18
|
-
* @type {
|
|
17
|
+
* @type {StringData}
|
|
19
18
|
*/
|
|
20
|
-
#
|
|
19
|
+
#stringsData;
|
|
21
20
|
constructor(data = {}) {
|
|
22
21
|
this.#metaData = new _metaData.default(data.metaData);
|
|
23
|
-
|
|
24
|
-
for (const locale in data.localeData) {
|
|
25
|
-
this.#localeData[locale] = new _stringData.default(data.localeData[locale]);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
22
|
+
this.#stringsData = new _stringData.default(data.stringsData);
|
|
28
23
|
}
|
|
29
24
|
getMetaData() {
|
|
30
25
|
return this.#metaData;
|
|
@@ -32,50 +27,36 @@ class CacheData {
|
|
|
32
27
|
setMetaData(metaData) {
|
|
33
28
|
this.#metaData = metaData;
|
|
34
29
|
}
|
|
35
|
-
|
|
36
|
-
return
|
|
37
|
-
}
|
|
38
|
-
getLocaleStringData(locale) {
|
|
39
|
-
return locale ? this.#localeData[locale] : this.#localeData;
|
|
40
|
-
}
|
|
41
|
-
setLocaleStringData(locale, stringData) {
|
|
42
|
-
this.#localeData[locale] = stringData;
|
|
43
|
-
}
|
|
44
|
-
getStringEntry(locale, string) {
|
|
45
|
-
return this.#localeData[locale].getStringData(string);
|
|
30
|
+
getStringEntry(string) {
|
|
31
|
+
return this.#stringsData.getStringData(string);
|
|
46
32
|
}
|
|
47
|
-
static addString(
|
|
33
|
+
static addString(string, type, description, imagePath) {
|
|
48
34
|
const cache = CacheData.getInstance();
|
|
49
|
-
const added = cache.#addStringEntry(
|
|
50
|
-
cache.save();
|
|
35
|
+
const added = cache.#addStringEntry(string, type, description, imagePath.replace(/\\/g, '/'));
|
|
36
|
+
added && cache.save();
|
|
51
37
|
return added;
|
|
52
38
|
}
|
|
53
|
-
#addStringEntry(
|
|
39
|
+
#addStringEntry(string, type, description, imagePath) {
|
|
54
40
|
let dataAdded = false;
|
|
55
41
|
const info = {
|
|
56
42
|
type,
|
|
57
43
|
description,
|
|
58
44
|
imagePath
|
|
59
45
|
};
|
|
60
|
-
if (!this.#
|
|
61
|
-
|
|
62
|
-
this.#metaData.setStatByLocale(locale, new _statData.default());
|
|
63
|
-
dataAdded = true;
|
|
64
|
-
} else if (!this.#localeData[locale].hasStringData(string)) {
|
|
65
|
-
dataAdded = this.#localeData[locale].setStringData(string, info);
|
|
46
|
+
if (!this.#stringsData.hasStringData(string)) {
|
|
47
|
+
dataAdded = this.#stringsData.setStringData(string, info);
|
|
66
48
|
} else {
|
|
67
|
-
dataAdded = this.#
|
|
49
|
+
dataAdded = this.#stringsData.checkAndAdd(string, info);
|
|
68
50
|
}
|
|
69
51
|
if (dataAdded) {
|
|
70
|
-
this.#metaData.
|
|
71
|
-
this.#metaData.getStatByLocale(locale).incrementByType(type);
|
|
52
|
+
this.#metaData.getStats().incrementByType(type);
|
|
72
53
|
}
|
|
73
54
|
return dataAdded;
|
|
74
55
|
}
|
|
75
56
|
toJSON() {
|
|
76
57
|
return {
|
|
77
58
|
metaData: this.#metaData,
|
|
78
|
-
|
|
59
|
+
stringsData: this.#stringsData
|
|
79
60
|
};
|
|
80
61
|
}
|
|
81
62
|
save() {
|
|
@@ -10,38 +10,19 @@ class MetaData {
|
|
|
10
10
|
/**
|
|
11
11
|
* @type {StatData}
|
|
12
12
|
*/
|
|
13
|
-
#
|
|
14
|
-
/**
|
|
15
|
-
* @type {{[key: string]: StatData}}
|
|
16
|
-
*/
|
|
17
|
-
#statByLocale = {};
|
|
13
|
+
#stats;
|
|
18
14
|
constructor(data = {}) {
|
|
19
|
-
this.#
|
|
20
|
-
if (data?.statByLocale) {
|
|
21
|
-
for (const locale in data.statByLocale) {
|
|
22
|
-
this.#statByLocale[locale] = new _statData.default(data.statByLocale[locale]);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
getStat() {
|
|
27
|
-
return this.#stat;
|
|
28
|
-
}
|
|
29
|
-
setStat(stat) {
|
|
30
|
-
this.#stat = stat;
|
|
31
|
-
}
|
|
32
|
-
getStatByLocale(locale) {
|
|
33
|
-
return locale ? this.#statByLocale[locale] : this.#statByLocale;
|
|
15
|
+
this.#stats = new _statData.default(data.stats);
|
|
34
16
|
}
|
|
35
|
-
|
|
36
|
-
this.#
|
|
17
|
+
getStats() {
|
|
18
|
+
return this.#stats;
|
|
37
19
|
}
|
|
38
|
-
|
|
39
|
-
|
|
20
|
+
setStats(stats) {
|
|
21
|
+
this.#stats = stats;
|
|
40
22
|
}
|
|
41
23
|
toJSON() {
|
|
42
24
|
return {
|
|
43
|
-
|
|
44
|
-
statByLocale: this.#statByLocale
|
|
25
|
+
stats: this.#stats
|
|
45
26
|
};
|
|
46
27
|
}
|
|
47
28
|
}
|
|
@@ -4,13 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _cacheData = _interopRequireDefault(require("./cacheData.js"));
|
|
8
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
7
|
class ReportData {
|
|
10
|
-
/**
|
|
11
|
-
* @type {CacheData}
|
|
12
|
-
*/
|
|
13
|
-
#data;
|
|
14
8
|
/**
|
|
15
9
|
* @type {String}
|
|
16
10
|
*/
|
|
@@ -20,29 +14,17 @@ class ReportData {
|
|
|
20
14
|
*/
|
|
21
15
|
#reportTime;
|
|
22
16
|
constructor({
|
|
23
|
-
data,
|
|
24
17
|
appName,
|
|
25
18
|
reportTime
|
|
26
19
|
}) {
|
|
27
|
-
this.#data = data;
|
|
28
20
|
this.#appName = appName;
|
|
29
21
|
this.#reportTime = reportTime;
|
|
30
22
|
}
|
|
31
|
-
getData() {
|
|
32
|
-
return this.#data;
|
|
33
|
-
}
|
|
34
23
|
getAppName() {
|
|
35
24
|
return this.#appName;
|
|
36
25
|
}
|
|
37
26
|
getReportTime() {
|
|
38
27
|
return this.#reportTime;
|
|
39
28
|
}
|
|
40
|
-
toJSON() {
|
|
41
|
-
return {
|
|
42
|
-
data: this.#data,
|
|
43
|
-
appName: this.#appName,
|
|
44
|
-
reportTime: this.#reportTime
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
29
|
}
|
|
48
30
|
exports.default = ReportData;
|
|
@@ -57,7 +57,7 @@ class StatData {
|
|
|
57
57
|
/**
|
|
58
58
|
* @type {Number}
|
|
59
59
|
*/
|
|
60
|
-
#
|
|
60
|
+
#localizedCurrency;
|
|
61
61
|
/**
|
|
62
62
|
* @type {Number}
|
|
63
63
|
*/
|
|
@@ -65,7 +65,7 @@ class StatData {
|
|
|
65
65
|
/**
|
|
66
66
|
* @type {Number}
|
|
67
67
|
*/
|
|
68
|
-
#
|
|
68
|
+
#localizedPercentage;
|
|
69
69
|
/**
|
|
70
70
|
* @type {Number}
|
|
71
71
|
*/
|
|
@@ -73,7 +73,7 @@ class StatData {
|
|
|
73
73
|
/**
|
|
74
74
|
* @type {Number}
|
|
75
75
|
*/
|
|
76
|
-
#
|
|
76
|
+
#ignored;
|
|
77
77
|
/**
|
|
78
78
|
* @type {Number}
|
|
79
79
|
*/
|
|
@@ -81,7 +81,11 @@ class StatData {
|
|
|
81
81
|
/**
|
|
82
82
|
* @type {Number}
|
|
83
83
|
*/
|
|
84
|
-
#
|
|
84
|
+
#autoIgnored;
|
|
85
|
+
/**
|
|
86
|
+
* @type {Number}
|
|
87
|
+
*/
|
|
88
|
+
#userInput;
|
|
85
89
|
/**
|
|
86
90
|
* @type {Number}
|
|
87
91
|
*/
|
|
@@ -111,13 +115,14 @@ class StatData {
|
|
|
111
115
|
this.#notLocalizedTime = data?.notLocalizedTime || 0;
|
|
112
116
|
this.#localizedNumber = data?.localizedNumber || 0;
|
|
113
117
|
this.#notLocalizedNumber = data?.notLocalizedNumber || 0;
|
|
114
|
-
this.#
|
|
118
|
+
this.#localizedCurrency = data?.localizedCurrency || 0;
|
|
115
119
|
this.#notLocalizedCurrency = data?.notLocalizedCurrency || 0;
|
|
116
|
-
this.#
|
|
120
|
+
this.#localizedPercentage = data?.localizedPercentage || 0;
|
|
117
121
|
this.#notLocalizedPercentage = data?.notLocalizedPercentage || 0;
|
|
118
|
-
this.#
|
|
122
|
+
this.#ignored = data?.ignored || 0;
|
|
119
123
|
this.#dnt = data?.dnt || 0;
|
|
120
|
-
this.#
|
|
124
|
+
this.#autoIgnored = data?.autoIgnored || 0;
|
|
125
|
+
this.#userInput = data?.userInput || 0;
|
|
121
126
|
this.#encoding = data?.encoding || 0;
|
|
122
127
|
this.#truncation = data?.truncation || 0;
|
|
123
128
|
this.#overlapping = data?.overlapping || 0;
|
|
@@ -196,10 +201,10 @@ class StatData {
|
|
|
196
201
|
this.#notLocalizedNumber = notLocalizedNumber;
|
|
197
202
|
}
|
|
198
203
|
getCurrency() {
|
|
199
|
-
return this.#
|
|
204
|
+
return this.#localizedCurrency;
|
|
200
205
|
}
|
|
201
206
|
setCurrency(currency) {
|
|
202
|
-
this.#
|
|
207
|
+
this.#localizedCurrency = currency;
|
|
203
208
|
}
|
|
204
209
|
getNotLocalizeCurrency() {
|
|
205
210
|
return this.#notLocalizedCurrency;
|
|
@@ -208,10 +213,10 @@ class StatData {
|
|
|
208
213
|
this.#notLocalizedCurrency = notLocalizedCurrency;
|
|
209
214
|
}
|
|
210
215
|
getPercentage() {
|
|
211
|
-
return this.#
|
|
216
|
+
return this.#localizedPercentage;
|
|
212
217
|
}
|
|
213
218
|
setPercentage(percentage) {
|
|
214
|
-
this.#
|
|
219
|
+
this.#localizedPercentage = percentage;
|
|
215
220
|
}
|
|
216
221
|
getNotLocalizePercentage() {
|
|
217
222
|
return this.#notLocalizedPercentage;
|
|
@@ -219,11 +224,17 @@ class StatData {
|
|
|
219
224
|
setNotLocalizePercentage(notLocalizedPercentage) {
|
|
220
225
|
this.#notLocalizedPercentage = notLocalizedPercentage;
|
|
221
226
|
}
|
|
222
|
-
|
|
223
|
-
return this.#
|
|
227
|
+
getIgnored() {
|
|
228
|
+
return this.#ignored;
|
|
224
229
|
}
|
|
225
|
-
|
|
226
|
-
this.#
|
|
230
|
+
setIgnored(ignored) {
|
|
231
|
+
this.#ignored = ignored;
|
|
232
|
+
}
|
|
233
|
+
getUserInput() {
|
|
234
|
+
return this.#userInput;
|
|
235
|
+
}
|
|
236
|
+
setUserInput(userInput) {
|
|
237
|
+
this.#userInput = userInput;
|
|
227
238
|
}
|
|
228
239
|
getDnt() {
|
|
229
240
|
return this.#dnt;
|
|
@@ -231,11 +242,11 @@ class StatData {
|
|
|
231
242
|
setDnt(dnt) {
|
|
232
243
|
this.#dnt = dnt;
|
|
233
244
|
}
|
|
234
|
-
|
|
235
|
-
return this.#
|
|
245
|
+
getAutoIgnored() {
|
|
246
|
+
return this.#autoIgnored;
|
|
236
247
|
}
|
|
237
|
-
|
|
238
|
-
this.#
|
|
248
|
+
setAutoIgnored(autoIgnored) {
|
|
249
|
+
this.#autoIgnored = autoIgnored;
|
|
239
250
|
}
|
|
240
251
|
getEncoding() {
|
|
241
252
|
return this.#encoding;
|
|
@@ -276,10 +287,10 @@ class StatData {
|
|
|
276
287
|
++this.#partialStrings;
|
|
277
288
|
break;
|
|
278
289
|
case _constants.I18N_STATUS.AUTO_IGNORE:
|
|
279
|
-
++this.#
|
|
290
|
+
++this.#autoIgnored;
|
|
280
291
|
break;
|
|
281
292
|
case _constants.I18N_STATUS.IGNORE:
|
|
282
|
-
++this.#
|
|
293
|
+
++this.#ignored;
|
|
283
294
|
break;
|
|
284
295
|
case _constants.I18N_STATUS.DNT:
|
|
285
296
|
++this.#dnt;
|
|
@@ -312,13 +323,13 @@ class StatData {
|
|
|
312
323
|
++this.#notLocalizedNumber;
|
|
313
324
|
break;
|
|
314
325
|
case _constants.I18N_STATUS.CURRENCY_LOCALIZED:
|
|
315
|
-
++this.#
|
|
326
|
+
++this.#localizedCurrency;
|
|
316
327
|
break;
|
|
317
328
|
case _constants.I18N_STATUS.CURRENCY_NOT_LOCALIZED:
|
|
318
329
|
++this.#notLocalizedCurrency;
|
|
319
330
|
break;
|
|
320
331
|
case _constants.I18N_STATUS.PERCENTAGE_LOCALIZED:
|
|
321
|
-
++this.#
|
|
332
|
+
++this.#localizedPercentage;
|
|
322
333
|
break;
|
|
323
334
|
case _constants.I18N_STATUS.PERCENTAGE_NOT_LOCALIZED:
|
|
324
335
|
++this.#notLocalizedPercentage;
|
|
@@ -332,6 +343,9 @@ class StatData {
|
|
|
332
343
|
case _constants.I18N_STATUS.REVIEWED:
|
|
333
344
|
++this.#reviewed;
|
|
334
345
|
break;
|
|
346
|
+
case _constants.I18N_STATUS.USER_INPUT:
|
|
347
|
+
++this.#userInput;
|
|
348
|
+
break;
|
|
335
349
|
}
|
|
336
350
|
}
|
|
337
351
|
toJSON() {
|
|
@@ -348,13 +362,14 @@ class StatData {
|
|
|
348
362
|
notLocalizedTime: this.#notLocalizedTime,
|
|
349
363
|
localizedNumber: this.#localizedNumber,
|
|
350
364
|
notLocalizedNumber: this.#notLocalizedNumber,
|
|
351
|
-
|
|
365
|
+
localizedCurrency: this.#localizedCurrency,
|
|
352
366
|
notLocalizedCurrency: this.#notLocalizedCurrency,
|
|
353
|
-
|
|
367
|
+
localizedPercentage: this.#localizedPercentage,
|
|
354
368
|
notLocalizedPercentage: this.#notLocalizedPercentage,
|
|
355
|
-
|
|
369
|
+
ignored: this.#ignored,
|
|
356
370
|
dnt: this.#dnt,
|
|
357
|
-
|
|
371
|
+
autoIgnored: this.#autoIgnored,
|
|
372
|
+
userInput: this.#userInput,
|
|
358
373
|
encoding: this.#encoding,
|
|
359
374
|
truncation: this.#truncation,
|
|
360
375
|
overlapping: this.#overlapping,
|
|
@@ -12,8 +12,7 @@ class StringData {
|
|
|
12
12
|
*/
|
|
13
13
|
#data = {};
|
|
14
14
|
constructor(data) {
|
|
15
|
-
if (data
|
|
16
|
-
data = data.data;
|
|
15
|
+
if (data) {
|
|
17
16
|
for (const string in data) {
|
|
18
17
|
data[string].forEach(info => {
|
|
19
18
|
if (!this.#data[string]) {
|
|
@@ -25,7 +24,7 @@ class StringData {
|
|
|
25
24
|
}
|
|
26
25
|
}
|
|
27
26
|
getStringData(string) {
|
|
28
|
-
return this.#data[string];
|
|
27
|
+
return this.#data[string] || [];
|
|
29
28
|
}
|
|
30
29
|
setStringData(string, info) {
|
|
31
30
|
!this.#data[string] && (this.#data[string] = []);
|
|
@@ -34,7 +33,7 @@ class StringData {
|
|
|
34
33
|
}
|
|
35
34
|
checkAndAdd(string, info) {
|
|
36
35
|
!this.#data[string] && (this.#data[string] = []);
|
|
37
|
-
const canAdd = this.getStringData(string).some(data => data.getDescription() !== info.
|
|
36
|
+
const canAdd = this.getStringData(string).some(data => data.getDescription() !== info.description || data.getImagePath() !== info.imagePath || data.getType() !== data.type);
|
|
38
37
|
if (canAdd) {
|
|
39
38
|
this.setStringData(string, info);
|
|
40
39
|
}
|
|
@@ -59,9 +58,7 @@ class StringData {
|
|
|
59
58
|
});
|
|
60
59
|
}
|
|
61
60
|
toJSON() {
|
|
62
|
-
return
|
|
63
|
-
data: this.#data
|
|
64
|
-
};
|
|
61
|
+
return this.#data;
|
|
65
62
|
}
|
|
66
63
|
}
|
|
67
64
|
exports.default = StringData;
|
|
@@ -4,6 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
+
var _config = _interopRequireDefault(require("../../lib/config.js"));
|
|
8
|
+
var _constants = require("../constants.js");
|
|
7
9
|
var _logs = _interopRequireDefault(require("../logs.js"));
|
|
8
10
|
var _reportData = _interopRequireDefault(require("../objects/reportData.js"));
|
|
9
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -27,9 +29,9 @@ class BaseReport {
|
|
|
27
29
|
this.#reportData = data;
|
|
28
30
|
this.$generatedContent = this.buildContent();
|
|
29
31
|
}
|
|
30
|
-
export(path, name =
|
|
32
|
+
export(path, name = _constants.DEFAULT_REPORT_NAME) {
|
|
31
33
|
this.write(path, name, this.$generatedContent);
|
|
32
|
-
_logs.default.info(`
|
|
34
|
+
_logs.default.info(`Exported consolidated I18n Verification ${this.$type} report in ${path}`);
|
|
33
35
|
}
|
|
34
36
|
write(path, name, data) {
|
|
35
37
|
throw new Error('should be implemented by child report classes');
|
|
@@ -37,14 +39,20 @@ class BaseReport {
|
|
|
37
39
|
buildContent() {
|
|
38
40
|
throw new Error('should be implemented by child report classes');
|
|
39
41
|
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
*
|
|
45
|
+
* @returns {{
|
|
46
|
+
* appName: String,
|
|
47
|
+
* defaultLocale: String,
|
|
48
|
+
* reportTime: String,
|
|
49
|
+
* }}
|
|
50
|
+
*/
|
|
40
51
|
getMetaInfo() {
|
|
41
52
|
return {
|
|
53
|
+
defaultLocale: _config.default.getDefaultLocale(),
|
|
42
54
|
appName: this.#reportData.getAppName(),
|
|
43
|
-
|
|
44
|
-
stats: this.#reportData.getData().getMetaData().getStat(),
|
|
45
|
-
statsByLocale: this.#reportData.getData().getMetaData().getStatByLocale(),
|
|
46
|
-
reportTime: this.#reportData.getReportTime(),
|
|
47
|
-
stringData: this.#reportData.getData().getLocaleStringData()
|
|
55
|
+
reportTime: this.#reportData.getReportTime()
|
|
48
56
|
};
|
|
49
57
|
}
|
|
50
58
|
}
|