From d8bd93ae9f3d2b1151768b78da9b35366ec09d6a Mon Sep 17 00:00:00 2001
From: Bill Hails <me@billhails.net>
Date: Sun, 12 Sep 2021 12:59:48 +0100
Subject: [PATCH] fun with make and jq

---
 Makefile                            |  2 ++
 Makefile.common                     | 10 +++++++++-
 agate/theme.package.json            |  4 ++++
 agate/theme/package.json            |  4 ++--
 agate/version.json                  |  5 +++++
 antique-hard/theme.package.json     |  4 ++++
 antique-hard/theme/package.json     |  4 ++--
 antique-hard/version.json           |  5 +++++
 antique/theme.package.json          |  4 ++++
 antique/theme/package.json          |  4 ++--
 antique/version.json                |  5 +++++
 basic/theme.package.json            |  4 ++++
 basic/theme/package.json            |  4 ++--
 basic/version.json                  |  5 +++++
 bathroom/theme.package.json         |  4 ++++
 bathroom/theme/package.json         |  3 +--
 bathroom/version.json               |  5 +++++
 common.package.json                 |  7 +++++++
 jade-hard/theme.package.json        |  4 ++++
 jade-hard/theme/package.json        |  3 +--
 jade-hard/version.json              |  5 +++++
 jade/theme.package.json             |  4 ++++
 jade/theme/package.json             |  3 +--
 jade/version.json                   |  5 +++++
 sakura/theme.package.json           |  4 ++++
 sakura/theme/package.json           |  4 ++--
 sakura/version.json                 |  5 +++++
 shell-slate-hard/theme.package.json |  4 ++++
 shell-slate-hard/theme/package.json |  2 +-
 shell-slate-hard/version.json       |  5 +++++
 shell-slate/theme.package.json      |  4 ++++
 shell-slate/theme/package.json      |  2 +-
 shell-slate/version.json            |  5 +++++
 yuki/theme.package.json             |  4 ++++
 yuki/theme/package.json             |  3 +--
 yuki/version.json                   |  5 +++++
 yunzi-hard/theme.package.json       |  4 ++++
 yunzi-hard/theme/package.json       |  2 +-
 yunzi-hard/version.json             |  5 +++++
 yunzi/theme.package.json            |  4 ++++
 yunzi/theme/package.json            |  2 +-
 yunzi/version.json                  |  5 +++++
 42 files changed, 153 insertions(+), 23 deletions(-)
 create mode 100644 agate/theme.package.json
 create mode 100644 agate/version.json
 create mode 100644 antique-hard/theme.package.json
 create mode 100644 antique-hard/version.json
 create mode 100644 antique/theme.package.json
 create mode 100644 antique/version.json
 create mode 100644 basic/theme.package.json
 create mode 100644 basic/version.json
 create mode 100644 bathroom/theme.package.json
 create mode 100644 bathroom/version.json
 create mode 100644 common.package.json
 create mode 100644 jade-hard/theme.package.json
 create mode 100644 jade-hard/version.json
 create mode 100644 jade/theme.package.json
 create mode 100644 jade/version.json
 create mode 100644 sakura/theme.package.json
 create mode 100644 sakura/version.json
 create mode 100644 shell-slate-hard/theme.package.json
 create mode 100644 shell-slate-hard/version.json
 create mode 100644 shell-slate/theme.package.json
 create mode 100644 shell-slate/version.json
 create mode 100644 yuki/theme.package.json
 create mode 100644 yuki/version.json
 create mode 100644 yunzi-hard/theme.package.json
 create mode 100644 yunzi-hard/version.json
 create mode 100644 yunzi/theme.package.json
 create mode 100644 yunzi/version.json

diff --git a/Makefile b/Makefile
index c1a8f2c..f7679bf 100644
--- a/Makefile
+++ b/Makefile
@@ -3,6 +3,8 @@
 
 THEMEDIRS=agate antique antique-hard basic bathroom jade jade-hard sakura shell-slate shell-slate-hard yuki yunzi yunzi-hard
 
+default: copy
+
 all: $(THEMEDIRS)
 
 $(THEMEDIRS): %: FORCE
diff --git a/Makefile.common b/Makefile.common
index 8acd11b..d562917 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -1,6 +1,14 @@
+SHELL=/bin/bash
+
 all: ${NAME}.sabakitheme.asar
 
-${NAME}.sabakitheme.asar: theme/package.json theme/styles.css theme/images/*.png
+${NAME}.sabakitheme.asar: theme/package.json
 	asar pack ./theme $@
 
+# https://stedolan.github.io/jq/
+theme/package.json: theme.package.json version.json ../common.package.json theme/styles.css theme/images/*.png
+	jq '{major, minor, patch: (.patch + 1)}' version.json > version.json.tmp
+	mv version.json.tmp version.json
+	jq -s '.[0] * {version: "\(.[1].major).\(.[1].minor).\(.[1].patch)"} * .[2]' theme.package.json version.json ../common.package.json > $@
+
 # vim: noet sw=8
diff --git a/agate/theme.package.json b/agate/theme.package.json
new file mode 100644
index 0000000..4937575
--- /dev/null
+++ b/agate/theme.package.json
@@ -0,0 +1,4 @@
+{
+  "name": "Agate",
+  "description": "A theme with agate stones for Sabaki"
+}
diff --git a/agate/theme/package.json b/agate/theme/package.json
index 239adfe..e813e51 100644
--- a/agate/theme/package.json
+++ b/agate/theme/package.json
@@ -1,9 +1,9 @@
 {
   "name": "Agate",
-  "version": "0.1.1",
   "description": "A theme with agate stones for Sabaki",
+  "version": "1.0.4",
   "author": "Bill Hails",
-  "license": "CC0-1.0",
   "homepage": "https://github.com/billhails/SabakiThemes",
+  "license": "CC0-1.0",
   "main": "styles.css"
 }
diff --git a/agate/version.json b/agate/version.json
new file mode 100644
index 0000000..b57be2d
--- /dev/null
+++ b/agate/version.json
@@ -0,0 +1,5 @@
+{
+  "major": 1,
+  "minor": 0,
+  "patch": 4
+}
diff --git a/antique-hard/theme.package.json b/antique-hard/theme.package.json
new file mode 100644
index 0000000..a9b7cfd
--- /dev/null
+++ b/antique-hard/theme.package.json
@@ -0,0 +1,4 @@
+{
+  "name": "Antique (hard light)",
+  "description": "A theme with antique single-convex yunzi stones for Sabaki"
+}
diff --git a/antique-hard/theme/package.json b/antique-hard/theme/package.json
index aa698f7..5b15ffd 100644
--- a/antique-hard/theme/package.json
+++ b/antique-hard/theme/package.json
@@ -1,9 +1,9 @@
 {
   "name": "Antique (hard light)",
-  "version": "0.1.5",
   "description": "A theme with antique single-convex yunzi stones for Sabaki",
+  "version": "1.0.7",
   "author": "Bill Hails",
-  "license": "CC0-1.0",
   "homepage": "https://github.com/billhails/SabakiThemes",
+  "license": "CC0-1.0",
   "main": "styles.css"
 }
diff --git a/antique-hard/version.json b/antique-hard/version.json
new file mode 100644
index 0000000..39f107e
--- /dev/null
+++ b/antique-hard/version.json
@@ -0,0 +1,5 @@
+{
+  "major": 1,
+  "minor": 0,
+  "patch": 7
+}
diff --git a/antique/theme.package.json b/antique/theme.package.json
new file mode 100644
index 0000000..f76737b
--- /dev/null
+++ b/antique/theme.package.json
@@ -0,0 +1,4 @@
+{
+  "name": "Antique (Soft Light)",
+  "description": "A theme with antique single-convex yunzi stones for Sabaki"
+}
diff --git a/antique/theme/package.json b/antique/theme/package.json
index 6894297..8770a50 100644
--- a/antique/theme/package.json
+++ b/antique/theme/package.json
@@ -1,9 +1,9 @@
 {
   "name": "Antique (Soft Light)",
-  "version": "0.1.5",
   "description": "A theme with antique single-convex yunzi stones for Sabaki",
+  "version": "1.0.7",
   "author": "Bill Hails",
-  "license": "CC0-1.0",
   "homepage": "https://github.com/billhails/SabakiThemes",
+  "license": "CC0-1.0",
   "main": "styles.css"
 }
diff --git a/antique/version.json b/antique/version.json
new file mode 100644
index 0000000..39f107e
--- /dev/null
+++ b/antique/version.json
@@ -0,0 +1,5 @@
+{
+  "major": 1,
+  "minor": 0,
+  "patch": 7
+}
diff --git a/basic/theme.package.json b/basic/theme.package.json
new file mode 100644
index 0000000..6fd3734
--- /dev/null
+++ b/basic/theme.package.json
@@ -0,0 +1,4 @@
+{
+  "name": "Basic",
+  "description": "A basic theme with glass stones and a beechwood board for Sabaki"
+}
diff --git a/basic/theme/package.json b/basic/theme/package.json
index 4a63cd2..1c25914 100644
--- a/basic/theme/package.json
+++ b/basic/theme/package.json
@@ -1,9 +1,9 @@
 {
   "name": "Basic",
-  "version": "0.1.3",
   "description": "A basic theme with glass stones and a beechwood board for Sabaki",
+  "version": "1.0.5",
   "author": "Bill Hails",
-  "license": "CC0-1.0",
   "homepage": "https://github.com/billhails/SabakiThemes",
+  "license": "CC0-1.0",
   "main": "styles.css"
 }
diff --git a/basic/version.json b/basic/version.json
new file mode 100644
index 0000000..31b6168
--- /dev/null
+++ b/basic/version.json
@@ -0,0 +1,5 @@
+{
+  "major": 1,
+  "minor": 0,
+  "patch": 5
+}
diff --git a/bathroom/theme.package.json b/bathroom/theme.package.json
new file mode 100644
index 0000000..4689436
--- /dev/null
+++ b/bathroom/theme.package.json
@@ -0,0 +1,4 @@
+{
+  "name": "Trump's Bathroom",
+  "description": "A theme with semi-precious stones and a marble board for Sabaki"
+}
diff --git a/bathroom/theme/package.json b/bathroom/theme/package.json
index 1d3122c..30e76c1 100644
--- a/bathroom/theme/package.json
+++ b/bathroom/theme/package.json
@@ -1,10 +1,9 @@
 {
   "name": "Trump's Bathroom",
-  "version": "0.1.5",
   "description": "A theme with semi-precious stones and a marble board for Sabaki",
+  "version": "1.0.7",
   "author": "Bill Hails",
   "homepage": "https://github.com/billhails/SabakiThemes",
   "license": "CC0-1.0",
-  "homepage": "https://github.com/billhails/SabakiThemes",
   "main": "styles.css"
 }
diff --git a/bathroom/version.json b/bathroom/version.json
new file mode 100644
index 0000000..39f107e
--- /dev/null
+++ b/bathroom/version.json
@@ -0,0 +1,5 @@
+{
+  "major": 1,
+  "minor": 0,
+  "patch": 7
+}
diff --git a/common.package.json b/common.package.json
new file mode 100644
index 0000000..efdab44
--- /dev/null
+++ b/common.package.json
@@ -0,0 +1,7 @@
+{
+  "author": "Bill Hails",
+  "homepage": "https://github.com/billhails/SabakiThemes",
+  "license": "CC0-1.0",
+  "homepage": "https://github.com/billhails/SabakiThemes",
+  "main": "styles.css"
+}
diff --git a/jade-hard/theme.package.json b/jade-hard/theme.package.json
new file mode 100644
index 0000000..9590488
--- /dev/null
+++ b/jade-hard/theme.package.json
@@ -0,0 +1,4 @@
+{
+  "name": "Jade (hard light)",
+  "description": "A theme with jade stones for Sabaki"
+}
diff --git a/jade-hard/theme/package.json b/jade-hard/theme/package.json
index b782464..6f18651 100644
--- a/jade-hard/theme/package.json
+++ b/jade-hard/theme/package.json
@@ -1,10 +1,9 @@
 {
   "name": "Jade (hard light)",
-  "version": "0.1.4",
   "description": "A theme with jade stones for Sabaki",
+  "version": "1.0.6",
   "author": "Bill Hails",
   "homepage": "https://github.com/billhails/SabakiThemes",
   "license": "CC0-1.0",
-  "homepage": "https://github.com/billhails/SabakiThemes",
   "main": "styles.css"
 }
diff --git a/jade-hard/version.json b/jade-hard/version.json
new file mode 100644
index 0000000..3348447
--- /dev/null
+++ b/jade-hard/version.json
@@ -0,0 +1,5 @@
+{
+  "major": 1,
+  "minor": 0,
+  "patch": 6
+}
diff --git a/jade/theme.package.json b/jade/theme.package.json
new file mode 100644
index 0000000..c32be26
--- /dev/null
+++ b/jade/theme.package.json
@@ -0,0 +1,4 @@
+{
+  "name": "Jade (soft light)",
+  "description": "A theme with jade stones for Sabaki"
+}
diff --git a/jade/theme/package.json b/jade/theme/package.json
index 21fc957..818d6f5 100644
--- a/jade/theme/package.json
+++ b/jade/theme/package.json
@@ -1,10 +1,9 @@
 {
   "name": "Jade (soft light)",
-  "version": "0.1.0",
   "description": "A theme with jade stones for Sabaki",
+  "version": "1.0.2",
   "author": "Bill Hails",
   "homepage": "https://github.com/billhails/SabakiThemes",
   "license": "CC0-1.0",
-  "homepage": "https://github.com/billhails/SabakiThemes",
   "main": "styles.css"
 }
diff --git a/jade/version.json b/jade/version.json
new file mode 100644
index 0000000..7975018
--- /dev/null
+++ b/jade/version.json
@@ -0,0 +1,5 @@
+{
+  "major": 1,
+  "minor": 0,
+  "patch": 2
+}
diff --git a/sakura/theme.package.json b/sakura/theme.package.json
new file mode 100644
index 0000000..b844323
--- /dev/null
+++ b/sakura/theme.package.json
@@ -0,0 +1,4 @@
+{
+  "name": "Sakura",
+  "description": "A Sakura (cherry blossom) theme for Sabaki"
+}
diff --git a/sakura/theme/package.json b/sakura/theme/package.json
index 25bf64e..ff1cdbb 100644
--- a/sakura/theme/package.json
+++ b/sakura/theme/package.json
@@ -1,9 +1,9 @@
 {
   "name": "Sakura",
-  "version": "0.1.4",
   "description": "A Sakura (cherry blossom) theme for Sabaki",
+  "version": "1.0.6",
   "author": "Bill Hails",
-  "license": "CC0-1.0",
   "homepage": "https://github.com/billhails/SabakiThemes",
+  "license": "CC0-1.0",
   "main": "styles.css"
 }
diff --git a/sakura/version.json b/sakura/version.json
new file mode 100644
index 0000000..3348447
--- /dev/null
+++ b/sakura/version.json
@@ -0,0 +1,5 @@
+{
+  "major": 1,
+  "minor": 0,
+  "patch": 6
+}
diff --git a/shell-slate-hard/theme.package.json b/shell-slate-hard/theme.package.json
new file mode 100644
index 0000000..1ec8038
--- /dev/null
+++ b/shell-slate-hard/theme.package.json
@@ -0,0 +1,4 @@
+{
+  "name": "Clamshell & Slate (Hard Light)",
+  "description": "A clamshell and slate theme for Sabaki"
+}
diff --git a/shell-slate-hard/theme/package.json b/shell-slate-hard/theme/package.json
index ad87f1f..a43b5f8 100644
--- a/shell-slate-hard/theme/package.json
+++ b/shell-slate-hard/theme/package.json
@@ -1,7 +1,7 @@
 {
   "name": "Clamshell & Slate (Hard Light)",
-  "version": "0.1.3",
   "description": "A clamshell and slate theme for Sabaki",
+  "version": "1.0.5",
   "author": "Bill Hails",
   "homepage": "https://github.com/billhails/SabakiThemes",
   "license": "CC0-1.0",
diff --git a/shell-slate-hard/version.json b/shell-slate-hard/version.json
new file mode 100644
index 0000000..31b6168
--- /dev/null
+++ b/shell-slate-hard/version.json
@@ -0,0 +1,5 @@
+{
+  "major": 1,
+  "minor": 0,
+  "patch": 5
+}
diff --git a/shell-slate/theme.package.json b/shell-slate/theme.package.json
new file mode 100644
index 0000000..ff80cd3
--- /dev/null
+++ b/shell-slate/theme.package.json
@@ -0,0 +1,4 @@
+{
+  "name": "Clamshell & Slate (soft light)",
+  "description": "A clamshell and slate theme for Sabaki"
+}
diff --git a/shell-slate/theme/package.json b/shell-slate/theme/package.json
index e13454a..0d9fd90 100644
--- a/shell-slate/theme/package.json
+++ b/shell-slate/theme/package.json
@@ -1,7 +1,7 @@
 {
   "name": "Clamshell & Slate (soft light)",
-  "version": "0.1.1",
   "description": "A clamshell and slate theme for Sabaki",
+  "version": "1.0.3",
   "author": "Bill Hails",
   "homepage": "https://github.com/billhails/SabakiThemes",
   "license": "CC0-1.0",
diff --git a/shell-slate/version.json b/shell-slate/version.json
new file mode 100644
index 0000000..31b3c97
--- /dev/null
+++ b/shell-slate/version.json
@@ -0,0 +1,5 @@
+{
+  "major": 1,
+  "minor": 0,
+  "patch": 3
+}
diff --git a/yuki/theme.package.json b/yuki/theme.package.json
new file mode 100644
index 0000000..b8b1a2f
--- /dev/null
+++ b/yuki/theme.package.json
@@ -0,0 +1,4 @@
+{
+  "name": "Yuki",
+  "description": "A theme with yuki-grade clamshell & slate stones for Sabaki"
+}
diff --git a/yuki/theme/package.json b/yuki/theme/package.json
index e7cc563..d70755f 100644
--- a/yuki/theme/package.json
+++ b/yuki/theme/package.json
@@ -1,10 +1,9 @@
 {
   "name": "Yuki",
-  "version": "0.1.1",
   "description": "A theme with yuki-grade clamshell & slate stones for Sabaki",
+  "version": "1.0.3",
   "author": "Bill Hails",
   "homepage": "https://github.com/billhails/SabakiThemes",
   "license": "CC0-1.0",
-  "homepage": "https://github.com/billhails/SabakiThemes",
   "main": "styles.css"
 }
diff --git a/yuki/version.json b/yuki/version.json
new file mode 100644
index 0000000..31b3c97
--- /dev/null
+++ b/yuki/version.json
@@ -0,0 +1,5 @@
+{
+  "major": 1,
+  "minor": 0,
+  "patch": 3
+}
diff --git a/yunzi-hard/theme.package.json b/yunzi-hard/theme.package.json
new file mode 100644
index 0000000..12f2820
--- /dev/null
+++ b/yunzi-hard/theme.package.json
@@ -0,0 +1,4 @@
+{
+  "name": "Yunzi (hard light)",
+  "description": "A theme with yunzi stones for Sabaki"
+}
diff --git a/yunzi-hard/theme/package.json b/yunzi-hard/theme/package.json
index 4107607..50a5149 100644
--- a/yunzi-hard/theme/package.json
+++ b/yunzi-hard/theme/package.json
@@ -1,7 +1,7 @@
 {
   "name": "Yunzi (hard light)",
-  "version": "0.1.3",
   "description": "A theme with yunzi stones for Sabaki",
+  "version": "1.0.5",
   "author": "Bill Hails",
   "homepage": "https://github.com/billhails/SabakiThemes",
   "license": "CC0-1.0",
diff --git a/yunzi-hard/version.json b/yunzi-hard/version.json
new file mode 100644
index 0000000..31b6168
--- /dev/null
+++ b/yunzi-hard/version.json
@@ -0,0 +1,5 @@
+{
+  "major": 1,
+  "minor": 0,
+  "patch": 5
+}
diff --git a/yunzi/theme.package.json b/yunzi/theme.package.json
new file mode 100644
index 0000000..b654182
--- /dev/null
+++ b/yunzi/theme.package.json
@@ -0,0 +1,4 @@
+{
+  "name": "Yunzi (soft light)",
+  "description": "A theme with yunzi stones for Sabaki"
+}
diff --git a/yunzi/theme/package.json b/yunzi/theme/package.json
index 253b1cd..ee89628 100644
--- a/yunzi/theme/package.json
+++ b/yunzi/theme/package.json
@@ -1,7 +1,7 @@
 {
   "name": "Yunzi (soft light)",
-  "version": "0.1.3",
   "description": "A theme with yunzi stones for Sabaki",
+  "version": "1.0.5",
   "author": "Bill Hails",
   "homepage": "https://github.com/billhails/SabakiThemes",
   "license": "CC0-1.0",
diff --git a/yunzi/version.json b/yunzi/version.json
new file mode 100644
index 0000000..31b6168
--- /dev/null
+++ b/yunzi/version.json
@@ -0,0 +1,5 @@
+{
+  "major": 1,
+  "minor": 0,
+  "patch": 5
+}