@zeesoft/i18n-verify 2.1.4 → 2.1.7
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 +1 -0
- package/dist/i18n.mjs +1 -0
- package/dist/index.mjs +1 -0
- package/package.json +25 -17
- package/postinstall.js +28 -0
- package/readme.md +21 -1
- package/dist/driver/adapters/cypress.js +0 -161
- package/dist/driver/adapters/nightwatch.js +0 -160
- package/dist/driver/adapters/selenium.js +0 -90
- package/dist/driver/adapters/webdriver.io.js +0 -81
- package/dist/driver/baseDriver.js +0 -93
- package/dist/driver/factory.js +0 -27
- package/dist/index.js +0 -52
- package/dist/lib/config.js +0 -102
- package/dist/lib/i18n.js +0 -259
- package/dist/lib/reports.js +0 -140
- package/dist/lib/validator/base.js +0 -125
- package/dist/lib/validator/currency.js +0 -94
- package/dist/lib/validator/date.js +0 -72
- package/dist/lib/validator/datetime.js +0 -72
- package/dist/lib/validator/index.js +0 -156
- package/dist/lib/validator/number.js +0 -58
- package/dist/lib/validator/percentage.js +0 -78
- package/dist/lib/validator/string.js +0 -172
- package/dist/lib/validator/time.js +0 -72
- package/dist/template/report.html +0 -1678
- package/dist/utils/cache.js +0 -47
- package/dist/utils/common.js +0 -18
- package/dist/utils/configFile.js +0 -65
- package/dist/utils/constants.js +0 -148
- package/dist/utils/cypress.js +0 -120
- package/dist/utils/dateUtils/chronoNode.js +0 -52
- package/dist/utils/file.js +0 -61
- package/dist/utils/graphic.js +0 -57
- package/dist/utils/logs.js +0 -79
- package/dist/utils/objects/cacheData.js +0 -72
- package/dist/utils/objects/metaData.js +0 -29
- package/dist/utils/objects/reportData.js +0 -30
- package/dist/utils/objects/statData.js +0 -380
- package/dist/utils/objects/stringData.js +0 -64
- package/dist/utils/objects/stringInfo.js +0 -51
- package/dist/utils/regex.js +0 -8
- package/dist/utils/reportFactory/base.js +0 -59
- package/dist/utils/reportFactory/html/index.js +0 -51
- package/dist/utils/reportFactory/html/template/body.js +0 -117
- package/dist/utils/reportFactory/html/template/css.js +0 -476
- package/dist/utils/reportFactory/html/template/html.js +0 -63
- package/dist/utils/reportFactory/html/template/javascript/data.js +0 -66
- package/dist/utils/reportFactory/html/template/javascript/global.js +0 -45
- package/dist/utils/reportFactory/html/template/javascript/grid.js +0 -129
- package/dist/utils/reportFactory/html/template/javascript/index.js +0 -22
- package/dist/utils/reportFactory/html/template/javascript/insight.js +0 -248
- package/dist/utils/reportFactory/html/template/javascript/log.js +0 -19
- package/dist/utils/reportFactory/html/template/javascript/menuBar.js +0 -123
- package/dist/utils/reportFactory/html/template/javascript/overview.js +0 -818
- package/dist/utils/reportFactory/index.js +0 -36
- package/dist/utils/reportFactory/table.js +0 -95
- package/dist/utils/resource.js +0 -58
- package/dist/utils/runtime.js +0 -36
- package/dist/utils/scripts/genreport.js +0 -1
- package/dist/utils/scripts/postinstall.js +0 -22
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _constants = require("../constants.js");
|
|
8
|
-
var _index = _interopRequireDefault(require("./html/index.js"));
|
|
9
|
-
var _reportData = _interopRequireDefault(require("../objects/reportData.js"));
|
|
10
|
-
var _runtime = require("../runtime.js");
|
|
11
|
-
var _table = _interopRequireDefault(require("./table.js"));
|
|
12
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
-
class ReportFactory {
|
|
14
|
-
static #build(type) {
|
|
15
|
-
switch (type) {
|
|
16
|
-
case _constants.SUPPORTED_REPORT_TYPES.HTML:
|
|
17
|
-
return new _index.default();
|
|
18
|
-
case _constants.SUPPORTED_REPORT_TYPES.ASCII_TABLE:
|
|
19
|
-
return new _table.default();
|
|
20
|
-
default:
|
|
21
|
-
throw new Error('unsupported report type requested');
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
static export(type, path, name) {
|
|
25
|
-
const builder = ReportFactory.#build(type);
|
|
26
|
-
const reportTime = new Date().toLocaleString();
|
|
27
|
-
const appName = (0, _runtime.getRootProjectName)();
|
|
28
|
-
const reportData = new _reportData.default({
|
|
29
|
-
appName,
|
|
30
|
-
reportTime
|
|
31
|
-
});
|
|
32
|
-
builder.generate(reportData);
|
|
33
|
-
builder.export(path, name);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
exports.default = ReportFactory;
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _consoleTablePrinter = require("console-table-printer");
|
|
8
|
-
var _constants = require("../constants");
|
|
9
|
-
var _logs = _interopRequireDefault(require("../logs"));
|
|
10
|
-
var _base = _interopRequireDefault(require("./base"));
|
|
11
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
-
class TableReport extends _base.default {
|
|
13
|
-
/**
|
|
14
|
-
* @type {Table}
|
|
15
|
-
*/
|
|
16
|
-
#printer;
|
|
17
|
-
/**
|
|
18
|
-
* @type {Boolean}
|
|
19
|
-
*/
|
|
20
|
-
#hasData = false;
|
|
21
|
-
static #column1 = 'STATUS';
|
|
22
|
-
static #column2 = 'COUNTS';
|
|
23
|
-
constructor() {
|
|
24
|
-
super(_constants.SUPPORTED_REPORT_TYPES.ASCII_TABLE);
|
|
25
|
-
this.#preparePrinter();
|
|
26
|
-
}
|
|
27
|
-
#preparePrinter() {
|
|
28
|
-
this.#printer = new _consoleTablePrinter.Table({
|
|
29
|
-
style: {
|
|
30
|
-
headerTop: {
|
|
31
|
-
left: '\u001B[94m╔\x1b[0m',
|
|
32
|
-
mid: '\u001B[94m╦\x1b[0m',
|
|
33
|
-
right: '\u001B[94m╗\x1b[0m',
|
|
34
|
-
other: '\u001B[94m═'
|
|
35
|
-
},
|
|
36
|
-
headerBottom: {
|
|
37
|
-
left: '\u001B[94m╟\x1b[0m',
|
|
38
|
-
mid: '\u001B[94m╬\x1b[0m',
|
|
39
|
-
right: '\u001B[94m╢\x1b[0m',
|
|
40
|
-
other: '\u001B[94m═'
|
|
41
|
-
},
|
|
42
|
-
tableBottom: {
|
|
43
|
-
left: '\u001B[94m╚\x1b[0m',
|
|
44
|
-
mid: '\u001B[94m╩\x1b[0m',
|
|
45
|
-
right: '\u001B[94m╝\x1b[0m',
|
|
46
|
-
other: '\u001B[94m═\x1b[0m'
|
|
47
|
-
},
|
|
48
|
-
vertical: '\u001B[94m║\x1b[0m'
|
|
49
|
-
},
|
|
50
|
-
columns: [{
|
|
51
|
-
name: TableReport.#column1,
|
|
52
|
-
alignment: 'left'
|
|
53
|
-
}, {
|
|
54
|
-
name: TableReport.#column2,
|
|
55
|
-
alignment: 'center'
|
|
56
|
-
}]
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* @override
|
|
62
|
-
*/
|
|
63
|
-
buildContent() {
|
|
64
|
-
if (_constants.REPORT_COUNTS[_constants.I18N_STATUS.REVIEWED] > 0) {
|
|
65
|
-
this.#hasData = true;
|
|
66
|
-
for (const key in _constants.REPORT_COUNTS) {
|
|
67
|
-
if (key !== _constants.I18N_STATUS.REVIEWED) {
|
|
68
|
-
if (_constants.REPORT_COUNTS.hasOwnProperty(key)) {
|
|
69
|
-
this.#printer.addRows([{
|
|
70
|
-
STATUS: key,
|
|
71
|
-
COUNTS: `${_constants.REPORT_COUNTS[key]}`
|
|
72
|
-
}]);
|
|
73
|
-
}
|
|
74
|
-
} else {
|
|
75
|
-
this.#printer.addRows([{
|
|
76
|
-
STATUS: '\u001B[94m' + '═'.repeat(28) + '\x1b[0m',
|
|
77
|
-
COUNTS: '\u001B[94m' + '═'.repeat(8) + '\x1b[0m'
|
|
78
|
-
}]);
|
|
79
|
-
this.#printer.addRows([{
|
|
80
|
-
STATUS: 'OVERALL_REVIEWED',
|
|
81
|
-
COUNTS: `${_constants.REPORT_COUNTS[key]}`
|
|
82
|
-
}]);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* @override
|
|
90
|
-
*/
|
|
91
|
-
export() {
|
|
92
|
-
this.#hasData ? this.#printer.printTable() : _logs.default.info('There are no visbile elements with UI strings');
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
exports.default = TableReport;
|
package/dist/utils/resource.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _config = _interopRequireDefault(require("../lib/config.js"));
|
|
8
|
-
var _constants = require("./constants.js");
|
|
9
|
-
var _file = require("./file.js");
|
|
10
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
-
class Resource {
|
|
12
|
-
static load() {
|
|
13
|
-
const bundle = {};
|
|
14
|
-
if (_config.default.getOptions()?.l10nResourcePath) {
|
|
15
|
-
const resourcePath = (0, _file.joinPaths)(process.cwd(), _config.default.getOptions()?.l10nResourcePath);
|
|
16
|
-
if ((0, _file.fileExists)(resourcePath)) {
|
|
17
|
-
Resource.#processFile(resourcePath, bundle);
|
|
18
|
-
} else if ((0, _file.dirExists)(resourcePath)) {
|
|
19
|
-
for (const file of (0, _file.getDirContents)(resourcePath)) {
|
|
20
|
-
const filePath = (0, _file.joinPaths)(resourcePath, file);
|
|
21
|
-
Resource.#processFile(filePath, bundle);
|
|
22
|
-
}
|
|
23
|
-
} else {
|
|
24
|
-
console.error(`${resourcePath} invalid resource path`);
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
_config.default.setResourceBundle(bundle);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
static #processFile(filePath, bundle) {
|
|
31
|
-
const locale = _config.default.getLocale(),
|
|
32
|
-
defaultLocale = _config.default.getDefaultLocale(),
|
|
33
|
-
fileContent = (0, _file.getFileContent)(filePath),
|
|
34
|
-
ext = (0, _file.getFileExtenstion)(filePath);
|
|
35
|
-
if (_constants.RES_FILE_EXTENSIONS.includes(ext)) {
|
|
36
|
-
if (!fileContent) {
|
|
37
|
-
console.error(`${filePath} is empty or invalid`);
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
if (filePath.toLowerCase().includes('dnt')) {
|
|
41
|
-
bundle['dnt'] = fileContent.split(/\r?\n/);
|
|
42
|
-
} else if (filePath.toLowerCase().includes('ignore')) {
|
|
43
|
-
bundle['ignore'] = fileContent.split(/\r?\n/);
|
|
44
|
-
// TODO: add locale validations for the following cases
|
|
45
|
-
} else if (filePath.includes(locale)) {
|
|
46
|
-
const lines = fileContent.split(/\r?\n/);
|
|
47
|
-
bundle[locale] = lines.map(removeHtmlTags);
|
|
48
|
-
} else if (filePath.includes(defaultLocale)) {
|
|
49
|
-
bundle[defaultLocale] = fileContent.split(/\r?\n/);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
exports.default = Resource;
|
|
55
|
-
function removeHtmlTags(str) {
|
|
56
|
-
const htmlTagPattern = /<\/?[^>]+>/gi;
|
|
57
|
-
return str.replace(htmlTagPattern, '');
|
|
58
|
-
}
|
package/dist/utils/runtime.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.loadDependencies = exports.getRootProjectPackageJson = exports.getRootProjectName = exports.getRootProjectMainDir = void 0;
|
|
7
|
-
var _index = _interopRequireDefault(require("../lib/validator/index.js"));
|
|
8
|
-
var _reports = _interopRequireDefault(require("../lib/reports.js"));
|
|
9
|
-
var _resource = _interopRequireDefault(require("./resource.js"));
|
|
10
|
-
var _cache = _interopRequireDefault(require("./cache.js"));
|
|
11
|
-
var _path = require("path");
|
|
12
|
-
var _file = require("./file.js");
|
|
13
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
-
const loadDependencies = () => {
|
|
15
|
-
_resource.default.load();
|
|
16
|
-
_index.default.load();
|
|
17
|
-
_reports.default.setup();
|
|
18
|
-
_cache.default.init();
|
|
19
|
-
};
|
|
20
|
-
exports.loadDependencies = loadDependencies;
|
|
21
|
-
const getRootProjectMainDir = () => {
|
|
22
|
-
let currentDir = __dirname;
|
|
23
|
-
while (currentDir !== (0, _path.parse)(currentDir).root) {
|
|
24
|
-
const packageJsonPath = (0, _file.joinPaths)(currentDir, 'package.json');
|
|
25
|
-
if ((0, _file.fileExists)(packageJsonPath) && !(0, _file.getFileContent)(packageJsonPath).match(/"name": "@zeesoft\/i18n-verify",/g) === null) {
|
|
26
|
-
return packageJsonPath;
|
|
27
|
-
}
|
|
28
|
-
currentDir = (0, _path.dirname)(currentDir);
|
|
29
|
-
}
|
|
30
|
-
return '';
|
|
31
|
-
};
|
|
32
|
-
exports.getRootProjectMainDir = getRootProjectMainDir;
|
|
33
|
-
const getRootProjectPackageJson = (rootProjectPath = getRootProjectMainDir()) => (0, _file.getFileContent)((0, _file.joinPaths)(rootProjectPath, 'package.json'));
|
|
34
|
-
exports.getRootProjectPackageJson = getRootProjectPackageJson;
|
|
35
|
-
const getRootProjectName = () => getRootProjectPackageJson()?.match(/"name": "([^"]+)",/)?.[1] || '';
|
|
36
|
-
exports.getRootProjectName = getRootProjectName;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _configFile = require("../configFile.js");
|
|
4
|
-
var _constants = require("../constants.js");
|
|
5
|
-
var _file = require("../file.js");
|
|
6
|
-
var _runtime = require("../runtime.js");
|
|
7
|
-
const projectDir = (0, _runtime.getRootProjectMainDir)();
|
|
8
|
-
const packageJson = (0, _runtime.getRootProjectPackageJson)(projectDir);
|
|
9
|
-
let type = '';
|
|
10
|
-
if (packageJson) {
|
|
11
|
-
if (packageJson.includes('"nightwatch"')) {
|
|
12
|
-
type = _constants.SYSTEM_TYPES.NIGHT_WATCH;
|
|
13
|
-
} else if (packageJson.includes('"cypress"')) {
|
|
14
|
-
type = _constants.SYSTEM_TYPES.CYPRESS;
|
|
15
|
-
} else if (packageJson.includes('"@wdio"') || packageJson.includes('@wdio')) {
|
|
16
|
-
type = _constants.SYSTEM_TYPES.WEB_DRIVER_IO;
|
|
17
|
-
} else if (packageJson.includes('"selenium-webdriver"')) {
|
|
18
|
-
type = _constants.SYSTEM_TYPES.SELENIUMJS;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
(0, _configFile.checkAndExportConfig)((0, _file.joinPaths)(projectDir, _constants.CONFIG_FILE_NAME), type);
|
|
22
|
-
console.log(`Added ${_constants.CONFIG_FILE_NAME} to project root directory. Please use the file to configure i18n verification!`);
|