CLI tool to sync your Markdown to Leaflet
leafletpub atproto cli markdown

Use isBun for Bun checks

+5 -5
+2 -2
src/cli.ts
··· 7 7 import { version } from "../package.json" with { type: "json" }; 8 8 9 9 import dotenv from "dotenv"; 10 - import { isCI } from "std-env"; 11 - if (!("Bun" in globalThis)) dotenv.config({ quiet: true }); 10 + import { isBun, isCI } from "std-env"; 11 + if (!isBun) dotenv.config({ quiet: true }); 12 12 13 13 const consolaOptions = consola.options; 14 14 consolaOptions.formatOptions.date = false;
+1 -2
src/commands/sync-cmd.ts
··· 278 278 const frontmatter = ast.children.find((val) => val.type == "yaml"); 279 279 if (!frontmatter) throw new Error(`Could not find frontmatter for ${file}`); 280 280 281 - const frontmatterData = 282 - "Bun" in globalThis ? (Bun.YAML.parse(frontmatter.value) as any) : parse(frontmatter.value); 281 + const frontmatterData = isBun ? (Bun.YAML.parse(frontmatter.value) as any) : parse(frontmatter.value); 283 282 if (!frontmatterData[config.frontmatter.titleKey]) 284 283 throw new Error(`Could not find title in frontmatter for ${file}`); 285 284 title = frontmatterData[config.frontmatter.titleKey];
+2 -1
src/utils.ts
··· 2 2 import { createJiti } from "jiti"; 3 3 import { join } from "node:path"; 4 4 import type { Config } from "./config"; 5 + import { isBun } from "std-env"; 5 6 6 7 export const jiti = createJiti(import.meta.url); 7 8 ··· 15 16 } 16 17 17 18 export async function readJson(path: string | URL) { 18 - if ("Bun" in globalThis) return await Bun.file(path).json(); 19 + if (isBun) return await Bun.file(path).json(); 19 20 20 21 return JSON.parse((await readFile(path)).toString()); 21 22 }