mirror of https://github.com/espruino/BangleApps
Port sanitychess.js to metadata.json
parent
d8d0dae4b5
commit
6f9cd73425
|
@ -26,29 +26,34 @@ function WARN(s) {
|
||||||
console.log("Warning: "+s);
|
console.log("Warning: "+s);
|
||||||
}
|
}
|
||||||
|
|
||||||
var appsFile, apps;
|
var apps = [];
|
||||||
try {
|
var dirs = fs.readdirSync(APPSDIR, {withFileTypes: true});
|
||||||
appsFile = fs.readFileSync(BASEDIR+"apps.json").toString();
|
dirs.forEach(dir => {
|
||||||
} catch (e) {
|
var appsFile;
|
||||||
ERROR("apps.json not found");
|
if (dir.name.startsWith("_example"))
|
||||||
}
|
return;
|
||||||
try{
|
try {
|
||||||
apps = JSON.parse(appsFile);
|
appsFile = fs.readFileSync(APPSDIR+dir.name+"/metadata.json").toString();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e);
|
return;
|
||||||
var m = e.toString().match(/in JSON at position (\d+)/);
|
|
||||||
if (m) {
|
|
||||||
var char = parseInt(m[1]);
|
|
||||||
console.log("===============================================");
|
|
||||||
console.log("LINE "+appsFile.substr(0,char).split("\n").length);
|
|
||||||
console.log("===============================================");
|
|
||||||
console.log(appsFile.substr(char-10, 20));
|
|
||||||
console.log("===============================================");
|
|
||||||
}
|
}
|
||||||
console.log(m);
|
try{
|
||||||
ERROR("apps.json not valid JSON");
|
apps.push(JSON.parse(appsFile));
|
||||||
|
} catch (e) {
|
||||||
}
|
console.log(e);
|
||||||
|
var m = e.toString().match(/in JSON at position (\d+)/);
|
||||||
|
if (m) {
|
||||||
|
var char = parseInt(m[1]);
|
||||||
|
console.log("===============================================");
|
||||||
|
console.log("LINE "+appsFile.substr(0,char).split("\n").length);
|
||||||
|
console.log("===============================================");
|
||||||
|
console.log(appsFile.substr(char-10, 20));
|
||||||
|
console.log("===============================================");
|
||||||
|
}
|
||||||
|
console.log(m);
|
||||||
|
ERROR(dir.name+"/metadata.json not valid JSON");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const APP_KEYS = [
|
const APP_KEYS = [
|
||||||
'id', 'name', 'shortName', 'version', 'icon', 'screenshots', 'description', 'tags', 'type',
|
'id', 'name', 'shortName', 'version', 'icon', 'screenshots', 'description', 'tags', 'type',
|
||||||
|
|
Loading…
Reference in New Issue