refactor: 使用flutter对原先的web项目重构,正在进行中
This commit is contained in:
1 parent
273224f5cf
commit
18017f819a
205 files changed
+13563
No files matched your search
@@ -0,0 +1,25 @@
|
||||
// One-off: export all built-in levels to JSON for the Flutter port.
|
||||
import { LEVELS, TYPE_LABEL, TYPE_CLASS } from './js/levels/index.js';
|
||||
import { writeFileSync } from 'fs';
|
||||
|
||||
// Sanity: ensure serializable and report shapes.
|
||||
function deepCheck(v, path) {
|
||||
if (v === null || v === undefined) return;
|
||||
if (typeof v === 'function') throw new Error('function at ' + path);
|
||||
if (typeof v === 'object') {
|
||||
if (Array.isArray(v)) { v.forEach((e, i) => deepCheck(e, path + '[' + i + ']')); }
|
||||
else { for (const k of Object.keys(v)) deepCheck(v[k], path + '.' + k); }
|
||||
}
|
||||
}
|
||||
for (const l of LEVELS) deepCheck(l, l.id || '?');
|
||||
|
||||
const out = {
|
||||
levels: LEVELS,
|
||||
typeLabel: TYPE_LABEL,
|
||||
typeClass: TYPE_CLASS,
|
||||
};
|
||||
writeFileSync('levels_dump.json', JSON.stringify(out));
|
||||
console.log('OK levels=', LEVELS.length, 'bytes=', JSON.stringify(out).length);
|
||||
for (const l of LEVELS) {
|
||||
console.log(' -', l.id, l.name, 'type=' + l.type, 'w=' + l.width, 'rows=' + (l.grid ? l.grid.length : '?'));
|
||||
}
|
||||
Reference in new issue
Block a user