forked from FOSS/BangleApps
add readme files
parent
5173e1c578
commit
ee0b0f2d77
|
@ -0,0 +1,25 @@
|
|||
BangleApps Utilities
|
||||
====================
|
||||
|
||||
* `sanitycheck.js` - this is run as a CI check (or when `npm test` is used) and checks for common issues with apps or their `metadata.json`
|
||||
* `create_apps_json.sh` - create the `apps.json` file - this is an aggregation of all `metadata.json` files and is used to speed up loading of BangleApps (or where the server it is hosted on doesn't support directory listing)
|
||||
* `find_banglejs1_only_apps.sh` - show apps that only work on Bangle.js 1 (and not 2)
|
||||
* `firmwaremaker_c.js` - create the binary blob needed for the Bangle.js firmware (containing default apps)
|
||||
* `pre-publish.sh` - this is run before we publish to https://banglejs.com/apps/ - it works out how recently all the apps were updated and writes it to `appdates.csv`
|
||||
|
||||
**You should also check out https://github.com/espruino/EspruinoAppLoaderCore/tree/master/tools** (available in `core/tools` in this repo) - this contains tools for handling languages, as well as a command-line based app loader
|
||||
|
||||
Related to Linting code:
|
||||
|
||||
* `bulk-update-apps.mjs` - use this script to bump the version of many apps with the same changes
|
||||
* `exempt-lint.mjs` - exempt an app file from a specific eslint rule
|
||||
* `sync-lint-exemptions.mjs` - Run this to ensure that the lint exemptions are all valid. If any of the exempt app files have been changed, this script will remove the exemption for that file.
|
||||
|
||||
Prototypes:
|
||||
|
||||
* `runapptests.js` - **PROTOTYPE** - runs tests for apps (where defined) in an emulator so apps can be tested offline
|
||||
* `thumbnailer.js` - **PROTOTYPE** - runs all apps in an emulator and automatically outputs thumbnails for them
|
||||
|
||||
Legacy:
|
||||
|
||||
* `firmwaremaker.js` - **LEGACY** create a JS file containing all the commands needed to write firmware to a Bangle. Was used for Bangle.js 1 factory programming
|
|
@ -1,99 +0,0 @@
|
|||
#!/usr/bin/env nodejs
|
||||
/* Quick hack to add proper 'supports' field to apps.json
|
||||
*/
|
||||
|
||||
var fs = require("fs");
|
||||
|
||||
var BASEDIR = __dirname+"/../";
|
||||
|
||||
var appsFile, apps;
|
||||
try {
|
||||
appsFile = fs.readFileSync(BASEDIR+"apps.json").toString();
|
||||
} catch (e) {
|
||||
ERROR("apps.json not found");
|
||||
}
|
||||
try{
|
||||
apps = 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("apps.json not valid JSON");
|
||||
|
||||
}
|
||||
|
||||
apps = apps.map((app,appIdx) => {
|
||||
if (app.supports) return app; // already sorted
|
||||
var tags = [];
|
||||
if (app.tags) tags = app.tags.split(",").map(t=>t.trim());
|
||||
var supportsB1 = true;
|
||||
var supportsB2 = false;
|
||||
if (tags.includes("b2")) {
|
||||
tags = tags.filter(x=>x!="b2");
|
||||
supportsB2 = true;
|
||||
}
|
||||
if (tags.includes("bno2")) {
|
||||
tags = tags.filter(x=>x!="bno2");
|
||||
supportsB2 = false;
|
||||
}
|
||||
if (tags.includes("bno1")) {
|
||||
tags = tags.filter(x=>x!="bno1");
|
||||
supportsB1 = false;
|
||||
}
|
||||
app.tags = tags.join(",");
|
||||
app.supports = [];
|
||||
if (supportsB1) app.supports.push("BANGLEJS");
|
||||
if (supportsB2) app.supports.push("BANGLEJS2");
|
||||
return app;
|
||||
});
|
||||
|
||||
// search for screenshots
|
||||
apps = apps.map((app,appIdx) => {
|
||||
if (app.screenshots) return app; // already sorted
|
||||
|
||||
var files = require("fs").readdirSync(__dirname+"/../apps/"+app.id);
|
||||
var screenshots = files.filter(fn=>fn.startsWith("screenshot") && fn.endsWith(".png"));
|
||||
if (screenshots.length)
|
||||
app.screenshots = screenshots.map(fn => ({url:fn}));
|
||||
return app;
|
||||
});
|
||||
|
||||
var KEY_ORDER = [
|
||||
"id","name","shortName","version","description","icon","screenshots","type","tags","supports",
|
||||
"dependencies", "readme", "custom", "customConnect", "interface",
|
||||
"allow_emulator", "storage", "data", "sortorder"
|
||||
];
|
||||
|
||||
var JS = JSON.stringify;
|
||||
var json = "[\n "+apps.map(app=>{
|
||||
var keys = KEY_ORDER.filter(k=>k in app);
|
||||
Object.keys(app).forEach(k=>{
|
||||
if (!KEY_ORDER.includes(k))
|
||||
throw new Error(`Key named ${k} not known!`);
|
||||
});
|
||||
//var keys = Object.keys(app); // don't re-order
|
||||
|
||||
return "{\n "+keys.map(k=>{
|
||||
var js = JS(app[k]);
|
||||
if (k=="storage") {
|
||||
if (app.storage.length)
|
||||
js = "[\n "+app.storage.map(s=>JS(s)).join(",\n ")+"\n ]";
|
||||
else
|
||||
js = "[]";
|
||||
}
|
||||
return JS(k)+": "+js;
|
||||
}).join(",\n ")+"\n }";
|
||||
}).join(",\n ")+"\n]\n";
|
||||
|
||||
//console.log(json);
|
||||
|
||||
console.log("new apps.json written");
|
||||
fs.writeFileSync(BASEDIR+"apps.json", json);
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
cd `dirname $0`/..
|
||||
find apps -name metadata.json | xargs -I {} grep '\["BANGLEJS"\]' -A 100 -B 100 {}
|
|
@ -0,0 +1,16 @@
|
|||
Localisation
|
||||
=============
|
||||
|
||||
Any apps which have Strings in which are prefixed with `/*LANG*/` will be scanned, and if the
|
||||
language is set in the app loader the string will be replaced with a translation from the JSON
|
||||
in this directory.
|
||||
|
||||
JSON in `unicode-based` contains characters that can't be rendered by the default font
|
||||
in Bangle.js. The `language_render.js` tool (below) renders the text to bitmaps and then
|
||||
writes them into the corresponding JSON file in this directory, so that the bitmaps (rather than
|
||||
just text) are included in apps instead.
|
||||
|
||||
Check out https://github.com/espruino/EspruinoAppLoaderCore/tree/master/tools (available in `core/tools` in this repo)
|
||||
|
||||
* `language_scan.js` - scan for unhandled `/*LANG*/` strings and automatically translate them
|
||||
* `language_render.js` - renders the JSON translations in the `unicode-based` folder to bitmaps, and writes them into the corresponding JSON file in this directory (see above)
|
Loading…
Reference in New Issue