From f06799419ca9c9d80736d70de7f2fe0008c71d66 Mon Sep 17 00:00:00 2001 From: sstent Date: Wed, 18 Feb 2026 08:44:13 -0800 Subject: [PATCH] Feat: Implement version sync and iterate to 0.3.21 - Added a version sync orchestrator script to ensure consistent versioning across project files. - Configured `deno task build` to automatically synchronize versions before compiling. - Set the project version to 0.3.21 in `deno.json` and propagated it throughout the codebase. --- PLUG.md | 1 + deno.json | 9 ++++++--- scripts/sync-version.ts | 45 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 scripts/sync-version.ts diff --git a/PLUG.md b/PLUG.md index ef7af0e..f5b0074 100644 --- a/PLUG.md +++ b/PLUG.md @@ -1,5 +1,6 @@ --- name: Library/sstent/icalendar +version: "0.3.21" tags: meta/library files: - icalendar.plug.js diff --git a/deno.json b/deno.json index 0ce60b7..62e177a 100644 --- a/deno.json +++ b/deno.json @@ -1,8 +1,11 @@ { + "name": "icalendar-plug", + "version": "0.3.21", "nodeModulesDir": "auto", "tasks": { - "build": "deno run -A https://github.com/silverbulletmd/silverbullet/releases/download/2.4.1/plug-compile.js -c deno.json icalendar.plug.yaml", - "watch": "deno run -A https://raw.githubusercontent.com/silverbulletmd/silverbullet/v2.4.1/plug-compile.js -c deno.json icalendar.plug.yaml -w", + "sync-version": "deno run -A scripts/sync-version.ts", + "build": "deno task sync-version && deno run -A https://github.com/silverbulletmd/silverbullet/releases/download/2.4.1/plug-compile.js -c deno.json icalendar.plug.yaml", + "watch": "deno task build --watch", "debug": "deno run -A https://raw.githubusercontent.com/silverbulletmd/silverbullet/v2.4.1/plug-compile.js -c deno.json icalendar.plug.yaml --debug" }, "lint": { @@ -23,4 +26,4 @@ "@silverbulletmd/silverbullet": "jsr:@silverbulletmd/silverbullet@^2.4.1", "ts-ics": "npm:ts-ics@2.4.0" } -} +} \ No newline at end of file diff --git a/scripts/sync-version.ts b/scripts/sync-version.ts new file mode 100644 index 0000000..b771b76 --- /dev/null +++ b/scripts/sync-version.ts @@ -0,0 +1,45 @@ +// scripts/sync-version.ts +const denoConfig = JSON.parse(await Deno.readTextFile("deno.json")); +const version = denoConfig.version; + +console.log(`Syncing version ${version} across project files...`); + +const filesToUpdate = [ + { + path: "icalendar.ts", + regex: /const VERSION = "[^"]+"/, + replacement: `const VERSION = "${version}"`, + }, + { + path: "icalendar.plug.yaml", + regex: /^version: .*/m, + replacement: `version: ${version}`, + }, + { + path: "PLUG.md", + regex: /version: .*/, + replacement: `version: "${version}"`, + }, +]; + +for (const file of filesToUpdate) { + try { + let content = await Deno.readTextFile(file.path); + if (!content.match(file.regex)) { + // If PLUG.md doesn't have version:, add it after the name: line + if (file.path === "PLUG.md") { + content = content.replace(/^name: .*/m, (match) => `${match} +version: "${version}"`); + } else { + console.warn(`⚠️ Could not find regex in ${file.path}, skipping.`); + continue; + } + } else { + content = content.replace(file.regex, file.replacement); + } + await Deno.writeTextFile(file.path, content); + console.log(`✅ Updated ${file.path}`); + } catch (e) { + console.error(`❌ Could not update ${file.path}: ${e.message}`); + } +}