mirror of https://github.com/espruino/BangleApps
Add extra checks for app type and dependencies, document available types, and fix invalid app types
parent
ed7319e74b
commit
9d758075da
12
README.md
12
README.md
|
@ -257,12 +257,18 @@ and which gives information about the app for the Launcher.
|
|||
// 'app' - an application
|
||||
// 'clock' - a clock - required for clocks to automatically start
|
||||
// 'widget' - a widget
|
||||
// 'launch' - replacement launcher app
|
||||
// 'bootloader' - code that runs at startup only
|
||||
// 'bootloader' - an app that at startup (app.boot.js) but doesn't have a launcher entry for 'app.js'
|
||||
// 'RAM' - code that runs and doesn't upload anything to storage
|
||||
// 'launch' - replacement 'Launcher'
|
||||
// 'textinput' - provides a 'textinput' library that allows text to be input on the Bangle
|
||||
// 'scheduler' - provides 'sched' library and boot code for scheduling alarms/timers
|
||||
// (currently only 'sched' app)
|
||||
// 'notify' - provides 'notify' library for showing notifications
|
||||
// 'locale' - provides 'locale' library for language-specific date/distance/etc
|
||||
// (a version of 'locale' is included in the firmware)
|
||||
"tags": "", // comma separated tag list for searching
|
||||
"supports": ["BANGLEJS2"], // List of device IDs supported, either BANGLEJS or BANGLEJS2
|
||||
"dependencies" : { "notify":"type" } // optional, app 'types' we depend on
|
||||
"dependencies" : { "notify":"type" } // optional, app 'types' we depend on (see "type" above)
|
||||
"dependencies" : { "messages":"app" } // optional, depend on a specific app ID
|
||||
// for instance this will use notify/notifyfs is they exist, or will pull in 'notify'
|
||||
"readme": "README.md", // if supplied, a link to a markdown-style text file
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"name": "HRM Accelerometer event recorder",
|
||||
"shortName": "HRM ACC recorder",
|
||||
"version": "0.01",
|
||||
"type": "ram",
|
||||
"type": "RAM",
|
||||
"description": "Record HRM and accelerometer events in high resolution to CSV files in your browser",
|
||||
"icon": "app.png",
|
||||
"tags": "debug",
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"version": "0.02",
|
||||
"description": "Replace Bangle.js 2's menus with a version that contains smaller text",
|
||||
"icon": "app.png",
|
||||
"type": "boot",
|
||||
"type": "bootloader",
|
||||
"tags": "system",
|
||||
"supports": ["BANGLEJS2"],
|
||||
"storage": [
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
{"url":"screenshot_b1_dark.png"},{"url":"screenshot_b1_edit.png"},{"url":"screenshot_b1_light.png"},
|
||||
{"url":"screenshot_b2_dark.png"},{"url":"screenshot_b2_edit.png"},{"url":"screenshot_b2_light.png"}
|
||||
],
|
||||
"type": "boot",
|
||||
"type": "bootloader",
|
||||
"tags": "system",
|
||||
"supports": ["BANGLEJS","BANGLEJS2"],
|
||||
"storage": [
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"icon": "mmind.png",
|
||||
"version":"0.01",
|
||||
"description": "This is the classic game for masterminds",
|
||||
"type": "game",
|
||||
"type": "app",
|
||||
"tags": "mastermind, game, classic",
|
||||
"readme":"README.md",
|
||||
"supports": ["BANGLEJS2"],
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"version": "0.01",
|
||||
"description": "A retro-inspired dockface that displays the current time and battery charge while plugged in, and which features an interactive mode that shows the time, date, and a rotating data display line.",
|
||||
"icon": "mystic-dock.png",
|
||||
"type": "dock",
|
||||
"type": "app",
|
||||
"tags": "dock",
|
||||
"supports": ["BANGLEJS"],
|
||||
"readme": "README.md",
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"version": "0.02",
|
||||
"description": "Replace the built in menu function. Supports Bangle.js 1 and Bangle.js 2.",
|
||||
"icon": "icon.png",
|
||||
"type": "boot",
|
||||
"type": "bootloader",
|
||||
"tags": "system",
|
||||
"supports": ["BANGLEJS","BANGLEJS2"],
|
||||
"readme": "README.md",
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"version": "0.01",
|
||||
"description": "Let's you swipe from left to right on any app to return back to the clock face. Please configure in the settings app after installing to activate, since its disabled by default.",
|
||||
"icon": "app.png",
|
||||
"type": "boot",
|
||||
"type": "bootloader",
|
||||
"tags": "tools",
|
||||
"supports": ["BANGLEJS2"],
|
||||
"readme": "README.md",
|
||||
|
|
|
@ -65,6 +65,7 @@ const APP_KEYS = [
|
|||
const STORAGE_KEYS = ['name', 'url', 'content', 'evaluate', 'noOverwite', 'supports'];
|
||||
const DATA_KEYS = ['name', 'wildcard', 'storageFile', 'url', 'content', 'evaluate'];
|
||||
const SUPPORTS_DEVICES = ["BANGLEJS","BANGLEJS2"]; // device IDs allowed for 'supports'
|
||||
const METADATA_TYPES = ["app","clock","widget","bootloader","RAM","launch","textinput","scheduler","notify","locale"]; // values allowed for "type" field
|
||||
const FORBIDDEN_FILE_NAME_CHARS = /[,;]/; // used as separators in appid.info
|
||||
const VALID_DUPLICATES = [ '.tfmodel', '.tfnames' ];
|
||||
const GRANDFATHERED_ICONS = ["s7clk", "snek", "astral", "alpinenav", "slomoclock", "arrow", "pebble", "rebble"];
|
||||
|
@ -94,6 +95,8 @@ apps.forEach((app,appIdx) => {
|
|||
if (!app.name) ERROR(`App ${app.id} has no name`);
|
||||
var isApp = !app.type || app.type=="app";
|
||||
if (app.name.length>20 && !app.shortName && isApp) ERROR(`App ${app.id} has a long name, but no shortName`);
|
||||
if (app.type && !METADATA_TYPES.includes(app.type))
|
||||
ERROR(`App ${app.id} 'type' is one one of `+METADATA_TYPES);
|
||||
if (!Array.isArray(app.supports)) ERROR(`App ${app.id} has no 'supports' field or it's not an array`);
|
||||
else {
|
||||
app.supports.forEach(dev => {
|
||||
|
@ -135,6 +138,9 @@ apps.forEach((app,appIdx) => {
|
|||
Object.keys(app.dependencies).forEach(dependency => {
|
||||
if (!["type","app"].includes(app.dependencies[dependency]))
|
||||
ERROR(`App ${app.id} 'dependencies' must all be tagged 'type' or 'app' right now`);
|
||||
if (app.dependencies[dependency]=="type" && !METADATA_TYPES.includes(dependency))
|
||||
ERROR(`App ${app.id} 'type' dependency must be one of `+METADATA_TYPES);
|
||||
|
||||
});
|
||||
} else
|
||||
ERROR(`App ${app.id} 'dependencies' must be an object`);
|
||||
|
|
Loading…
Reference in New Issue