@zeesoft/i18n-verify 1.0.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 +160 -0
- package/dist/driver/adapters/nightwatch.js +95 -0
- package/dist/driver/adapters/selenium.js +94 -0
- package/dist/driver/adapters/webdriver.io.js +81 -0
- package/dist/driver/baseDriver.js +69 -0
- package/dist/driver/factory.js +27 -0
- package/dist/index.js +47 -0
- package/dist/lib/config.js +99 -0
- package/dist/lib/i18n.js +177 -0
- package/dist/lib/validator/base.js +125 -0
- package/dist/lib/validator/currency.js +94 -0
- package/dist/lib/validator/date.js +72 -0
- package/dist/lib/validator/datetime.js +72 -0
- package/dist/lib/validator/index.js +156 -0
- package/dist/lib/validator/number.js +58 -0
- package/dist/lib/validator/percentage.js +78 -0
- package/dist/lib/validator/string.js +172 -0
- package/dist/lib/validator/time.js +72 -0
- package/dist/utils/2Dgraphic.js +57 -0
- package/dist/utils/cache.js +47 -0
- package/dist/utils/common.js +18 -0
- package/dist/utils/configFile.js +64 -0
- package/dist/utils/constants.js +145 -0
- package/dist/utils/cypress.js +120 -0
- package/dist/utils/dateUtils/chronoNode.js +52 -0
- package/dist/utils/file.js +57 -0
- package/dist/utils/logs.js +61 -0
- package/dist/utils/objects/cacheData.js +91 -0
- package/dist/utils/objects/metaData.js +48 -0
- package/dist/utils/objects/reportData.js +48 -0
- package/dist/utils/objects/statData.js +365 -0
- package/dist/utils/objects/stringData.js +67 -0
- package/dist/utils/objects/stringInfo.js +51 -0
- package/dist/utils/regex.js +8 -0
- package/dist/utils/reportFactory/base.js +51 -0
- package/dist/utils/reportFactory/html/index.js +36 -0
- package/dist/utils/reportFactory/html/template/css.js +133 -0
- package/dist/utils/reportFactory/html/template/html.js +79 -0
- package/dist/utils/reportFactory/html/template/javascript.js +106 -0
- package/dist/utils/reportFactory/index.js +38 -0
- package/dist/utils/reports.js +120 -0
- package/dist/utils/reportsTable.js +71 -0
- package/dist/utils/resource.js +54 -0
- package/dist/utils/runtime.js +16 -0
- package/dist/utils/scripts/genreport.js +1 -0
- package/dist/utils/scripts/postinstall.js +21 -0
- package/package.json +59 -0
- package/readme.md +15 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.renderHtml = exports.getBodyData = void 0;
|
|
7
|
+
const renderHtml = ({
|
|
8
|
+
appName,
|
|
9
|
+
reportTime,
|
|
10
|
+
script,
|
|
11
|
+
style,
|
|
12
|
+
body
|
|
13
|
+
}) => `<!DOCTYPE html>
|
|
14
|
+
<html lang="en">
|
|
15
|
+
<head>
|
|
16
|
+
<meta charset="UTF-8" />
|
|
17
|
+
<meta name="charset" content="charset='UTF-8'" />
|
|
18
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
19
|
+
<meta name="company" content="Zeesoft" />
|
|
20
|
+
<meta name="author" content="Jitendra Maheshwari" />
|
|
21
|
+
<meta name="email" content="jm@zeesoft.com" />
|
|
22
|
+
<meta
|
|
23
|
+
name="description"
|
|
24
|
+
content="I18n verification report"
|
|
25
|
+
/>
|
|
26
|
+
<title>I18n Verification Report | ${reportTime}</title>
|
|
27
|
+
<style>
|
|
28
|
+
${style}
|
|
29
|
+
</style>
|
|
30
|
+
<script type="text/javascript">
|
|
31
|
+
${script}
|
|
32
|
+
</script>
|
|
33
|
+
</head>
|
|
34
|
+
<body>
|
|
35
|
+
${body}
|
|
36
|
+
</body>
|
|
37
|
+
</html>
|
|
38
|
+
`;
|
|
39
|
+
exports.renderHtml = renderHtml;
|
|
40
|
+
const getBodyData = () => ` <header><div class="logo">zI18n-Verify</div></header>
|
|
41
|
+
<main>
|
|
42
|
+
<div class="sidebar">
|
|
43
|
+
<ul class="menu" id="menu">
|
|
44
|
+
<li class="menu-item" data-page="overview">
|
|
45
|
+
<a href="#">Overview</a>
|
|
46
|
+
</li>
|
|
47
|
+
<li class="menu-item has-submenu" data-page="insights">
|
|
48
|
+
<a href="#" data-page="insights">Insights</a>
|
|
49
|
+
<ul class="submenu">
|
|
50
|
+
<li class="sub-menu-item" data-locale="en_US">
|
|
51
|
+
<a href="#">en_US</a>
|
|
52
|
+
</li>
|
|
53
|
+
<li class="sub-menu-item" data-locale="fr_CA">
|
|
54
|
+
<a href="#">fr_CA</a>
|
|
55
|
+
</li>
|
|
56
|
+
</ul>
|
|
57
|
+
</li>
|
|
58
|
+
</ul>
|
|
59
|
+
</div>
|
|
60
|
+
<div class="content-wrapper">
|
|
61
|
+
<div id="overview" class="content">
|
|
62
|
+
<div class="overall-quality">
|
|
63
|
+
<span class="title">Overall I18n Quality</span>
|
|
64
|
+
</div>
|
|
65
|
+
<div><span class="title">String Quality</span></div>
|
|
66
|
+
<div><span class="title">Number Quality</span></div>
|
|
67
|
+
<div><span class="title">DateTime Quality</span></div>
|
|
68
|
+
</div>
|
|
69
|
+
<div id="insights" class="content">
|
|
70
|
+
<div class="cards">
|
|
71
|
+
<span class="title">Locale wise info cards</span>
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
<div id="locale" class="content">
|
|
75
|
+
<div class="string-data"><span class="title">String Data</span></div>
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
</main>`;
|
|
79
|
+
exports.getBodyData = getBodyData;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getJsData = void 0;
|
|
7
|
+
var _dateTime = require("../../../dateTime");
|
|
8
|
+
var _apex = _interopRequireDefault(require("./includes/apex.js"));
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
const getJsData = ({
|
|
11
|
+
stats,
|
|
12
|
+
statsByLocale,
|
|
13
|
+
locales
|
|
14
|
+
}) => `
|
|
15
|
+
${getIncludes()}
|
|
16
|
+
${getSideMenuConfig()}
|
|
17
|
+
${getOverviewContent()}
|
|
18
|
+
${getInsightsContent()}
|
|
19
|
+
${getLocaleSpecificContent()}
|
|
20
|
+
`;
|
|
21
|
+
exports.getJsData = getJsData;
|
|
22
|
+
const getIncludes = () => `
|
|
23
|
+
// 3rd party sources
|
|
24
|
+
${(0, _apex.default)()}
|
|
25
|
+
`;
|
|
26
|
+
const getOverviewContent = () => `
|
|
27
|
+
//Overview
|
|
28
|
+
|
|
29
|
+
`;
|
|
30
|
+
const getInsightsContent = () => `//Cards of locales`;
|
|
31
|
+
const getLocaleSpecificContent = () => `//Choosen locale`;
|
|
32
|
+
const getSideMenuConfig = () => `// for sidebar menu
|
|
33
|
+
(() => {
|
|
34
|
+
const loadContent = (section) => {
|
|
35
|
+
const contents = document.querySelectorAll('.content');
|
|
36
|
+
contents.forEach((content) => {
|
|
37
|
+
content.id !== section
|
|
38
|
+
? content.classList.remove('active')
|
|
39
|
+
: content.classList.add('active');
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
document.addEventListener('DOMContentLoaded', function () {
|
|
44
|
+
const menuItems = document.querySelectorAll('.menu-item'),
|
|
45
|
+
submenuItems = document.querySelectorAll('.sub-menu-item');
|
|
46
|
+
|
|
47
|
+
menuItems.forEach((item) => {
|
|
48
|
+
item.addEventListener('click', function (event) {
|
|
49
|
+
const selectedMenuItem = document.querySelector(
|
|
50
|
+
'.menu-item.selected'
|
|
51
|
+
),
|
|
52
|
+
selectedSubmenu = document.querySelector('.submenu.active'),
|
|
53
|
+
page = item.dataset.page;
|
|
54
|
+
|
|
55
|
+
if (selectedMenuItem) {
|
|
56
|
+
selectedMenuItem.classList.remove('selected');
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (selectedSubmenu) {
|
|
60
|
+
selectedSubmenu.classList.remove('active');
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (item.classList.contains('has-submenu')) {
|
|
64
|
+
event.preventDefault();
|
|
65
|
+
item.classList.add('selected');
|
|
66
|
+
const submenu = item.querySelector('.submenu');
|
|
67
|
+
submenu.classList.add('active');
|
|
68
|
+
} else {
|
|
69
|
+
item.classList.add('selected');
|
|
70
|
+
if (selectedSubmenu) {
|
|
71
|
+
selectedSubmenu
|
|
72
|
+
.querySelectorAll('.sub-menu-item')
|
|
73
|
+
.forEach((submenuItem) => {
|
|
74
|
+
submenuItem.textContent !== item.textContent &&
|
|
75
|
+
submenuItem.classList.remove('selected');
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
loadContent(page);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
loadContent('overview');
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
submenuItems.forEach((sItem) => {
|
|
87
|
+
sItem.addEventListener('click', function (event) {
|
|
88
|
+
const selectedSubMenuItem = document.querySelector(
|
|
89
|
+
'.sub-menu-item.selected'
|
|
90
|
+
);
|
|
91
|
+
event.preventDefault();
|
|
92
|
+
event.stopPropagation();
|
|
93
|
+
|
|
94
|
+
if (selectedSubMenuItem) {
|
|
95
|
+
selectedSubMenuItem.classList.remove('selected');
|
|
96
|
+
}
|
|
97
|
+
sItem.classList.add('selected');
|
|
98
|
+
loadContent('locale');
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
// update footer info
|
|
103
|
+
const footer = document.querySelector('.sidebar .footer');
|
|
104
|
+
footer.textContent = '${(0, _dateTime.getCurrentYear)()} @ Zeesoft. All rights reserved.';
|
|
105
|
+
});
|
|
106
|
+
})();`;
|
|
@@ -0,0 +1,38 @@
|
|
|
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 _cache = _interopRequireDefault(require("../cache.js"));
|
|
9
|
+
var _constants = require("../constants.js");
|
|
10
|
+
var _index = _interopRequireDefault(require("./html/index.js"));
|
|
11
|
+
var _reportData = _interopRequireDefault(require("../objects/reportData.js"));
|
|
12
|
+
var _cacheData = _interopRequireDefault(require("../objects/cacheData.js"));
|
|
13
|
+
var _runtime = require("../runtime.js");
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
+
class ReportFactory {
|
|
16
|
+
static #build(type) {
|
|
17
|
+
switch (type) {
|
|
18
|
+
case _constants.SUPPORTED_REPORT_TYPES.HTML:
|
|
19
|
+
return new _index.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 data = new _cacheData.default(_cache.default.getData());
|
|
27
|
+
const reportTime = new Date(_config.default.getLastRunTimeStamp()).toLocaleString();
|
|
28
|
+
const appName = (0, _runtime.getRootProjectName)();
|
|
29
|
+
const reportData = new _reportData.default({
|
|
30
|
+
data,
|
|
31
|
+
appName,
|
|
32
|
+
reportTime
|
|
33
|
+
});
|
|
34
|
+
builder.generate(reportData);
|
|
35
|
+
builder.export(path, name);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.default = ReportFactory;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _path = _interopRequireDefault(require("path"));
|
|
8
|
+
var _config = _interopRequireDefault(require("../lib/config.js"));
|
|
9
|
+
var _file = require("./file.js");
|
|
10
|
+
var _constants = require("../utils/constants.js");
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
class Reports {
|
|
13
|
+
static #baseReportPath;
|
|
14
|
+
static setup() {
|
|
15
|
+
const rootFolder = _path.default.resolve();
|
|
16
|
+
Reports.#baseReportPath = (0, _file.joinPaths)(rootFolder, 'l10nReports', Reports.#dateTime());
|
|
17
|
+
}
|
|
18
|
+
static reviewedReports(str = null, imgName = null) {
|
|
19
|
+
return Reports.#generateFullReportPath('reviewed', str, imgName);
|
|
20
|
+
}
|
|
21
|
+
static [_constants.I18N_STATUS.STRING_LOCALIZED](str, imgName) {
|
|
22
|
+
return Reports.#generateFullReportPath('string_localized', str, imgName);
|
|
23
|
+
}
|
|
24
|
+
static [_constants.I18N_STATUS.STRING_NOT_LOCALIZED](str, imgName) {
|
|
25
|
+
return Reports.#generateFullReportPath('string_not_localized', str, imgName);
|
|
26
|
+
}
|
|
27
|
+
static [_constants.I18N_STATUS.STRING_PARTIALLY_LOCALIZED](str, imgName) {
|
|
28
|
+
return Reports.#generateFullReportPath('string_partially_localized', str, imgName);
|
|
29
|
+
}
|
|
30
|
+
static [_constants.I18N_STATUS.DNT](str, imgName) {
|
|
31
|
+
return Reports.#generateFullReportPath('dnt', str, imgName);
|
|
32
|
+
}
|
|
33
|
+
static [_constants.I18N_STATUS.IGNORE](str, imgName) {
|
|
34
|
+
return Reports.#generateFullReportPath('ignored', str, imgName);
|
|
35
|
+
}
|
|
36
|
+
static [_constants.I18N_STATUS.AUTO_IGNORE](str, imgName) {
|
|
37
|
+
return Reports.#generateFullReportPath('auto_ignored', str, imgName);
|
|
38
|
+
}
|
|
39
|
+
static [_constants.I18N_STATUS.UNTRANSLATED](str, imgName) {
|
|
40
|
+
return Reports.#generateFullReportPath('un_translated', str, imgName);
|
|
41
|
+
}
|
|
42
|
+
static [_constants.I18N_STATUS.ENCODING_ISSUE](str, imgName) {
|
|
43
|
+
return Reports.#generateFullReportPath('encoding_issue', str, imgName);
|
|
44
|
+
}
|
|
45
|
+
static [_constants.I18N_STATUS.DATE_TIME_LOCALIZED](str, imgName) {
|
|
46
|
+
return Reports.#generateFullReportPath('date_time_localized', str, imgName);
|
|
47
|
+
}
|
|
48
|
+
static [_constants.I18N_STATUS.DATE_TIME_NOT_LOCALIZED](str, imgName) {
|
|
49
|
+
return Reports.#generateFullReportPath('date_time_not_localized', str, imgName);
|
|
50
|
+
}
|
|
51
|
+
static [_constants.I18N_STATUS.DATE_LOCALIZED](str, imgName) {
|
|
52
|
+
return Reports.#generateFullReportPath('date_localized', str, imgName);
|
|
53
|
+
}
|
|
54
|
+
static [_constants.I18N_STATUS.DATE_NOT_LOCALIZED](str, imgName) {
|
|
55
|
+
return Reports.#generateFullReportPath('date_not_localized', str, imgName);
|
|
56
|
+
}
|
|
57
|
+
static [_constants.I18N_STATUS.TIME_LOCALIZED](str, imgName) {
|
|
58
|
+
return Reports.#generateFullReportPath('time_localized', str, imgName);
|
|
59
|
+
}
|
|
60
|
+
static [_constants.I18N_STATUS.TIME_NOT_LOCALIZED](str, imgName) {
|
|
61
|
+
return Reports.#generateFullReportPath('time_not_localized', str, imgName);
|
|
62
|
+
}
|
|
63
|
+
static [_constants.I18N_STATUS.CURRENCY_LOCALIZED](str, imgName) {
|
|
64
|
+
return Reports.#generateFullReportPath('currency_localized', str, imgName);
|
|
65
|
+
}
|
|
66
|
+
static [_constants.I18N_STATUS.CURRENCY_NOT_LOCALIZED](str, imgName) {
|
|
67
|
+
return Reports.#generateFullReportPath('currency_not_localized', str, imgName);
|
|
68
|
+
}
|
|
69
|
+
static [_constants.I18N_STATUS.PERCENTAGE_LOCALIZED](str, imgName) {
|
|
70
|
+
return Reports.#generateFullReportPath('percentage_localized', str, imgName);
|
|
71
|
+
}
|
|
72
|
+
static [_constants.I18N_STATUS.PERCENTAGE_NOT_LOCALIZED](str, imgName) {
|
|
73
|
+
return Reports.#generateFullReportPath('percentage_not_localized', str, imgName);
|
|
74
|
+
}
|
|
75
|
+
static [_constants.I18N_STATUS.NUMBER_LOCALIZED](str, imgName) {
|
|
76
|
+
return Reports.#generateFullReportPath('number_localized', str, imgName);
|
|
77
|
+
}
|
|
78
|
+
static [_constants.I18N_STATUS.NUMBER_NOT_LOCALIZED](str, imgName) {
|
|
79
|
+
return Reports.#generateFullReportPath('number_not_localized', str, imgName);
|
|
80
|
+
}
|
|
81
|
+
static incrementCount(propertyName) {
|
|
82
|
+
if (_constants.REPORT_COUNTS.hasOwnProperty(propertyName)) {
|
|
83
|
+
_constants.REPORT_COUNTS[propertyName]++;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
static #dateTime() {
|
|
87
|
+
const now = new Date();
|
|
88
|
+
const year = now.getFullYear();
|
|
89
|
+
const month = String(now.getMonth() + 1).padStart(2, '0');
|
|
90
|
+
const day = String(now.getDate()).padStart(2, '0');
|
|
91
|
+
const hours = String(now.getHours()).padStart(2, '0');
|
|
92
|
+
const minutes = String(now.getMinutes()).padStart(2, '0');
|
|
93
|
+
const timeStamp = `${year}-${month}-${day}-${hours}-${minutes}`;
|
|
94
|
+
return timeStamp;
|
|
95
|
+
}
|
|
96
|
+
static #generateFullReportPath = (type, str, imgName) => {
|
|
97
|
+
const _screenshotPath = (0, _file.joinPaths)(Reports.#baseReportPath, _config.default.getLocale(), 'screenshots', type);
|
|
98
|
+
(0, _file.ensureDirectoryExists)(_screenshotPath, _constants.DEBUG_MODE);
|
|
99
|
+
const _stringsPath = (0, _file.joinPaths)(Reports.#baseReportPath, _config.default.getLocale(), 'strings');
|
|
100
|
+
(0, _file.ensureDirectoryExists)(_stringsPath, _constants.DEBUG_MODE);
|
|
101
|
+
if (str !== null && str !== undefined) {
|
|
102
|
+
let content = '';
|
|
103
|
+
if ((0, _file.pathExists)((0, _file.joinPaths)(_stringsPath, type + '.txt'))) {
|
|
104
|
+
const existingContent = (0, _file.getFileContent)((0, _file.joinPaths)(_stringsPath, type + '.txt'));
|
|
105
|
+
if (existingContent.includes(imgName)) {
|
|
106
|
+
content += str;
|
|
107
|
+
} else {
|
|
108
|
+
content += `\n|<<<<<<<<<<<<<------${imgName}------>>>>>>>>>>>>>|\n`;
|
|
109
|
+
content += str;
|
|
110
|
+
}
|
|
111
|
+
} else {
|
|
112
|
+
content += `\n|<<<<<<<<<<<<<------${imgName}------>>>>>>>>>>>>>|\n`;
|
|
113
|
+
content += str;
|
|
114
|
+
}
|
|
115
|
+
(0, _file.addContentToFile)((0, _file.joinPaths)(_stringsPath, type + '.txt'), content);
|
|
116
|
+
}
|
|
117
|
+
return _screenshotPath;
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
exports.default = Reports;
|
|
@@ -0,0 +1,71 @@
|
|
|
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 _consoleTablePrinter = require("console-table-printer");
|
|
9
|
+
var _logs = _interopRequireDefault(require("./logs.js"));
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
const column1 = 'STATUS';
|
|
12
|
+
const column2 = 'COUNTS';
|
|
13
|
+
class GenerateReportTable {
|
|
14
|
+
static #printer = new _consoleTablePrinter.Table({
|
|
15
|
+
style: {
|
|
16
|
+
headerTop: {
|
|
17
|
+
left: '\u001B[94m╔\x1b[0m',
|
|
18
|
+
mid: '\u001B[94m╦\x1b[0m',
|
|
19
|
+
right: '\u001B[94m╗\x1b[0m',
|
|
20
|
+
other: '\u001B[94m═'
|
|
21
|
+
},
|
|
22
|
+
headerBottom: {
|
|
23
|
+
left: '\u001B[94m╟\x1b[0m',
|
|
24
|
+
mid: '\u001B[94m╬\x1b[0m',
|
|
25
|
+
right: '\u001B[94m╢\x1b[0m',
|
|
26
|
+
other: '\u001B[94m═'
|
|
27
|
+
},
|
|
28
|
+
tableBottom: {
|
|
29
|
+
left: '\u001B[94m╚\x1b[0m',
|
|
30
|
+
mid: '\u001B[94m╩\x1b[0m',
|
|
31
|
+
right: '\u001B[94m╝\x1b[0m',
|
|
32
|
+
other: '\u001B[94m═\x1b[0m'
|
|
33
|
+
},
|
|
34
|
+
vertical: '\u001B[94m║\x1b[0m'
|
|
35
|
+
},
|
|
36
|
+
columns: [{
|
|
37
|
+
name: column1,
|
|
38
|
+
alignment: 'left'
|
|
39
|
+
}, {
|
|
40
|
+
name: column2,
|
|
41
|
+
alignment: 'center'
|
|
42
|
+
}]
|
|
43
|
+
});
|
|
44
|
+
static generateTable() {
|
|
45
|
+
if (_constants.REPORT_COUNTS[_constants.I18N_STATUS.REVIEWED] === 0) {
|
|
46
|
+
_logs.default.info('There are no visbile elements with UI strings');
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
for (const key in _constants.REPORT_COUNTS) {
|
|
50
|
+
if (key !== _constants.I18N_STATUS.REVIEWED) {
|
|
51
|
+
if (_constants.REPORT_COUNTS.hasOwnProperty(key)) {
|
|
52
|
+
GenerateReportTable.#printer.addRows([{
|
|
53
|
+
STATUS: key,
|
|
54
|
+
COUNTS: `${_constants.REPORT_COUNTS[key]}`
|
|
55
|
+
}]);
|
|
56
|
+
}
|
|
57
|
+
} else {
|
|
58
|
+
GenerateReportTable.#printer.addRows([{
|
|
59
|
+
STATUS: '\u001B[94m' + '═'.repeat(28) + '\x1b[0m',
|
|
60
|
+
COUNTS: '\u001B[94m' + '═'.repeat(8) + '\x1b[0m'
|
|
61
|
+
}]);
|
|
62
|
+
GenerateReportTable.#printer.addRows([{
|
|
63
|
+
STATUS: 'OVERALL_REVIEWED',
|
|
64
|
+
COUNTS: `${_constants.REPORT_COUNTS[key]}`
|
|
65
|
+
}]);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
GenerateReportTable.#printer.printTable();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
exports.default = GenerateReportTable;
|
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
var _logs = _interopRequireDefault(require("../utils/logs.js"));
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
class Resource {
|
|
13
|
+
static load() {
|
|
14
|
+
const bundle = {};
|
|
15
|
+
if (_config.default.getOptions()?.l10nResourcePath) {
|
|
16
|
+
const resourcePath = (0, _file.joinPaths)(process.cwd(), _config.default.getOptions()?.l10nResourcePath);
|
|
17
|
+
if ((0, _file.fileExists)(resourcePath)) {
|
|
18
|
+
Resource.#processFile(resourcePath, bundle);
|
|
19
|
+
} else if ((0, _file.dirExists)(resourcePath)) {
|
|
20
|
+
for (const file of (0, _file.getDirContents)(resourcePath)) {
|
|
21
|
+
const filePath = (0, _file.joinPaths)(resourcePath, file);
|
|
22
|
+
Resource.#processFile(filePath, bundle);
|
|
23
|
+
}
|
|
24
|
+
} else {
|
|
25
|
+
_logs.default.error(`${resourcePath} invalid resource path`);
|
|
26
|
+
return; // throw runtime error
|
|
27
|
+
}
|
|
28
|
+
_config.default.setResourceBundle(bundle);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
static #processFile(filePath, bundle) {
|
|
32
|
+
const locale = _config.default.getLocale(),
|
|
33
|
+
defaultLocale = _config.default.getDefaultLocale(),
|
|
34
|
+
fileContent = (0, _file.getFileContent)(filePath),
|
|
35
|
+
ext = (0, _file.getFileExtenstion)(filePath);
|
|
36
|
+
if (_constants.RES_FILE_EXTENSIONS.includes(ext)) {
|
|
37
|
+
if (!fileContent) {
|
|
38
|
+
_logs.default.error(`${filePath} is empty or invalid`);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (filePath.toLowerCase().includes('dnt')) {
|
|
42
|
+
bundle['dnt'] = fileContent.split(/\r?\n/);
|
|
43
|
+
} else if (filePath.toLowerCase().includes('ignore')) {
|
|
44
|
+
bundle['ignore'] = fileContent.split(/\r?\n/);
|
|
45
|
+
// TODO: add locale validations for the following cases
|
|
46
|
+
} else if (filePath.includes(locale)) {
|
|
47
|
+
bundle[locale] = fileContent.split(/\r?\n/);
|
|
48
|
+
} else if (filePath.includes(defaultLocale)) {
|
|
49
|
+
bundle[defaultLocale] = fileContent.split(/\r?\n/);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.default = Resource;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.loadDependencies = void 0;
|
|
7
|
+
var _index = _interopRequireDefault(require("../lib/validator/index.js"));
|
|
8
|
+
var _reports = _interopRequireDefault(require("./reports.js"));
|
|
9
|
+
var _resource = _interopRequireDefault(require("./resource.js"));
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
const loadDependencies = () => {
|
|
12
|
+
_resource.default.load();
|
|
13
|
+
_index.default.load();
|
|
14
|
+
_reports.default.setup();
|
|
15
|
+
};
|
|
16
|
+
exports.loadDependencies = loadDependencies;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _configFile = require("../configFile.js");
|
|
4
|
+
var _constants = require("../constants.js");
|
|
5
|
+
var _file = require("../file.js");
|
|
6
|
+
const projectDir = (0, _file.joinPaths)(process.cwd(), '..', '..', '..');
|
|
7
|
+
const packageJson = (0, _file.getFileContent)((0, _file.joinPaths)(projectDir, 'package.json'));
|
|
8
|
+
let type = '';
|
|
9
|
+
if (packageJson) {
|
|
10
|
+
if (packageJson.includes('"nightwatch"')) {
|
|
11
|
+
type = _constants.SYSTEM_TYPES.NIGHT_WATCH;
|
|
12
|
+
} else if (packageJson.includes('"cypress"')) {
|
|
13
|
+
type = _constants.SYSTEM_TYPES.CYPRESS;
|
|
14
|
+
} else if (packageJson.includes('"@wdio"') || packageJson.includes('@wdio')) {
|
|
15
|
+
type = _constants.SYSTEM_TYPES.WEB_DRIVER_IO;
|
|
16
|
+
} else if (packageJson.includes('"selenium-webdriver"')) {
|
|
17
|
+
type = _constants.SYSTEM_TYPES.SELENIUMJS;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
(0, _configFile.checkAndExportConfig)((0, _file.joinPaths)(projectDir, _constants.CONFIG_FILE_NAME), type);
|
|
21
|
+
console.log(`Added ${_constants.CONFIG_FILE_NAME} to project root directory. Please use the file to configure i18n verification!`);
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@zeesoft/i18n-verify",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Library to perform I18n verification over Nightwatch or WebdriverIO frameworks",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"require": "./dist/index.js",
|
|
9
|
+
"import": "./dist/index.js"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "babel src -d dist --delete-dir-on-start --copy-files",
|
|
14
|
+
"prepack": "npm run build",
|
|
15
|
+
"postinstall": "node dist/utils/scripts/postinstall.js"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"readme.md"
|
|
20
|
+
],
|
|
21
|
+
"keywords": [
|
|
22
|
+
"Zeesoft",
|
|
23
|
+
"Internationalization",
|
|
24
|
+
"Internationalization Verification",
|
|
25
|
+
"I18n",
|
|
26
|
+
"I18n Verification",
|
|
27
|
+
"I18n Automation",
|
|
28
|
+
"I18n Report"
|
|
29
|
+
],
|
|
30
|
+
"author": "Jitendra Maheshwari<jm@zeesoft.com>",
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=16"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@babel/cli": "^7.17.0",
|
|
37
|
+
"@babel/core": "^7.17.0",
|
|
38
|
+
"@babel/plugin-transform-modules-commonjs": "^7.17.0",
|
|
39
|
+
"@babel/preset-env": "^7.17.0"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"chrono-node": "^2.7.6",
|
|
43
|
+
"cldr-data": "^36.0.0",
|
|
44
|
+
"console-table-printer": "^2.12.0",
|
|
45
|
+
"global": "^4.4.0",
|
|
46
|
+
"globalize": "^1.7.0",
|
|
47
|
+
"jimp": "^0.22.12",
|
|
48
|
+
"luxon": "^3.4.4",
|
|
49
|
+
"tinyld": "^1.3.4"
|
|
50
|
+
},
|
|
51
|
+
"repository": {
|
|
52
|
+
"type": "git",
|
|
53
|
+
"url": "git+https://gitlab.com/zeesoft/qa.git"
|
|
54
|
+
},
|
|
55
|
+
"bugs": {
|
|
56
|
+
"url": "https://gitlab.com/zeesoft/qa/issues"
|
|
57
|
+
},
|
|
58
|
+
"homepage": "https://gitlab.com/zeesoft/qa/-/blob/zlqa/i18n-verify/readme.md"
|
|
59
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
## i18n-verify library usage guide
|
|
2
|
+
|
|
3
|
+
- after installation, the library will auto create .i18nVerify.rc file with required conguration template
|
|
4
|
+
- you can configure the following properties
|
|
5
|
+
- `qaLocale` supply qa locale value if your application uses one
|
|
6
|
+
- `l10nResourcePath` directory of l10n resources which will be used by the library to perform i18n verification
|
|
7
|
+
- `defaultLocale` default locale of your application
|
|
8
|
+
- `qaMock` prefix and suffix characters used by qa locale
|
|
9
|
+
- `garbledChars` list of garbled characters which the library will use to skip while processing i18n verification
|
|
10
|
+
|
|
11
|
+
**TODO**
|
|
12
|
+
|
|
13
|
+
- [] modify .i18nVerify.rc property names to be more user friendly
|
|
14
|
+
- [] add support for html report
|
|
15
|
+
- [] add support for iframe strings capturing and highlighting
|