i18-fe-automator-beta 1.0.2 → 1.0.4
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/commonjs/index.js +71 -20
- package/dist/esm/index.mjs +71 -20
- package/package.json +2 -2
package/dist/commonjs/index.js
CHANGED
|
@@ -1317,8 +1317,16 @@ var noSingleCurrencyRule = {
|
|
|
1317
1317
|
/** @type {import('eslint').Rule.RuleModule} */
|
|
1318
1318
|
const tagNameList = ["hx-search-list-page", "HxSearchListPage"];
|
|
1319
1319
|
const attrNameList = ["custom-column-module", "customColumnModule"];
|
|
1320
|
-
const moduleArr =
|
|
1321
|
-
const getModuleArr = () =>
|
|
1320
|
+
const moduleArr = [];
|
|
1321
|
+
const getModuleArr = () => moduleArr;
|
|
1322
|
+
const addModule = (moduleObj) => {
|
|
1323
|
+
const isExist= moduleArr.some((item) => {
|
|
1324
|
+
return item.module === moduleObj.module
|
|
1325
|
+
});
|
|
1326
|
+
if(!isExist){
|
|
1327
|
+
moduleArr.push(moduleObj);
|
|
1328
|
+
}
|
|
1329
|
+
};
|
|
1322
1330
|
|
|
1323
1331
|
var noSingleCustomColumnModule = {
|
|
1324
1332
|
meta: {
|
|
@@ -1357,7 +1365,7 @@ var noSingleCustomColumnModule = {
|
|
|
1357
1365
|
attr.value?.expression?.type === "Literal"
|
|
1358
1366
|
) {
|
|
1359
1367
|
const value = attr.value.expression.value;
|
|
1360
|
-
|
|
1368
|
+
addModule({
|
|
1361
1369
|
module: value,
|
|
1362
1370
|
path: getPath(attr.loc),
|
|
1363
1371
|
});
|
|
@@ -1366,7 +1374,7 @@ var noSingleCustomColumnModule = {
|
|
|
1366
1374
|
attr.value.type === "VLiteral"
|
|
1367
1375
|
) {
|
|
1368
1376
|
const value = attr.value.value;
|
|
1369
|
-
|
|
1377
|
+
addModule({
|
|
1370
1378
|
module: +value,
|
|
1371
1379
|
path: getPath(attr.loc),
|
|
1372
1380
|
});
|
|
@@ -1374,7 +1382,7 @@ var noSingleCustomColumnModule = {
|
|
|
1374
1382
|
attrNameList.includes(attr.key?.argument?.rawName) ||
|
|
1375
1383
|
attrNameList.includes(attr.key?.rawName)
|
|
1376
1384
|
) {
|
|
1377
|
-
|
|
1385
|
+
addModule({
|
|
1378
1386
|
module: sourceCode.getText(attr.value.expression),
|
|
1379
1387
|
path: getPath(attr.loc),
|
|
1380
1388
|
isDynamics: true, // 变量
|
|
@@ -1397,12 +1405,12 @@ var noSingleCustomColumnModule = {
|
|
|
1397
1405
|
if (attrNameList.includes(attr?.name?.name)) {
|
|
1398
1406
|
if (attr.value?.expression?.type === "Literal") {
|
|
1399
1407
|
const value = attr.value.expression.value;
|
|
1400
|
-
|
|
1408
|
+
addModule({
|
|
1401
1409
|
module: value,
|
|
1402
1410
|
path: getPath(attr.loc),
|
|
1403
1411
|
});
|
|
1404
1412
|
} else {
|
|
1405
|
-
|
|
1413
|
+
addModule({
|
|
1406
1414
|
module: sourceCode.getText(attr.value.expression),
|
|
1407
1415
|
path: getPath(attr.loc),
|
|
1408
1416
|
isDynamics: true, // 变量
|
|
@@ -1412,11 +1420,40 @@ var noSingleCustomColumnModule = {
|
|
|
1412
1420
|
});
|
|
1413
1421
|
}
|
|
1414
1422
|
},
|
|
1423
|
+
// $customColumnDialog
|
|
1424
|
+
CallExpression(node) {
|
|
1425
|
+
if (node.callee?.property?.name === "$customColumnDialog") {
|
|
1426
|
+
const property = node.arguments[0]?.properties[0];
|
|
1427
|
+
if (property.key.name === "module") {
|
|
1428
|
+
if (property.value.type === "Literal") {
|
|
1429
|
+
addModule({
|
|
1430
|
+
module: property.value.value,
|
|
1431
|
+
path: getPath(property.loc),
|
|
1432
|
+
});
|
|
1433
|
+
} else if (property.value.type === "ConditionalExpression") {
|
|
1434
|
+
getConditionValue(property.value.consequent, moduleArr,getPath);
|
|
1435
|
+
getConditionValue(property.value.alternate, moduleArr,getPath);
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1438
|
+
}
|
|
1439
|
+
},
|
|
1415
1440
|
}
|
|
1416
1441
|
);
|
|
1417
1442
|
},
|
|
1418
1443
|
};
|
|
1419
1444
|
|
|
1445
|
+
function getConditionValue(node, moduleArr,getPath) {
|
|
1446
|
+
if (node.type === "Literal") {
|
|
1447
|
+
addModule({
|
|
1448
|
+
module: node.value,
|
|
1449
|
+
path: getPath(node.loc),
|
|
1450
|
+
});
|
|
1451
|
+
}else if (node.type === "ConditionalExpression") {
|
|
1452
|
+
getConditionValue(node.consequent, moduleArr,getPath);
|
|
1453
|
+
getConditionValue(node.alternate, moduleArr,getPath);
|
|
1454
|
+
}
|
|
1455
|
+
}
|
|
1456
|
+
|
|
1420
1457
|
/**
|
|
1421
1458
|
* @fileoverview 国际化
|
|
1422
1459
|
* @author ypf
|
|
@@ -1746,7 +1783,7 @@ async function customColumnModule (lintc, fix, rule, parentRule) {
|
|
|
1746
1783
|
type: "list",
|
|
1747
1784
|
choices: [
|
|
1748
1785
|
{
|
|
1749
|
-
name: "自动检测HxSearchListPage的自定义列ID",
|
|
1786
|
+
name: "自动检测HxSearchListPage、this.$customColumnDialog的自定义列ID",
|
|
1750
1787
|
value: "normal",
|
|
1751
1788
|
},
|
|
1752
1789
|
{
|
|
@@ -1764,7 +1801,7 @@ async function customColumnModule (lintc, fix, rule, parentRule) {
|
|
|
1764
1801
|
const normalArr = arr.filter((item) => !item.isDynamics);
|
|
1765
1802
|
|
|
1766
1803
|
return new Promise((resolve) => {
|
|
1767
|
-
Loading.succeed(`检测完成,${arr.length?
|
|
1804
|
+
Loading.succeed(`检测完成,${arr.length ? "" : "未"}匹配到规则`);
|
|
1768
1805
|
if (arr.length) {
|
|
1769
1806
|
getColumn(normalArr, dynamicsArr, parentRule);
|
|
1770
1807
|
}
|
|
@@ -1789,7 +1826,7 @@ async function customColumnModule (lintc, fix, rule, parentRule) {
|
|
|
1789
1826
|
}
|
|
1790
1827
|
}
|
|
1791
1828
|
|
|
1792
|
-
async function getColumn(moduleArr = [], dynamicsArr = [],parentRule) {
|
|
1829
|
+
async function getColumn(moduleArr = [], dynamicsArr = [], parentRule) {
|
|
1793
1830
|
const token = await login({
|
|
1794
1831
|
env: "sit",
|
|
1795
1832
|
username: "superAdmin",
|
|
@@ -1866,42 +1903,56 @@ async function getColumn(moduleArr = [], dynamicsArr = [],parentRule) {
|
|
|
1866
1903
|
return 1;
|
|
1867
1904
|
}
|
|
1868
1905
|
});
|
|
1869
|
-
const
|
|
1906
|
+
const successModuleArr = new Set();
|
|
1907
|
+
|
|
1870
1908
|
const naTableData = [];
|
|
1909
|
+
const naModuleArr = new Set();
|
|
1910
|
+
|
|
1871
1911
|
const noNaTableData = [];
|
|
1912
|
+
const noNaModuleArr = new Set();
|
|
1913
|
+
|
|
1872
1914
|
const errorTableData = []; // 失败的数据
|
|
1915
|
+
const errorModuleArr = new Set();
|
|
1916
|
+
|
|
1873
1917
|
tableData.forEach((item) => {
|
|
1874
1918
|
if (item.field === "error") {
|
|
1875
1919
|
errorTableData.push(item);
|
|
1920
|
+
item.module && errorModuleArr.add(item.module);
|
|
1876
1921
|
} else {
|
|
1877
1922
|
if (item.field === "NA") {
|
|
1878
1923
|
naTableData.push(item);
|
|
1924
|
+
item.module &&naModuleArr.add(item.module);
|
|
1879
1925
|
} else {
|
|
1880
1926
|
noNaTableData.push(item);
|
|
1927
|
+
item.module &&noNaModuleArr.add(item.module);
|
|
1881
1928
|
}
|
|
1882
|
-
|
|
1929
|
+
item.module &&successModuleArr.add(item.module);
|
|
1883
1930
|
}
|
|
1884
1931
|
});
|
|
1885
1932
|
|
|
1886
1933
|
console.log(
|
|
1887
1934
|
chalk.green(
|
|
1888
|
-
`共${
|
|
1889
|
-
|
|
1890
|
-
}个(
|
|
1891
|
-
`未命中${
|
|
1935
|
+
`共${moduleArr.length + dynamicsArr.length}个moduleId, 请求成功${
|
|
1936
|
+
successModuleArr.size
|
|
1937
|
+
}个(其中规则命中${noNaModuleArr.size}个, ${chalk.yellow(
|
|
1938
|
+
`未命中${naModuleArr.size}个`
|
|
1892
1939
|
)}),`
|
|
1893
|
-
) + chalk.red(
|
|
1940
|
+
) + chalk.red(`请求失败${errorModuleArr.size}个`)
|
|
1894
1941
|
);
|
|
1942
|
+
console.log(chalk.green(`🚀🚀🚀🚀🚀共匹配到${noNaTableData.length+errorTableData.length}个字段🚀🚀🚀🚀🚀`));
|
|
1943
|
+
|
|
1895
1944
|
if (noNaTableData.length) {
|
|
1896
|
-
console.log(chalk.green(
|
|
1945
|
+
console.log(chalk.green(`成功命中字段${noNaTableData.length}个`));
|
|
1897
1946
|
console.table(noNaTableData);
|
|
1898
1947
|
}
|
|
1899
1948
|
if (errorTableData.length) {
|
|
1900
|
-
console.log(chalk.red(
|
|
1949
|
+
console.log(chalk.red(`失败,需手动处理或重试${errorTableData.length}个`));
|
|
1901
1950
|
console.table(errorTableData);
|
|
1902
1951
|
}
|
|
1903
1952
|
if (naTableData.length) {
|
|
1904
|
-
console.log(
|
|
1953
|
+
console.log(
|
|
1954
|
+
chalk.yellow(`成功但未命中字段,无需处理${naTableData.length}个`)
|
|
1955
|
+
);
|
|
1905
1956
|
console.table(naTableData);
|
|
1906
1957
|
}
|
|
1907
1958
|
});
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1295,8 +1295,16 @@ var noSingleCurrencyRule = {
|
|
|
1295
1295
|
/** @type {import('eslint').Rule.RuleModule} */
|
|
1296
1296
|
const tagNameList = ["hx-search-list-page", "HxSearchListPage"];
|
|
1297
1297
|
const attrNameList = ["custom-column-module", "customColumnModule"];
|
|
1298
|
-
const moduleArr =
|
|
1299
|
-
const getModuleArr = () =>
|
|
1298
|
+
const moduleArr = [];
|
|
1299
|
+
const getModuleArr = () => moduleArr;
|
|
1300
|
+
const addModule = (moduleObj) => {
|
|
1301
|
+
const isExist= moduleArr.some((item) => {
|
|
1302
|
+
return item.module === moduleObj.module
|
|
1303
|
+
});
|
|
1304
|
+
if(!isExist){
|
|
1305
|
+
moduleArr.push(moduleObj);
|
|
1306
|
+
}
|
|
1307
|
+
};
|
|
1300
1308
|
|
|
1301
1309
|
var noSingleCustomColumnModule = {
|
|
1302
1310
|
meta: {
|
|
@@ -1335,7 +1343,7 @@ var noSingleCustomColumnModule = {
|
|
|
1335
1343
|
attr.value?.expression?.type === "Literal"
|
|
1336
1344
|
) {
|
|
1337
1345
|
const value = attr.value.expression.value;
|
|
1338
|
-
|
|
1346
|
+
addModule({
|
|
1339
1347
|
module: value,
|
|
1340
1348
|
path: getPath(attr.loc),
|
|
1341
1349
|
});
|
|
@@ -1344,7 +1352,7 @@ var noSingleCustomColumnModule = {
|
|
|
1344
1352
|
attr.value.type === "VLiteral"
|
|
1345
1353
|
) {
|
|
1346
1354
|
const value = attr.value.value;
|
|
1347
|
-
|
|
1355
|
+
addModule({
|
|
1348
1356
|
module: +value,
|
|
1349
1357
|
path: getPath(attr.loc),
|
|
1350
1358
|
});
|
|
@@ -1352,7 +1360,7 @@ var noSingleCustomColumnModule = {
|
|
|
1352
1360
|
attrNameList.includes(attr.key?.argument?.rawName) ||
|
|
1353
1361
|
attrNameList.includes(attr.key?.rawName)
|
|
1354
1362
|
) {
|
|
1355
|
-
|
|
1363
|
+
addModule({
|
|
1356
1364
|
module: sourceCode.getText(attr.value.expression),
|
|
1357
1365
|
path: getPath(attr.loc),
|
|
1358
1366
|
isDynamics: true, // 变量
|
|
@@ -1375,12 +1383,12 @@ var noSingleCustomColumnModule = {
|
|
|
1375
1383
|
if (attrNameList.includes(attr?.name?.name)) {
|
|
1376
1384
|
if (attr.value?.expression?.type === "Literal") {
|
|
1377
1385
|
const value = attr.value.expression.value;
|
|
1378
|
-
|
|
1386
|
+
addModule({
|
|
1379
1387
|
module: value,
|
|
1380
1388
|
path: getPath(attr.loc),
|
|
1381
1389
|
});
|
|
1382
1390
|
} else {
|
|
1383
|
-
|
|
1391
|
+
addModule({
|
|
1384
1392
|
module: sourceCode.getText(attr.value.expression),
|
|
1385
1393
|
path: getPath(attr.loc),
|
|
1386
1394
|
isDynamics: true, // 变量
|
|
@@ -1390,11 +1398,40 @@ var noSingleCustomColumnModule = {
|
|
|
1390
1398
|
});
|
|
1391
1399
|
}
|
|
1392
1400
|
},
|
|
1401
|
+
// $customColumnDialog
|
|
1402
|
+
CallExpression(node) {
|
|
1403
|
+
if (node.callee?.property?.name === "$customColumnDialog") {
|
|
1404
|
+
const property = node.arguments[0]?.properties[0];
|
|
1405
|
+
if (property.key.name === "module") {
|
|
1406
|
+
if (property.value.type === "Literal") {
|
|
1407
|
+
addModule({
|
|
1408
|
+
module: property.value.value,
|
|
1409
|
+
path: getPath(property.loc),
|
|
1410
|
+
});
|
|
1411
|
+
} else if (property.value.type === "ConditionalExpression") {
|
|
1412
|
+
getConditionValue(property.value.consequent, moduleArr,getPath);
|
|
1413
|
+
getConditionValue(property.value.alternate, moduleArr,getPath);
|
|
1414
|
+
}
|
|
1415
|
+
}
|
|
1416
|
+
}
|
|
1417
|
+
},
|
|
1393
1418
|
}
|
|
1394
1419
|
);
|
|
1395
1420
|
},
|
|
1396
1421
|
};
|
|
1397
1422
|
|
|
1423
|
+
function getConditionValue(node, moduleArr,getPath) {
|
|
1424
|
+
if (node.type === "Literal") {
|
|
1425
|
+
addModule({
|
|
1426
|
+
module: node.value,
|
|
1427
|
+
path: getPath(node.loc),
|
|
1428
|
+
});
|
|
1429
|
+
}else if (node.type === "ConditionalExpression") {
|
|
1430
|
+
getConditionValue(node.consequent, moduleArr,getPath);
|
|
1431
|
+
getConditionValue(node.alternate, moduleArr,getPath);
|
|
1432
|
+
}
|
|
1433
|
+
}
|
|
1434
|
+
|
|
1398
1435
|
/**
|
|
1399
1436
|
* @fileoverview 国际化
|
|
1400
1437
|
* @author ypf
|
|
@@ -1724,7 +1761,7 @@ async function customColumnModule (lintc, fix, rule, parentRule) {
|
|
|
1724
1761
|
type: "list",
|
|
1725
1762
|
choices: [
|
|
1726
1763
|
{
|
|
1727
|
-
name: "自动检测HxSearchListPage的自定义列ID",
|
|
1764
|
+
name: "自动检测HxSearchListPage、this.$customColumnDialog的自定义列ID",
|
|
1728
1765
|
value: "normal",
|
|
1729
1766
|
},
|
|
1730
1767
|
{
|
|
@@ -1742,7 +1779,7 @@ async function customColumnModule (lintc, fix, rule, parentRule) {
|
|
|
1742
1779
|
const normalArr = arr.filter((item) => !item.isDynamics);
|
|
1743
1780
|
|
|
1744
1781
|
return new Promise((resolve) => {
|
|
1745
|
-
Loading.succeed(`检测完成,${arr.length?
|
|
1782
|
+
Loading.succeed(`检测完成,${arr.length ? "" : "未"}匹配到规则`);
|
|
1746
1783
|
if (arr.length) {
|
|
1747
1784
|
getColumn(normalArr, dynamicsArr, parentRule);
|
|
1748
1785
|
}
|
|
@@ -1767,7 +1804,7 @@ async function customColumnModule (lintc, fix, rule, parentRule) {
|
|
|
1767
1804
|
}
|
|
1768
1805
|
}
|
|
1769
1806
|
|
|
1770
|
-
async function getColumn(moduleArr = [], dynamicsArr = [],parentRule) {
|
|
1807
|
+
async function getColumn(moduleArr = [], dynamicsArr = [], parentRule) {
|
|
1771
1808
|
const token = await login({
|
|
1772
1809
|
env: "sit",
|
|
1773
1810
|
username: "superAdmin",
|
|
@@ -1844,42 +1881,56 @@ async function getColumn(moduleArr = [], dynamicsArr = [],parentRule) {
|
|
|
1844
1881
|
return 1;
|
|
1845
1882
|
}
|
|
1846
1883
|
});
|
|
1847
|
-
const
|
|
1884
|
+
const successModuleArr = new Set();
|
|
1885
|
+
|
|
1848
1886
|
const naTableData = [];
|
|
1887
|
+
const naModuleArr = new Set();
|
|
1888
|
+
|
|
1849
1889
|
const noNaTableData = [];
|
|
1890
|
+
const noNaModuleArr = new Set();
|
|
1891
|
+
|
|
1850
1892
|
const errorTableData = []; // 失败的数据
|
|
1893
|
+
const errorModuleArr = new Set();
|
|
1894
|
+
|
|
1851
1895
|
tableData.forEach((item) => {
|
|
1852
1896
|
if (item.field === "error") {
|
|
1853
1897
|
errorTableData.push(item);
|
|
1898
|
+
item.module && errorModuleArr.add(item.module);
|
|
1854
1899
|
} else {
|
|
1855
1900
|
if (item.field === "NA") {
|
|
1856
1901
|
naTableData.push(item);
|
|
1902
|
+
item.module &&naModuleArr.add(item.module);
|
|
1857
1903
|
} else {
|
|
1858
1904
|
noNaTableData.push(item);
|
|
1905
|
+
item.module &&noNaModuleArr.add(item.module);
|
|
1859
1906
|
}
|
|
1860
|
-
|
|
1907
|
+
item.module &&successModuleArr.add(item.module);
|
|
1861
1908
|
}
|
|
1862
1909
|
});
|
|
1863
1910
|
|
|
1864
1911
|
console.log(
|
|
1865
1912
|
chalk.green(
|
|
1866
|
-
`共${
|
|
1867
|
-
|
|
1868
|
-
}个(
|
|
1869
|
-
`未命中${
|
|
1913
|
+
`共${moduleArr.length + dynamicsArr.length}个moduleId, 请求成功${
|
|
1914
|
+
successModuleArr.size
|
|
1915
|
+
}个(其中规则命中${noNaModuleArr.size}个, ${chalk.yellow(
|
|
1916
|
+
`未命中${naModuleArr.size}个`
|
|
1870
1917
|
)}),`
|
|
1871
|
-
) + chalk.red(
|
|
1918
|
+
) + chalk.red(`请求失败${errorModuleArr.size}个`)
|
|
1872
1919
|
);
|
|
1920
|
+
console.log(chalk.green(`🚀🚀🚀🚀🚀共匹配到${noNaTableData.length+errorTableData.length}个字段🚀🚀🚀🚀🚀`));
|
|
1921
|
+
|
|
1873
1922
|
if (noNaTableData.length) {
|
|
1874
|
-
console.log(chalk.green(
|
|
1923
|
+
console.log(chalk.green(`成功命中字段${noNaTableData.length}个`));
|
|
1875
1924
|
console.table(noNaTableData);
|
|
1876
1925
|
}
|
|
1877
1926
|
if (errorTableData.length) {
|
|
1878
|
-
console.log(chalk.red(
|
|
1927
|
+
console.log(chalk.red(`失败,需手动处理或重试${errorTableData.length}个`));
|
|
1879
1928
|
console.table(errorTableData);
|
|
1880
1929
|
}
|
|
1881
1930
|
if (naTableData.length) {
|
|
1882
|
-
console.log(
|
|
1931
|
+
console.log(
|
|
1932
|
+
chalk.yellow(`成功但未命中字段,无需处理${naTableData.length}个`)
|
|
1933
|
+
);
|
|
1883
1934
|
console.table(naTableData);
|
|
1884
1935
|
}
|
|
1885
1936
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "i18-fe-automator-beta",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "i18-fe-automator-beta内测版本,只用于key: ''替换、检测中文规则等",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"eslint": "^8.57.0",
|
|
30
30
|
"espree": "9.6.1",
|
|
31
31
|
"glob": "^10.3.10",
|
|
32
|
-
"inquirer": "
|
|
32
|
+
"inquirer": "8.2.6",
|
|
33
33
|
"js-md5": "^0.8.3",
|
|
34
34
|
"lodash": "^4.17.21",
|
|
35
35
|
"nanoid": "3.3.7",
|