Autogenerate apps.json if needed

pull/1673/head
Eskild Hustvedt 2022-04-10 16:04:31 +02:00
parent aaefe390b0
commit c10bd83c9f
1 changed files with 10 additions and 0 deletions

View File

@ -5,6 +5,8 @@ outputs a list of strings that have been found.
See https://github.com/espruino/BangleApps/issues/1311
*/
var childProcess = require('child_process');
let refresh = false;
function handleCliParameters ()
@ -126,6 +128,14 @@ try {
} catch (e) {
ERROR("apps.json not found");
}
if (appsFile.indexOf("---") === 0 && fs.existsSync(BASEDIR+"bin/create_apps_json.sh"))
{
console.log("apps.json has not been generated, running bin/create_apps_json.sh to build it...");
childProcess.execFileSync(BASEDIR+'bin/create_apps_json.sh',[],{
stdio: 'inherit'
});
appsFile = fs.readFileSync(BASEDIR+"apps.json").toString();
}
try{
apps = JSON.parse(appsFile);
} catch (e) {