this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

๐Ÿง‘โ€๐Ÿ’ป Improve db update commit message

+83 -1
+9
bun.lock
··· 17 17 "yaml": "^2.7.0", 18 18 }, 19 19 "devDependencies": { 20 + "@types/bun": "^1.2.23", 20 21 "@types/jsdom": "^27.0.0", 21 22 "@types/picomatch": "^4.0.0", 22 23 "@types/slug": "^5.0.9", ··· 239 240 240 241 "@swc/helpers": ["@swc/helpers@0.5.17", "", { "dependencies": { "tslib": "^2.8.0" } }, "sha512-5IKx/Y13RsYd+sauPb2x+U/xZikHjolzfuDgTAl/Tdf3Q8rslRvC19NKDLgAJQ6wsqADk10ntlv08nPFw/gO/A=="], 241 242 243 + "@types/bun": ["@types/bun@1.2.23", "", { "dependencies": { "bun-types": "1.2.23" } }, "sha512-le8ueOY5b6VKYf19xT3McVbXqLqmxzPXHsQT/q9JHgikJ2X22wyTW3g3ohz2ZMnp7dod6aduIiq8A14Xyimm0A=="], 244 + 242 245 "@types/debug": ["@types/debug@4.1.12", "", { "dependencies": { "@types/ms": "*" } }, "sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ=="], 243 246 244 247 "@types/estree": ["@types/estree@1.0.8", "", {}, "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w=="], ··· 264 267 "@types/node": ["@types/node@24.5.1", "", { "dependencies": { "undici-types": "~7.12.0" } }, "sha512-/SQdmUP2xa+1rdx7VwB9yPq8PaKej8TD5cQ+XfKDPWWC+VDJU4rvVVagXqKUzhKjtFoNA8rXDJAkCxQPAe00+Q=="], 265 268 266 269 "@types/picomatch": ["@types/picomatch@4.0.2", "", {}, "sha512-qHHxQ+P9PysNEGbALT8f8YOSHW0KJu6l2xU8DYY0fu/EmGxXdVnuTLvFUvBgPJMSqXq29SYHveejeAha+4AYgA=="], 270 + 271 + "@types/react": ["@types/react@19.2.0", "", { "dependencies": { "csstype": "^3.0.2" } }, "sha512-1LOH8xovvsKsCBq1wnT4ntDUdCJKmnEakhsuoUSy6ExlHCkGP2hqnatagYTgFk6oeL0VU31u7SNjunPN+GchtA=="], 267 272 268 273 "@types/sax": ["@types/sax@1.2.7", "", { "dependencies": { "@types/node": "*" } }, "sha512-rO73L89PJxeYM3s3pPPjiPgVVcymqU490g0YO5n5By0k2Erzj6tay/4lr1CHAAU4JyOWd1rpQ8bCf6cZfHU96A=="], 269 274 ··· 321 326 322 327 "brotli": ["brotli@1.3.3", "", { "dependencies": { "base64-js": "^1.1.2" } }, "sha512-oTKjJdShmDuGW94SyyaoQvAjf30dZaHnjJ8uAF+u2/vGJkJbJPJAT1gDiOJP5v1Zb6f9KEyW/1HpuaWIXtGHPg=="], 323 328 329 + "bun-types": ["bun-types@1.2.23", "", { "dependencies": { "@types/node": "*" }, "peerDependencies": { "@types/react": "^19" } }, "sha512-R9f0hKAZXgFU3mlrA0YpE/fiDvwV0FT9rORApt2aQVWSuJDzZOyB5QLc0N/4HF57CS8IXJ6+L5E4W1bW6NS2Aw=="], 330 + 324 331 "call-bind": ["call-bind@1.0.8", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.0", "es-define-property": "^1.0.0", "get-intrinsic": "^1.2.4", "set-function-length": "^1.2.2" } }, "sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww=="], 325 332 326 333 "call-bind-apply-helpers": ["call-bind-apply-helpers@1.0.2", "", { "dependencies": { "es-errors": "^1.3.0", "function-bind": "^1.1.2" } }, "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ=="], ··· 382 389 "cssesc": ["cssesc@3.0.0", "", { "bin": { "cssesc": "bin/cssesc" } }, "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg=="], 383 390 384 391 "cssstyle": ["cssstyle@5.3.1", "", { "dependencies": { "@asamuzakjp/css-color": "^4.0.3", "@csstools/css-syntax-patches-for-csstree": "^1.0.14", "css-tree": "^3.1.0" } }, "sha512-g5PC9Aiph9eiczFpcgUhd9S4UUO3F+LHGRIi5NUMZ+4xtoIYbHNZwZnWA2JsFGe8OU8nl4WyaEFiZuGuxlutJQ=="], 392 + 393 + "csstype": ["csstype@3.1.3", "", {}, "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw=="], 385 394 386 395 "data-urls": ["data-urls@6.0.0", "", { "dependencies": { "whatwg-mimetype": "^4.0.0", "whatwg-url": "^15.0.0" } }, "sha512-BnBS08aLUM+DKamupXs3w2tJJoqU+AkaE/+6vQxi/G/DPmIZFJJp9Dkb1kM03AZx8ADehDUZgsNxju3mPXZYIA=="], 387 396
+72
commit-database-changes.ts
··· 1 + import { $ } from "bun"; 2 + 3 + const database = Bun.file("./works.json"); 4 + 5 + // Get current works.json 6 + const newDatabase = await database 7 + .text() 8 + .then((text) => JSON.parse(text)) 9 + .then((parsed) => Object.values(parsed)); 10 + 11 + // Get works.json before whats staged 12 + // Hide staged changes 13 + await $`git stash push --staged`; 14 + 15 + const oldDatabase = await database 16 + .text() 17 + .then((text) => JSON.parse(text)) 18 + .then((parsed) => Object.values(parsed)); 19 + 20 + // Reapply staged changes 21 + await $`git stash apply`; 22 + await $`git add works.json`; 23 + 24 + const added = new Set<string>(); 25 + const removed = new Set<string>(); 26 + const changed = new Set<string>(); 27 + 28 + function compareEntries(a: any, b: any) { 29 + delete a.builtAt; 30 + delete a.descriptionHash; 31 + delete b.builtAt; 32 + delete b.descriptionHash; 33 + return JSON.stringify(a) === JSON.stringify(b); 34 + } 35 + 36 + for (const newEntry of newDatabase) { 37 + const oldEntry = oldDatabase.find((e: any) => e.id === newEntry.id); 38 + if (!oldEntry) { 39 + added.add(newEntry.id); 40 + } else if (!compareEntries(newEntry, oldEntry)) { 41 + changed.add(newEntry.id); 42 + } 43 + } 44 + 45 + for (const oldEntry of oldDatabase) { 46 + const newEntry = newDatabase.find((e: any) => e.id === oldEntry.id); 47 + if (!newEntry) { 48 + removed.add(oldEntry.id); 49 + } 50 + } 51 + 52 + let message = []; 53 + 54 + if (added.size > 0) { 55 + message.push(`add ${Array.from(added).sort().join(", ")}`); 56 + } 57 + 58 + if (removed.size > 0) { 59 + message.push(`remove ${Array.from(removed).sort().join(", ")}`); 60 + } 61 + 62 + if (changed.size > 0) { 63 + message.push(`update ${Array.from(changed).sort().join(", ")}`); 64 + } 65 + 66 + if (message.length === 0) { 67 + message.push("no significant changes"); 68 + } 69 + 70 + message[0] = message[0][0].toUpperCase() + message[0].slice(1); 71 + 72 + Bun.spawnSync(["git", "commit", "-m", `๐Ÿ—ƒ๏ธ ${message.join(", ")}`]);
+2 -1
package.json
··· 10 10 "format": "prettier --write .", 11 11 "database": "ortfodb --config ./ortfodb.yaml --scattered build works.json", 12 12 "formatdb": "bunx prettier --write works.json", 13 - "db": "bun database && bun formatdb && git add works.json && git commit -m '๐Ÿ—ƒ๏ธ Update database' && git push", 13 + "db": "bun database && bun formatdb && git add works.json && bun run ./commit-database-changes.ts && git push", 14 14 "mediaup": "rclone --progress copy media/ www:media.gwen.works/", 15 15 "postinstall": "patch-package && husky" 16 16 }, ··· 31 31 "yaml": "^2.7.0" 32 32 }, 33 33 "devDependencies": { 34 + "@types/bun": "^1.2.23", 34 35 "@types/jsdom": "^27.0.0", 35 36 "@types/picomatch": "^4.0.0", 36 37 "@types/slug": "^5.0.9",