2022-10-14 05:18:41 +03:00
|
|
|
#!/bin/bash
|
2022-10-14 04:46:45 +03:00
|
|
|
# cmd: $ ./build-package-pages.sh srcJson targetPath
|
|
|
|
# sample: $ .github/build-package-pages.sh src/data/packages.json src/content/packages'
|
|
|
|
|
|
|
|
for row in $(cat $1 | jq -r '.[] | @base64'); do
|
|
|
|
_jq() {
|
|
|
|
echo ${row} | base64 --decode | jq -r ${1}
|
|
|
|
}
|
2022-10-14 17:13:13 +03:00
|
|
|
touch $2/$(_jq '.slug').md
|
2022-10-14 04:46:45 +03:00
|
|
|
content="---
|
|
|
|
type: page
|
|
|
|
title: \"$(_jq '.name')\"
|
|
|
|
Description: \"$(_jq '.desc')\"
|
|
|
|
layout: \"package-detail\"
|
|
|
|
---"
|
2022-10-14 17:13:13 +03:00
|
|
|
echo "$content" > $2/$(_jq '.slug').md
|
2022-10-14 04:46:45 +03:00
|
|
|
done
|