authorgravatar for git@paperclover.netclover caruso <git@paperclover.net> 2026-02-02 03:43:13-08:00
committergravatar for git@paperclover.netclover caruso <git@paperclover.net> 2026-02-02 03:50:47-08:00
logc776c2c6068df0f5910424eff3270e312f5f10ce
tree98944a6adaebc145d444a16813fb32f0230f6eee
parentd04d6837a37f36f46b8badbb14eb9f15c30d38b4
signature Signed by SSH key SHA256:xbd+BjjhyBfwk7GVoURf9Yx0gzDerHbvYv7SddNWmAs

feat: various changes during january friends blog

resolves #60

4 files changed, 20 insertions(+), 10 deletions(-)

run.js+8-5
......@@ -17,13 +17,13 @@ process.emit = function (event, error) {
1717
1818let hot;
1919try {
20 // required APIs
20 // zstd is not supported in node 22
2121 await new Promise((resolve) => zlib.zstdCompress(new Uint8Array(), resolve));
2222
23 // seems to fail in bun
23 // seems to fail in bun, run it earlier to catch
2424 (await import("source-map-support")).install({ hookRequire: true });
2525
26 // Init hooks
26 // init hooks. some runtimes have bugs here. and long term this system should be rebuilt
2727 hot = await import("./framework/hot.ts");
2828 hot.load("./lib/log.ts");
2929} catch (e) {
......@@ -70,9 +70,12 @@ if (process.argv[1].startsWith(import.meta.filename.slice(0, -".js".length))) {
7070 process.exit(1);
7171 }
7272 let found;
73 for (const dir of ["./", "./src/", "./framework/"]) {
73 for (const dir of fs.globSync("{lib,{src,framework},{src,lib}/**/bin}")) {
7474 try {
75 found = hot.resolveFrom(import.meta.filename, dir + process.argv[2]);
75 found = hot.resolveFrom(
76 import.meta.filename,
77 `./${dir}/${process.argv[2]}`,
78 );
7679 break;
7780 } catch (e) {
7881 continue;
src/bin/download-db.ts+2-2
......@@ -1,6 +1,6 @@
11export async function main() {
22 await rsync.spawn({
3 cwd: Path.resolve(import.meta.dirname).parent!.toString(),
3 cwd: Path.resolve("."),
44 args: [
55 "-a",
66 "--progress",
......@@ -10,7 +10,7 @@ export async function main() {
1010 progress: progress.start("download file cache"),
1111 });
1212 await rsync.spawn({
13 cwd: Path.resolve(import.meta.dirname).parent!.toString(),
13 cwd: Path.resolve("."),
1414 args: [
1515 "-a",
1616 "--progress",
src/file-viewer/rsync.ts+3-2
......@@ -25,7 +25,7 @@ export interface SpawnOptions {
2525 args: string[];
2626 rsync?: string;
2727 progress: progress.Node;
28 cwd?: string;
28 cwd?: Path;
2929}
3030
3131export async function spawn(options: SpawnOptions) {
......@@ -33,7 +33,7 @@ export async function spawn(options: SpawnOptions) {
3333 using node = options.progress;
3434 const proc = child_process.spawn(rsync, [...defaultExtraOptions, ...args], {
3535 stdio: ["ignore", "pipe", "pipe"],
36 cwd,
36 cwd: cwd?.toString(),
3737 });
3838 const parser = new Parse();
3939 let running = true;
......@@ -186,3 +186,4 @@ import events from "node:events";
186186import * as progress from "lib/progress.ts";
187187import { formatSize } from "@/file-viewer/format.ts";
188188import { UNWRAP } from "lib/assert.ts";
189import { Path } from "#sitegen/path";
src/tags/photo-grid.tsx+7-1
......@@ -12,6 +12,7 @@ export interface PhotoGridProps {
1212type Item = [img: string, options?: ItemOptions];
1313
1414interface ItemOptions {
15 s?: number;
1516 w?: number;
1617 h?: number;
1718 align?: keyof typeof alignments;
......@@ -55,9 +56,14 @@ export function PhotoGrid({
5556 let y = 0;
5657 let contents = [];
5758 for (const item of items) {
58 const [img, { w = 1, h = 1, align } = {}] = isArray(item) ? item : [item];
59 const [
60 img,
61 { w = 1, h = 1, align, s } = {},
62 ] = isArray(item) ? item : [item];
5963 if (w > width) throw new Error(`Item ${img} too wide (${w} > ${width})`);
6064
65 x += s ?? 0;
66
6167 while (anyCollide(x, y, w, h)) {
6268 x += 1;
6369 if (x > width - w) x = 0, y += 1;