Feat: Implement version sync and iterate to 0.3.21
All checks were successful
Build SilverBullet Plug / build (push) Successful in 27s

- 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.
This commit is contained in:
2026-02-18 08:44:13 -08:00
parent d1079bd302
commit f06799419c
3 changed files with 52 additions and 3 deletions

View File

@@ -1,5 +1,6 @@
---
name: Library/sstent/icalendar
version: "0.3.21"
tags: meta/library
files:
- icalendar.plug.js

View File

@@ -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"
}
}
}

45
scripts/sync-version.ts Normal file
View File

@@ -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}`);
}
}