UNPKG

rehype-smart-links

Version:

A rehype plugin for Astro that adds different styling for internal and external links

26 lines (24 loc) 1.17 kB
#!/usr/bin/env node import { generateRoutesFile } from "./chunk-KIZMZHVW.js"; // src/cli.ts import { existsSync } from "fs"; import { resolve } from "path"; import process from "process"; import { Command } from "commander"; var program = new Command(); program.name("rehype-smart-links").description("CLI utility for rehype-smart-links").version("0.3.0"); program.command("build").description("Generate routes file from build directory").option("-d, --dir <path>", "Build directory path", "./dist").option("-o, --output <path>", "Output path for routes file", "./.smart-links-routes.json").option("-a, --all", "Include all files", false).option("-e, --extensions <ext...>", "File extensions to include (default: html)", ["html"]).action((options) => { const buildDir = resolve(process.cwd(), options.dir); const routesFile = resolve(process.cwd(), options.output); if (!existsSync(buildDir)) { console.error(`Error: Build directory '${buildDir}' does not exist.`); process.exit(1); } generateRoutesFile(buildDir, routesFile, { includeAllFiles: options.all, includeFileExtensions: options.extensions }); }); program.parse(process.argv);