0a9588abb7
- Add pagination support to findAll (page, limit query params) - Add findByTemplateId method to service - Add GET /by-template/:templateId endpoint to controller - Service already includes CRUD for QuestionBank and QuestionBankItem
38 lines
1.1 KiB
JavaScript
38 lines
1.1 KiB
JavaScript
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
function getFiles(dir, fileList = []) {
|
|
const files = fs.readdirSync(dir);
|
|
for (const file of files) {
|
|
const name = path.join(dir, file);
|
|
if (fs.statSync(name).isDirectory()) {
|
|
if (file !== 'node_modules' && file !== '.git' && file !== 'dist') {
|
|
getFiles(name, fileList);
|
|
}
|
|
} else {
|
|
if (name.endsWith('.tsx') || name.endsWith('.ts')) {
|
|
fileList.push(name);
|
|
}
|
|
}
|
|
}
|
|
return fileList;
|
|
}
|
|
|
|
const webDir = path.join('d:', 'workspace', 'AuraK', 'web');
|
|
const files = getFiles(webDir);
|
|
const keys = new Set();
|
|
const tRegex = /t\(\s*['"]([a-zA-Z0-9_-]+)['"]/g;
|
|
|
|
for (const file of files) {
|
|
const content = fs.readFileSync(file, 'utf8');
|
|
let match;
|
|
while ((match = tRegex.exec(content)) !== null) {
|
|
keys.add(match[1]);
|
|
}
|
|
}
|
|
|
|
const sortedKeys = Array.from(keys).sort();
|
|
fs.writeFileSync(path.join('d:', 'workspace', 'AuraK', 'all_used_keys.txt'), sortedKeys.join('\n'));
|
|
console.log(`Extracted ${sortedKeys.length} unique keys to all_used_keys.txt`);
|