From 9a87e7825a4050ff7cc447d1bf9afce6d083bcfe Mon Sep 17 00:00:00 2001 From: Nathan McCarty Date: Fri, 7 Feb 2025 02:02:40 -0500 Subject: [PATCH] Sort json keys --- db/meta.json | 4 ++-- db/posts/0.json | 14 +++++++------- db/posts/1.json | 6 +++--- db/posts/2.json | 16 ++++++++-------- db/posts/3.json | 12 ++++++------ lib/DB.rakumod | 4 ++-- 6 files changed, 28 insertions(+), 28 deletions(-) diff --git a/db/meta.json b/db/meta.json index eeef098..2aae88d 100644 --- a/db/meta.json +++ b/db/meta.json @@ -1,7 +1,7 @@ { - "title": "Stranger Systems", + "about-id": 2, "base-url": "https://www.stranger.systems", "placeholder-id": 0, "tagline": "Making software better by making it weird", - "about-id": 2 + "title": "Stranger Systems" } \ No newline at end of file diff --git a/db/posts/0.json b/db/posts/0.json index 6f07b26..d978506 100644 --- a/db/posts/0.json +++ b/db/posts/0.json @@ -1,12 +1,12 @@ { - "source": "/dev/null", - "hidden": true, - "slugs": [ - ], - "posted-at": "2025-02-05T04:54:41.218425-05:00", "edited-at": [ ], - "tags": [ + "hidden": true, + "placeholder": true, + "posted-at": "2025-02-05T04:54:41.218425-05:00", + "slugs": [ ], - "placeholder": true + "source": "/dev/null", + "tags": [ + ] } \ No newline at end of file diff --git a/db/posts/1.json b/db/posts/1.json index dc60a5b..56936ec 100644 --- a/db/posts/1.json +++ b/db/posts/1.json @@ -1,12 +1,12 @@ { - "slugs": [ - ], - "source": "/home/nathan/Projects/Blog/projects/Markdown/MyNewBlog.md", "edited-at": [ ], "hidden": false, "markdown": true, "posted-at": "2025-02-05T06:00:49.553777-05:00", + "slugs": [ + ], + "source": "/home/nathan/Projects/Blog/projects/Markdown/MyNewBlog.md", "tags": [ "meta" ] diff --git a/db/posts/2.json b/db/posts/2.json index 617775d..fa46788 100644 --- a/db/posts/2.json +++ b/db/posts/2.json @@ -1,12 +1,12 @@ { - "markdown": true, - "tags": [ - ], - "source": "/home/nathan/Projects/Blog/projects/Markdown/About.md", - "slugs": [ - ], - "posted-at": "2025-02-05T06:01:16.693698-05:00", "edited-at": [ ], - "hidden": true + "hidden": true, + "markdown": true, + "posted-at": "2025-02-05T06:01:16.693698-05:00", + "slugs": [ + ], + "source": "/home/nathan/Projects/Blog/projects/Markdown/About.md", + "tags": [ + ] } \ No newline at end of file diff --git a/db/posts/3.json b/db/posts/3.json index f9e475d..527339e 100644 --- a/db/posts/3.json +++ b/db/posts/3.json @@ -1,13 +1,13 @@ { - "markdown": true, - "source": "/home/nathan/Projects/Blog/projects/Markdown/CryptoSuite.md", - "tags": [ - "cryptography" - ], "edited-at": [ ], + "hidden": false, + "markdown": true, "posted-at": "2021-11-29T00:00:00Z", "slugs": [ ], - "hidden": false + "source": "/home/nathan/Projects/Blog/projects/Markdown/CryptoSuite.md", + "tags": [ + "cryptography" + ] } \ No newline at end of file diff --git a/lib/DB.rakumod b/lib/DB.rakumod index 88a1140..c3c5426 100644 --- a/lib/DB.rakumod +++ b/lib/DB.rakumod @@ -62,10 +62,10 @@ class PostDB { mkdir $posts-dir unless $posts-dir.e; # Write out metadata # TODO: Track changes and only write changed files - $dir.add('meta.json').spurt: $!meta.to-json; + $dir.add('meta.json').spurt: $!meta.to-json(:sorted-keys); # Write out posts (ids are the filename) for %!posts.kv -> $key, $value { - $posts-dir.add("$key.json").spurt: $value.to-json; + $posts-dir.add("$key.json").spurt: $value.to-json(:sorted-keys); } }