Skip to content

Commit

Permalink
always use shell script to generate apps.json, remove js version
Browse files Browse the repository at this point in the history
Gets rid of duplicated functionality, but allows passing a filename
argument to write to a different file instead of `apps.json`.
  • Loading branch information
rigrig committed Jan 20, 2022
1 parent a3b49a0 commit e75a828
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 68 deletions.
5 changes: 4 additions & 1 deletion apps.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
# Otherwise nothing has changed. GitHub Pages will automatically
# create apps.json as your site is hosted, or if you're hosting
# yourself you can run bin/create_apps_json.sh
#
#
# If you serve the store from localhost for development/testing,
# the loader looks for apps.local.json instead, you can run
# `bin/create_apps_json.sh apps.local.json` to create that file.
# =================================================================

# Uncomment the following line if you only want explicitly listed
Expand Down
17 changes: 13 additions & 4 deletions bin/create_apps_json.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,26 @@
#
# If you do this, please do not attempt to commit your modified
# apps.json back into the main BangleApps repository!
#
# You can pass an optional filename to this script, and it will write
# to that instead, apps.local.json is used when opening the loader on localhost
outfile="${1:-apps.json}"

cd `dirname $0`/..
echo "[" > apps.json
echo "[" > "$outfile"
first=1
for app in apps/*/; do
echo "Processing $app...";
if [[ "$app" =~ ^apps/_example.* ]]; then
echo "Ignoring $app"
else
cat ${app}metadata.json >> apps.json
if [ $first -eq 1 ]; then
first=0;
else
echo "," >> "$outfile"
fi;
cat ${app}metadata.json >> "$outfile"
# echo ",\"$app\"," >> apps.json # DEBUG ONLY
echo "," >> apps.json
fi
done
echo "null]" >> apps.json
echo "]" >> "$outfile"
62 changes: 0 additions & 62 deletions bin/update_local_apps_json.js

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"scripts": {
"lint-apps": "eslint ./apps --ext .js",
"test": "node bin/sanitycheck.js && eslint ./apps --ext .js",
"update-local-apps": "node bin/update_local_apps_json.js",
"update-local-apps": "./bin/create_apps_json.sh apps.local.json",
"local": "npm-watch & npx http-server -a localhost -c-1",
"start": "npx http-server -c-1"
},
Expand Down

0 comments on commit e75a828

Please sign in to comment.