2 Commits

Author SHA1 Message Date
Vick Scarlet
44e05a166e update xlsxTransform 2021-09-09 13:24:40 +08:00
Vick Scarlet
3a9149e9a4 update data 2021-09-09 10:24:46 +08:00
13 changed files with 717 additions and 594 deletions

View File

@@ -1700,7 +1700,8 @@
"11453*99999999999999999", "11453*99999999999999999",
"11455*33333333333333333", "11455*33333333333333333",
"11456*33333333333333333", "11456*33333333333333333",
"11457*33333333333333333" "11457*33333333333333333",
"21015*0.2"
] ]
}, },
"14": { "14": {
@@ -1917,7 +1918,8 @@
"11456*33333333333333333", "11456*33333333333333333",
"11457*33333333333333333", "11457*33333333333333333",
"11458*99999999999999999", "11458*99999999999999999",
"11459*99999999999999999" "11459*99999999999999999",
"21015*0.2"
] ]
}, },
"15": { "15": {
@@ -2147,7 +2149,8 @@
"11459*99999999999999999", "11459*99999999999999999",
"10944*9999999", "10944*9999999",
"10945*9999999", "10945*9999999",
"10946*9999999" "10946*9999999",
"21015*0.2"
] ]
}, },
"16": { "16": {
@@ -2386,7 +2389,8 @@
"11466*33333333333333333", "11466*33333333333333333",
"11467*33333333333333333", "11467*33333333333333333",
"11458*99999999999999999", "11458*99999999999999999",
"11459*99999999999999999" "11459*99999999999999999",
"21015*0.2"
] ]
}, },
"17": { "17": {
@@ -2635,7 +2639,8 @@
"11466*33333333333333333", "11466*33333333333333333",
"11467*33333333333333333", "11467*33333333333333333",
"11458*99999999999999999", "11458*99999999999999999",
"11459*99999999999999999" "11459*99999999999999999",
"21015*0.2"
] ]
}, },
"18": { "18": {
@@ -9714,7 +9719,9 @@
"11448*0.01", "11448*0.01",
"11449*0.01", "11449*0.01",
"11450*0.01", "11450*0.01",
"20567*0.02" "20567*0.02",
"11497*0.05",
"11498*0.05"
] ]
}, },
"48": { "48": {
@@ -10565,7 +10572,9 @@
"11448*0.05", "11448*0.05",
"11449*0.05", "11449*0.05",
"11450*0.05", "11450*0.05",
"20567*0.02" "20567*0.02",
"11497*0.05",
"11498*0.05"
] ]
}, },
"52": { "52": {
@@ -10766,7 +10775,9 @@
"11447*0.05", "11447*0.05",
"11448*0.05", "11448*0.05",
"11449*0.05", "11449*0.05",
"11450*0.05" "11450*0.05",
"11497*0.05",
"11498*0.05"
] ]
}, },
"53": { "53": {
@@ -10967,7 +10978,9 @@
"11448*0.05", "11448*0.05",
"11449*0.05", "11449*0.05",
"11450*0.05", "11450*0.05",
"20567*0.02" "20567*0.02",
"11497*0.05",
"11498*0.05"
] ]
}, },
"54": { "54": {
@@ -11167,7 +11180,9 @@
"11447*0.05", "11447*0.05",
"11448*0.05", "11448*0.05",
"11449*0.05", "11449*0.05",
"11450*0.05" "11450*0.05",
"11497*0.05",
"11498*0.05"
] ]
}, },
"55": { "55": {
@@ -11366,7 +11381,9 @@
"11471*0.1", "11471*0.1",
"11472*0.1", "11472*0.1",
"11473*0.1", "11473*0.1",
"11474*0.1" "11474*0.1",
"11497*0.05",
"11498*0.05"
] ]
}, },
"56": { "56": {
@@ -11556,7 +11573,9 @@
"11492*0.05", "11492*0.05",
"11493*0.05", "11493*0.05",
"11494*0.05", "11494*0.05",
"11495*0.05" "11495*0.05",
"11497*0.05",
"11498*0.05"
] ]
}, },
"57": { "57": {
@@ -11745,7 +11764,10 @@
"11492*0.05", "11492*0.05",
"11493*0.05", "11493*0.05",
"11494*0.05", "11494*0.05",
"11495*0.05" "11495*0.05",
"11496*0.1",
"11497*0.05",
"11498*0.05"
] ]
}, },
"58": { "58": {
@@ -11934,7 +11956,10 @@
"11492*0.05", "11492*0.05",
"11493*0.05", "11493*0.05",
"11494*0.05", "11494*0.05",
"11495*0.05" "11495*0.05",
"11496*0.1",
"11497*0.05",
"11498*0.05"
] ]
}, },
"59": { "59": {
@@ -12123,7 +12148,10 @@
"11492*0.05", "11492*0.05",
"11493*0.05", "11493*0.05",
"11494*0.05", "11494*0.05",
"11495*0.05" "11495*0.05",
"11496*0.1",
"11497*0.05",
"11498*0.05"
] ]
}, },
"60": { "60": {
@@ -12333,7 +12361,8 @@
"11480*0.05", "11480*0.05",
"11481*0.05", "11481*0.05",
"11482*0.05", "11482*0.05",
"11483*0.05" "11483*0.05",
"11496*0.1"
] ]
}, },
"61": { "61": {
@@ -12543,7 +12572,8 @@
"11480*0.05", "11480*0.05",
"11481*0.05", "11481*0.05",
"11482*0.05", "11482*0.05",
"11483*0.05" "11483*0.05",
"11496*0.1"
] ]
}, },
"62": { "62": {
@@ -12759,7 +12789,9 @@
"11492*0.05", "11492*0.05",
"11493*0.05", "11493*0.05",
"11494*0.05", "11494*0.05",
"11495*0.05" "11495*0.05",
"11497*0.05",
"11498*0.05"
] ]
}, },
"63": { "63": {
@@ -13197,7 +13229,9 @@
"11492*0.05", "11492*0.05",
"11493*0.05", "11493*0.05",
"11494*0.05", "11494*0.05",
"11495*0.05" "11495*0.05",
"11497*0.05",
"11498*0.05"
] ]
}, },
"65": { "65": {
@@ -13613,7 +13647,8 @@
"11480*0.05", "11480*0.05",
"11481*0.05", "11481*0.05",
"11482*0.05", "11482*0.05",
"11483*0.05" "11483*0.05",
"11496*0.1"
] ]
}, },
"67": { "67": {
@@ -13818,7 +13853,8 @@
"11480*0.05", "11480*0.05",
"11481*0.05", "11481*0.05",
"11482*0.05", "11482*0.05",
"11483*0.05" "11483*0.05",
"11496*0.1"
] ]
}, },
"68": { "68": {
@@ -14023,7 +14059,8 @@
"11480*0.05", "11480*0.05",
"11481*0.05", "11481*0.05",
"11482*0.05", "11482*0.05",
"11483*0.05" "11483*0.05",
"11496*0.1"
] ]
}, },
"69": { "69": {
@@ -14226,7 +14263,8 @@
"11480*0.05", "11480*0.05",
"11481*0.05", "11481*0.05",
"11482*0.05", "11482*0.05",
"11483*0.05" "11483*0.05",
"11496*0.1"
] ]
}, },
"70": { "70": {
@@ -14428,7 +14466,8 @@
"11480*0.05", "11480*0.05",
"11481*0.05", "11481*0.05",
"11482*0.05", "11482*0.05",
"11483*0.05" "11483*0.05",
"11496*0.1"
] ]
}, },
"71": { "71": {
@@ -14625,7 +14664,8 @@
"11480*0.05", "11480*0.05",
"11481*0.05", "11481*0.05",
"11482*0.05", "11482*0.05",
"11483*0.05" "11483*0.05",
"11496*0.1"
] ]
}, },
"72": { "72": {
@@ -14815,7 +14855,8 @@
"11450*0.05", "11450*0.05",
"11469", "11469",
"20323*0.1", "20323*0.1",
"20770*0.1" "20770*0.1",
"11496*0.1"
] ]
}, },
"73": { "73": {
@@ -15004,7 +15045,8 @@
"11449*0.05", "11449*0.05",
"11450*0.05", "11450*0.05",
"11469", "11469",
"20770*0.1" "20770*0.1",
"11496*0.1"
] ]
}, },
"74": { "74": {
@@ -15172,7 +15214,10 @@
"11492*0.05", "11492*0.05",
"11493*0.05", "11493*0.05",
"11494*0.05", "11494*0.05",
"11495*0.05" "11495*0.05",
"11496*0.1",
"11497*0.05",
"11498*0.05"
] ]
}, },
"75": { "75": {
@@ -15705,7 +15750,8 @@
"11449*0.05", "11449*0.05",
"11450*0.05", "11450*0.05",
"11469", "11469",
"20770*0.1" "20770*0.1",
"11496*0.1"
] ]
}, },
"78": { "78": {
@@ -15882,7 +15928,8 @@
"11449*0.05", "11449*0.05",
"11450*0.05", "11450*0.05",
"11469", "11469",
"20770*0.1" "20770*0.1",
"11496*0.1"
] ]
}, },
"79": { "79": {
@@ -16059,7 +16106,8 @@
"11449*0.05", "11449*0.05",
"11450*0.05", "11450*0.05",
"11469", "11469",
"20770*0.1" "20770*0.1",
"11496*0.1"
] ]
}, },
"80": { "80": {
@@ -16216,7 +16264,9 @@
"11492*0.05", "11492*0.05",
"11493*0.05", "11493*0.05",
"11494*0.05", "11494*0.05",
"11495*0.05" "11495*0.05",
"11497*0.05",
"11498*0.05"
] ]
}, },
"81": { "81": {
@@ -16372,7 +16422,10 @@
"11492*0.05", "11492*0.05",
"11493*0.05", "11493*0.05",
"11494*0.05", "11494*0.05",
"11495*0.05" "11495*0.05",
"11496*0.1",
"11497*0.05",
"11498*0.05"
] ]
}, },
"82": { "82": {
@@ -16699,7 +16752,8 @@
"11449*0.05", "11449*0.05",
"11450*0.05", "11450*0.05",
"11469", "11469",
"20770*0.1" "20770*0.1",
"11496*0.1"
] ]
}, },
"84": { "84": {
@@ -16862,7 +16916,8 @@
"11449*0.05", "11449*0.05",
"11450*0.05", "11450*0.05",
"11469", "11469",
"20770*0.1" "20770*0.1",
"11496*0.1"
] ]
}, },
"85": { "85": {
@@ -17025,7 +17080,8 @@
"11449*0.05", "11449*0.05",
"11450*0.05", "11450*0.05",
"11469", "11469",
"20770*0.1" "20770*0.1",
"11496*0.1"
] ]
}, },
"86": { "86": {

Binary file not shown.

View File

@@ -7714,37 +7714,37 @@
"id": 11015, "id": 11015,
"event": "学校食堂推出新菜:番茄炒西红柿。", "event": "学校食堂推出新菜:番茄炒西红柿。",
"include": "EVT?[10940]", "include": "EVT?[10940]",
"exclude": "EVT?[10944,11015,11016,11017,11018,11019,11020]" "exclude": "EVT?[10944,11015,21015,11016,11017,11018,11019,11020]"
}, },
"11016": { "11016": {
"id": 11016, "id": 11016,
"event": "学校食堂推出新菜:去肉牛肉面。", "event": "学校食堂推出新菜:去肉牛肉面。",
"include": "EVT?[10940]", "include": "EVT?[10940]",
"exclude": "EVT?[10944,11015,11016,11017,11018,11019,11020]" "exclude": "EVT?[10944,11015,11016,11017,11018,11019,11020,21015]"
}, },
"11017": { "11017": {
"id": 11017, "id": 11017,
"event": "学校食堂推出新菜:青椒炒草莓。", "event": "学校食堂推出新菜:青椒炒草莓。",
"include": "EVT?[10940]", "include": "EVT?[10940]",
"exclude": "EVT?[10944,11015,11016,11017,11018,11019,11020]" "exclude": "EVT?[10944,11015,11016,11017,11018,11019,11020,21015]"
}, },
"11018": { "11018": {
"id": 11018, "id": 11018,
"event": "学校食堂推出新菜:酸梅汤豆腐脑。", "event": "学校食堂推出新菜:酸梅汤豆腐脑。",
"include": "EVT?[10940]", "include": "EVT?[10940]",
"exclude": "EVT?[10944,11015,11016,11017,11018,11019,11020]" "exclude": "EVT?[10944,11015,11016,11017,11018,11019,11020,21015]"
}, },
"11019": { "11019": {
"id": 11019, "id": 11019,
"event": "学校食堂推出新菜:可乐烧黄瓜。", "event": "学校食堂推出新菜:可乐烧黄瓜。",
"include": "EVT?[10940]", "include": "EVT?[10940]",
"exclude": "EVT?[10944,11015,11016,11017,11018,11019,11020]" "exclude": "EVT?[10944,11015,11016,11017,11018,11019,11020,21015]"
}, },
"11020": { "11020": {
"id": 11020, "id": 11020,
"event": "学校食堂推出新菜:面条馅包子。", "event": "学校食堂推出新菜:面条馅包子。",
"include": "EVT?[10940]", "include": "EVT?[10940]",
"exclude": "EVT?[10944,11015,11016,11017,11018,11019,11020]" "exclude": "EVT?[10944,11015,11016,11017,11018,11019,11020,21015]"
}, },
"11021": { "11021": {
"id": 11021, "id": 11021,
@@ -10789,7 +10789,7 @@
"11476": { "11476": {
"id": 11476, "id": 11476,
"event": "小日子过得不错的国家认祖归宗,归化为恒桑省。", "event": "小日子过得不错的国家认祖归宗,归化为恒桑省。",
"exclude": "EVT?[11476]" "exclude": "EVT?[11476,11497,11498]"
}, },
"11477": { "11477": {
"id": 11477, "id": 11477,
@@ -10903,6 +10903,23 @@
"include": "EVT?[10010]", "include": "EVT?[10010]",
"exclude": "EVT?[11495]" "exclude": "EVT?[11495]"
}, },
"11496": {
"id": 11496,
"event": "越南宣布毒品合法化,因为可以给国家创造大量税收,提供大量工作岗位。",
"include": "EVT?[10009]",
"exclude": "EVT?[11496]"
},
"11497": {
"id": 11497,
"event": "外星舰队造访,观看东京奥运会开幕式后连夜逃离地球。",
"exclude": "EVT?[11497,11476,11491]"
},
"11498": {
"id": 11498,
"event": "日本大量居民因核废水变异,为防止病毒传播美国向日本抛下两颗原子弹。",
"include": "EVT?[10009]",
"exclude": "EVT?[11476,11498]"
},
"20007": { "20007": {
"id": 20007, "id": 20007,
"event": "你喜欢看画面人设好看的动漫。", "event": "你喜欢看画面人设好看的动漫。",
@@ -11097,7 +11114,7 @@
"include": "TLT?[1048]", "include": "TLT?[1048]",
"exclude": "EVT?[20334]", "exclude": "EVT?[20334]",
"branch": [ "branch": [
"STR<20:20335" "STR>20:20335"
] ]
}, },
"20335": { "20335": {
@@ -11633,6 +11650,12 @@
}, },
"NoRandom": 1 "NoRandom": 1
}, },
"21015": {
"id": 21015,
"event": "学校食堂推出了新菜:生煎包炒锅贴.",
"include": "EVT?[10940]",
"exclude": "EVT?[10944,11015,11016,11017,11018,11019,11020,21015]"
},
"21022": { "21022": {
"id": 21022, "id": 21022,
"event": "你买到一副貌似普通的画,竟然是名家真迹。", "event": "你买到一副貌似普通的画,竟然是名家真迹。",

Binary file not shown.

BIN
data/specialthanks-afd.xlsx Normal file

Binary file not shown.

BIN
data/specialthanks-dun.xlsx Normal file

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@@ -25,7 +25,6 @@ class App{
json('specialthanks') json('specialthanks')
]); ]);
this.#specialthanks = specialthanks; this.#specialthanks = specialthanks;
console.table(specialthanks);
this.switch('index'); this.switch('index');
window.onerror = (event, source, lineno, colno, error) => { window.onerror = (event, source, lineno, colno, error) => {
this.hint(`[ERROR] at (${source}:${lineno}:${colno})\n\n${error?.stack||error||'unknow Error'}`, 'error'); this.hint(`[ERROR] at (${source}:${lineno}:${colno})\n\n${error?.stack||error||'unknow Error'}`, 'error');
@@ -482,12 +481,11 @@ class App{
specialThanksPage.find('#spthx > ul.g2'), specialThanksPage.find('#spthx > ul.g2'),
]; ];
groups.forEach(g=>g.empty()); groups.forEach(g=>g.empty());
Object this.#specialthanks
.values(this.#specialthanks)
.sort(()=>0.5-Math.random()) .sort(()=>0.5-Math.random())
.forEach(({group, name, comment})=>groups[--group].append(` .forEach(({group, name, comment, color})=>groups[--group].append(`
<li> <li>
<span class="name">${name}</span> <span class="name" ${color?('style="color:'+color+'"'):''}>${name}</span>
<span class="comment">${comment||''}</span> <span class="comment">${comment||''}</span>
</li> </li>
`)) `))
@@ -576,8 +574,6 @@ class App{
const { judge, grade } = summary(type, value); const { judge, grade } = summary(type, value);
return { judge, grade, value }; return { judge, grade, value };
}; };
console.table(records);
console.debug(records);
judge.append([ judge.append([
(()=>{ (()=>{

View File

@@ -9,13 +9,13 @@ async function debug() {
await life.initial(); await life.initial();
life.restart({ life.restart({
CHR: 2000, // 颜值 charm CHR CHR: 5, // 颜值 charm CHR
INT: 2000, // 智力 intelligence INT INT: 5, // 智力 intelligence INT
STR: 2000, // 体质 strength STR STR: 5, // 体质 strength STR
MNY: 2000, // 家境 money MNY MNY: 5, // 家境 money MNY
SPR: 2000, // 快乐 spirit SPR SPR: 5, // 快乐 spirit SPR
AGE: 100, // AGE: 100,
TLT: [1134, 1048, 1009], // 天赋 talent TLT TLT: [1134, 1048, 1114], // 天赋 talent TLT
}); });
const lifeTrajectory = []; const lifeTrajectory = [];
let trajectory; let trajectory;
@@ -43,7 +43,7 @@ async function debug() {
} }
).join('\n ') ).join('\n ')
); );
if(age == 99) debugger if(age == 60) debugger
} while(!trajectory.isEnd) } while(!trajectory.isEnd)
// debugger; // debugger;
} }

View File

@@ -6,63 +6,154 @@ import { join, extname, dirname } from 'path';
// const XLSX = require('xlsx'); // const XLSX = require('xlsx');
// const { join, extname, dirname } = require('path'); // const { join, extname, dirname } = require('path');
async function transform(filePath) { async function read(xlsxPath) {
const xlsxFileBuffer = await readFile(filePath); const xlsxFileBuffer = await readFile(xlsxPath);
const xlsx = XLSX.read(xlsxFileBuffer, {type: 'buffer'}); const xlsx = XLSX.read(xlsxFileBuffer, {type: 'buffer'});
const sheets = xlsx.Sheets; const sheets = xlsx.Sheets;
const data = {}; const data = {};
for(const sheetName in sheets) { for(const sheetName in sheets) {
const sheetRawData = sheets[sheetName]; const sheetRawData = sheets[sheetName];
if(!sheetRawData['!ref']) break; if(!sheetRawData['!ref']) break;
const rawData = XLSX.utils.sheet_to_json(sheetRawData); data[sheetName] = XLSX.utils.sheet_to_json(sheetRawData);
const newData = {};
data[sheetName] = newData;
rawData.shift();
for(const index in rawData) {
const row = rawData[index];
const rowData = {};
let mainKey;
for(let key in row) {
const cell = row[key];
if(key[0] == "$") {
key = key.substr(1);
mainKey = cell;
}
if(key.includes(':')) {
const keys = key.split(':');
const lastKey = keys.pop();
let temp = rowData;
for(const subKey of keys) {
if(!temp[subKey]) temp[subKey] = {};
temp = temp[subKey];
}
if(lastKey.includes('[]')) {
const aKey = lastKey.split('[]')[0];
if(!temp[aKey]) temp[aKey] = [cell];
else temp[aKey].push(cell);
} else {
temp[lastKey] = cell;
}
} else if(key.includes('[]')) {
const aKey = key.split('[]')[0];
if(!rowData[aKey]) rowData[aKey] = [cell];
else rowData[aKey].push(cell);
} else {
rowData[key] = cell;
}
}
if(mainKey===undefined) {
console.warn('[WARN][No Main Key]', filePath, sheetName, parseInt(index), rowData);
continue;
}
if(newData[mainKey]) console.warn('[WARN][Duplicate Key]', mainKey, filePath, sheetName, parseInt(index), '\n\t', JSON.stringify(newData[mainKey]), '\n\t', JSON.stringify(rowData));
newData[mainKey] = rowData;
}
} }
return data; return data;
} }
async function write(sheets) {
for(const sheetName in sheets) {
const { dirname, data, source } = sheets[sheetName];
const savePath = join(dirname, `${sheetName}.json`);
console.info('[Transform] XLSX(', source.map(([p, s])=>`${p}:${s}`).join('\n\t\t '), `) \n\t -> JSON( ${savePath} )`);
await writeFile(
savePath,
JSON.stringify(data, null, 4),
)
}
}
function format(rawSheet, isArray) {
const newSheet = isArray?[]:{};
rawSheet.shift();
for(const index in rawSheet) {
const row = rawSheet[index];
const rowData = {};
let mainKey;
for(let key in row) {
const cell = row[key];
if(key[0] == "$") {
key = key.substr(1);
mainKey = cell;
}
if(key.includes(':')) {
const keys = key.split(':');
const lastKey = keys.pop();
let temp = rowData;
for(const subKey of keys) {
if(!temp[subKey]) temp[subKey] = {};
temp = temp[subKey];
}
if(lastKey.includes('[]')) {
const aKey = lastKey.split('[]')[0];
if(!temp[aKey]) temp[aKey] = [cell];
else temp[aKey].push(cell);
} else {
temp[lastKey] = cell;
}
} else if(key.includes('[]')) {
const aKey = key.split('[]')[0];
if(!rowData[aKey]) rowData[aKey] = [cell];
else rowData[aKey].push(cell);
} else {
rowData[key] = cell;
}
}
if(isArray) {
newSheet.push(rowData);
continue;
}
if(mainKey===undefined) {
console.warn('[WARN][No Main Key]', filePath, sheetName, parseInt(index), rowData);
continue;
}
if(newSheet[mainKey]) console.warn('[WARN][Duplicate Key]', mainKey, filePath, sheetName, parseInt(index), '\n\t', JSON.stringify(newSheet[mainKey]), '\n\t', JSON.stringify(rowData));
newSheet[mainKey] = rowData;
}
return newSheet;
}
function merge(original, rawData, isMerge, isArray, xlsxPath, rawSheetName) {
if(!original)
return {
isMerge,
isArray,
source: [[xlsxPath, rawSheetName]],
data: format(rawData, isArray)
};
if(!isMerge) {
if(original) {
console.warn(`[WARN][Sheet Duplicate] ${xlsxPath}:${rawSheetName}\n\t\t${original.source[0][0]}:${original.source[0][1]}`)
return original;
}
}
if(!original.isMerge) {
console.warn(`[WARN][Sheet Duplicate] ${xlsxPath}:${rawSheetName}\n\t\t${original.source[0][0]}:${original.source[0][1]}`)
return original;
}
if(original.isArray != isArray) {
console.warn(`[WARN][Sheet Format not pair] ${xlsxPath}:${rawSheetName}\n\t\t${original.source[0][0]}:${original.source[0][1]}`)
return original;
}
const formatData = format(rawData, isArray);
original.source.push([xlsxPath, rawSheetName]);
if(isArray) {
original.data = original.data.concat(formatData)
} else {
for(const key in formatData) {
if(original.data[key]) {
console.warn(`[WARN][Duplicate key] ${key} ${xlsxPath}:${rawSheetName} ${JSON.stringify(formatData[key])}\n\t\t${original.source[0][0]}:${original.source[0][1]} ${JSON.stringify(original.data[key])}`);
continue;
}
original.data[key] = formatData[key];
}
}
return original;
}
function transform(rawSheets) {
const sheets = {};
for(const xlsxPath in rawSheets) {
const {dirname: d, data: rawSheetsData} = rawSheets[xlsxPath];
for(const rawSheetName in rawSheetsData) {
const rawData = rawSheetsData[rawSheetName];
if(rawSheetName[0] === "#") continue;
let sheetName = rawSheetName;
const isArray = rawSheetName.substr(-5) === "<arr>";
if(isArray) sheetName = sheetName.substring(0, sheetName.length - 5);
const isMerge = rawSheetName[0] === ">";
if(isMerge) sheetName = sheetName.substr(1);
sheets[sheetName] = merge(
sheets[sheetName],
rawData,
isMerge,
isArray,
xlsxPath,
rawSheetName
);
sheets[sheetName].dirname = d;
}
}
return sheets;
}
async function walk(filePath) { async function walk(filePath) {
const xlsxPaths = []; const xlsxPaths = [];
if(Array.isArray(filePath)) { if(Array.isArray(filePath)) {
@@ -87,18 +178,18 @@ async function main() {
const filePaths = process.argv.slice(2); const filePaths = process.argv.slice(2);
if(filePaths.length<0) process.exit(0); if(filePaths.length<0) process.exit(0);
const xlsxs = await walk(filePaths); const xlsxs = await walk(filePaths);
const sheets = {};
for(const p of xlsxs) { for(const p of xlsxs) {
const data = await transform(p); const data = await read(p);
const d = dirname(p); const d = dirname(p);
for(const sheetName in data) { sheets[p] = {
const savePath = join(d, `${sheetName}.json`); dirname: d,
console.info(`[Transform] XLSX(${p}:${sheetName}) -> JSON(${savePath})`); data
await writeFile( };
savePath,
JSON.stringify(data[sheetName], null, 4),
);
}
} }
await write(
transform(sheets)
);
console.info(` console.info(`
------------------------ ------------------------
| Transform Complete | | Transform Complete |

View File

@@ -208,7 +208,6 @@ body {
} }
#spthx ul.g2 { #spthx ul.g2 {
color: white;
display: grid; display: grid;
grid-template-columns: 50% 50%; grid-template-columns: 50% 50%;
overflow: scroll; overflow: scroll;