prev-cli 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -82,7 +82,7 @@ function fileToRoute(file) {
82
82
  return "/" + withoutExt;
83
83
  }
84
84
  async function scanPages(rootDir) {
85
- const files = await fg.glob("**/*.mdx", {
85
+ const files = await fg.glob("**/*.{md,mdx}", {
86
86
  cwd: rootDir,
87
87
  ignore: ["node_modules/**", "dist/**", ".cache/**"]
88
88
  });
@@ -164,7 +164,7 @@ function pagesPlugin(rootDir) {
164
164
  }
165
165
  },
166
166
  handleHotUpdate({ file, server }) {
167
- if (file.endsWith(".mdx")) {
167
+ if (file.endsWith(".mdx") || file.endsWith(".md")) {
168
168
  const mod = server.moduleGraph.getModuleById(RESOLVED_VIRTUAL_MODULE_ID);
169
169
  if (mod) {
170
170
  server.moduleGraph.invalidateModule(mod);
@@ -482,7 +482,7 @@ function printWelcome(type) {
482
482
  }
483
483
  function printReady() {
484
484
  console.log();
485
- console.log(" Edit your .mdx files and see changes instantly.");
485
+ console.log(" Edit your .md/.mdx files and see changes instantly.");
486
486
  console.log(" Press Ctrl+C to stop.");
487
487
  console.log();
488
488
  }
@@ -537,12 +537,13 @@ var { values, positionals } = parseArgs({
537
537
  options: {
538
538
  port: { type: "string", short: "p" },
539
539
  days: { type: "string", short: "d" },
540
+ cwd: { type: "string", short: "c" },
540
541
  help: { type: "boolean", short: "h" }
541
542
  },
542
543
  allowPositionals: true
543
544
  });
544
545
  var command = positionals[0] || "dev";
545
- var rootDir = positionals[1] || process.cwd();
546
+ var rootDir = values.cwd || positionals[1] || process.cwd();
546
547
  function printHelp() {
547
548
  console.log(`
548
549
  prev - Zero-config documentation site generator
@@ -557,6 +558,7 @@ Commands:
557
558
  clean Remove old cache directories
558
559
 
559
560
  Options:
561
+ -c, --cwd <path> Set working directory
560
562
  -p, --port <port> Specify port (dev/preview)
561
563
  -d, --days <days> Cache age threshold for clean (default: 30)
562
564
  -h, --help Show this help message
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prev-cli",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Transform MDX directories into beautiful documentation websites",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -54,7 +54,7 @@ function convertToPageTree(items: any[]): PageTree.Root {
54
54
  }
55
55
 
56
56
  // Dynamic imports for MDX pages
57
- const pageModules = import.meta.glob('/**/*.mdx', { eager: true })
57
+ const pageModules = import.meta.glob('/**/*.{md,mdx}', { eager: true })
58
58
 
59
59
  function getPageComponent(file: string): React.ComponentType | null {
60
60
  const mod = pageModules[`/${file}`] as { default: React.ComponentType } | undefined