-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_json.js
More file actions
32 lines (26 loc) · 932 Bytes
/
check_json.js
File metadata and controls
32 lines (26 loc) · 932 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const fs = require('fs');
const path = require('path');
const enPath = path.join(__dirname, 'frontend/src/locales/en/landing.json');
const dePath = path.join(__dirname, 'frontend/src/locales/de/landing.json');
function checkFile(filePath) {
try {
const content = fs.readFileSync(filePath, 'utf8');
const json = JSON.parse(content);
console.log(`File ${filePath} is valid JSON.`);
if (json.dashboard && json.dashboard.progress) {
console.log('Found dashboard.progress:', json.dashboard.progress);
} else {
console.log('dashboard.progress NOT found at root.');
}
if (json.pages && json.pages.dashboard) {
console.log('Found pages.dashboard');
}
if (json.components && json.components.dashboard) {
console.log('Found components.dashboard');
}
} catch (e) {
console.error(`Error parsing ${filePath}:`, e.message);
}
}
checkFile(enPath);
checkFile(dePath);