Let apps.json be generated by jekyll

Reading

https://github.com/espruino/BangleApps/issues/1020
https://github.com/espruino/BangleApps/issues/46

My understanding is that the requirement for a splitt apps.json solution
is:

  - work seemlessly with github pages (no manually calling a script)

  - single (or at most a few) apps.json for the browser to load for the
    store so the store page is fast

As the github pages already use jekyll to build the store page this can
be solved by a minimal jekyll plugin. This is a proof of concept of
that. If the concept is accepted in a next step, I will create the
splitt files for mmore that just the two here.
pull/1221/head
Adam Schmalhofer 2022-01-04 22:57:00 +01:00
parent 1906dd2839
commit 01d3615663
5 changed files with 63 additions and 5431 deletions

1
.gitignore vendored
View File

@ -9,3 +9,4 @@ appdates.csv
_config.yml
tests/Layout/bin/tmp.*
tests/Layout/testresult.bmp
/apps.json

View File

@ -0,0 +1,26 @@
class AppsJsonPage < Jekyll::Page
def initialize(site)
@site = site
@base = site.source
@basename = 'apps'
@ext = '.json'
@name = 'apps.json'
@data = {}
end
end
# Generates the apps.json
# out of all the /apps/*/metadata.json files
class Generator < Jekyll::Generator
safe true
def generate(site)
metadatas = site.static_files.select { |file| file.name == 'metadata.json' }
json = metadatas.map { |file| JSON.load(open(file.path)) }
appsjson = AppsJsonPage.new(site)
open(appsjson.path, 'wb') do |file|
file << JSON.generate(json)
end
site.pages << appsjson
end
end

5431
apps.json

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,18 @@
{
"id": "gbridge",
"name": "Gadgetbridge",
"version": "0.25",
"description": "(NOT RECOMMENDED) Displays Gadgetbridge notifications from Android. Please use the 'Android' Bangle.js app instead.",
"icon": "app.png",
"type": "widget",
"tags": "tool,system,android,widget",
"supports": ["BANGLEJS","BANGLEJS2"],
"dependencies": {"notify":"type"},
"readme": "README.md",
"storage": [
{"name":"gbridge.settings.js","url":"settings.js"},
{"name":"gbridge.img","url":"app-icon.js","evaluate":true},
{"name":"gbridge.wid.js","url":"widget.js"}
],
"data": [{"name":"gbridge.json"}]
}

18
apps/lcars/metadata.json Normal file
View File

@ -0,0 +1,18 @@
{
"id": "lcars",
"name": "LCARS Clock",
"shortName":"LCARS",
"icon": "lcars.png",
"version":"0.07",
"readme": "README.md",
"supports": ["BANGLEJS2"],
"description": "Library Computer Access Retrieval System (LCARS) clock.",
"type": "clock",
"tags": "clock",
"screenshots": [{"url":"screenshot.png"}],
"storage": [
{"name":"lcars.app.js","url":"lcars.app.js"},
{"name":"lcars.img","url":"lcars.icon.js","evaluate":true},
{"name":"lcars.settings.js","url":"lcars.settings.js"}
]
}