INNER CODE UNIT · JavaScript
idRe
ImranR98/apps.obtainium.imranr.dev · scripts/generate_from_export.js:31
const idRe = /^[A-Za-z][A-Za-z0-9_]*(\.[A-Za-z0-9_]+)+$/
if (!jsonPath) {
console.error('Usage: node scripts/generate_from_export.js [--dry-run] [--only <id[,id]>] <path to Obtainium export>')
process.exit(1)
}
function getAllJsonFiles(dir) {
const results = []
for (const item of fs.readdirSync(dir, { withFileTypes: true })) {
const fullPath = path.join(dir, item.name)
if (item.isDirectory()) {
results.push(...getAllJsonFiles(fullPath))
} else if (item.name.toLowerCase().endsWith('.json')) {
results.push(fullPath)
}
}
return results