@aravindc26/velu 0.11.12 โ†’ 0.11.14

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.
Files changed (3) hide show
  1. package/package.json +1 -1
  2. package/src/build.ts +41 -13
  3. package/src/cli.ts +23 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aravindc26/velu",
3
- "version": "0.11.12",
3
+ "version": "0.11.14",
4
4
  "description": "A modern documentation site generator powered by Markdown and JSON configuration",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/build.ts CHANGED
@@ -137,6 +137,9 @@ interface VeluRedirect {
137
137
 
138
138
  interface VeluConfig {
139
139
  $schema?: string;
140
+ name?: string;
141
+ title?: string;
142
+ description?: string;
140
143
  theme?: string;
141
144
  variables?: Record<string, string>;
142
145
  colors?: VeluColors;
@@ -587,7 +590,7 @@ const STATIC_EXTENSIONS = new Set([
587
590
  ".zip",
588
591
  ]);
589
592
 
590
- function copyStaticAssets(docsDir: string, publicDir: string) {
593
+ function copyStaticAssets(docsDir: string, publicDir: string) {
591
594
  function walk(dir: string) {
592
595
  const entries = readdirSync(dir, { withFileTypes: true });
593
596
  for (const entry of entries) {
@@ -611,12 +614,35 @@ function copyStaticAssets(docsDir: string, publicDir: string) {
611
614
  }
612
615
  }
613
616
 
614
- walk(docsDir);
615
- }
616
-
617
- function toPosixPath(value: string): string {
618
- return value.replace(/\\/g, "/");
619
- }
617
+ walk(docsDir);
618
+ }
619
+
620
+ function resolveProjectName(config: VeluConfig): string {
621
+ const fromName = typeof config.name === "string" ? config.name.trim() : "";
622
+ if (fromName) return fromName;
623
+ const fromTitle = typeof config.title === "string" ? config.title.trim() : "";
624
+ if (fromTitle) return fromTitle;
625
+ return "Documentation";
626
+ }
627
+
628
+ function resolveProjectDescription(config: VeluConfig): string {
629
+ if (typeof config.description === "string") return config.description.trim();
630
+ return "";
631
+ }
632
+
633
+ function writeProjectConstFile(config: VeluConfig, outDir: string) {
634
+ const constPayload = {
635
+ name: resolveProjectName(config),
636
+ description: resolveProjectDescription(config),
637
+ };
638
+
639
+ const constPath = join(outDir, "public", "const.json");
640
+ writeFileSync(constPath, `${JSON.stringify(constPayload, null, 2)}\n`, "utf-8");
641
+ }
642
+
643
+ function toPosixPath(value: string): string {
644
+ return value.replace(/\\/g, "/");
645
+ }
620
646
 
621
647
  function isInsideDocsRoot(docsDir: string, targetPath: string): boolean {
622
648
  const relPath = relative(docsDir, targetPath);
@@ -1167,12 +1193,14 @@ function build(docsDir: string, outDir: string) {
1167
1193
  console.log(`๐Ÿ“‹ Copied ${configName} as ${PRIMARY_CONFIG_NAME} (and legacy ${LEGACY_CONFIG_NAME})`);
1168
1194
 
1169
1195
  // โ”€โ”€ 3b. Copy static assets from docs project into public/ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
1170
- copyStaticAssets(docsDir, join(outDir, "public"));
1171
- writeRedirectArtifacts(config, outDir);
1172
- if ((config.redirects ?? []).length > 0) {
1173
- console.log("โ†ช๏ธ Generated redirect artifacts");
1174
- }
1175
- console.log("๐Ÿ–ผ๏ธ Copied static assets");
1196
+ copyStaticAssets(docsDir, join(outDir, "public"));
1197
+ writeRedirectArtifacts(config, outDir);
1198
+ writeProjectConstFile(rawConfig, outDir);
1199
+ if ((config.redirects ?? []).length > 0) {
1200
+ console.log("โ†ช๏ธ Generated redirect artifacts");
1201
+ }
1202
+ console.log("๐Ÿงพ Generated const.json");
1203
+ console.log("๐Ÿ–ผ๏ธ Copied static assets");
1176
1204
 
1177
1205
  // โ”€โ”€ 4. Build content + metadata artifacts โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
1178
1206
  const contentDir = join(outDir, "content", "docs");
package/src/cli.ts CHANGED
@@ -334,6 +334,24 @@ function collectMarkdownPaths(distDir: string): string[] {
334
334
  return Array.from(markdownPaths).sort((a, b) => a.localeCompare(b));
335
335
  }
336
336
 
337
+ function addLlmsTextAliases(distDir: string): number {
338
+ const mappings: Array<{ source: string; target: string }> = [
339
+ { source: "llms-file", target: "llms.txt" },
340
+ { source: "llms-full-file", target: "llms-full.txt" },
341
+ ];
342
+
343
+ let added = 0;
344
+ for (const { source, target } of mappings) {
345
+ const sourcePath = join(distDir, source);
346
+ const targetPath = join(distDir, target);
347
+ if (!existsSync(sourcePath) || existsSync(targetPath)) continue;
348
+ copyFileSync(sourcePath, targetPath);
349
+ added += 1;
350
+ }
351
+
352
+ return added;
353
+ }
354
+
337
355
  function addStaticRouteCompatibility(outDir: string) {
338
356
  const distDir = join(outDir, "dist");
339
357
  if (!existsSync(distDir)) return;
@@ -419,6 +437,11 @@ function addStaticRouteCompatibility(outDir: string) {
419
437
  console.log(`๐Ÿ“„ Added inline markdown headers for ${mdPaths.length} .md routes`);
420
438
  }
421
439
 
440
+ const llmsAliasesAdded = addLlmsTextAliases(distDir);
441
+ if (llmsAliasesAdded > 0) {
442
+ console.log(`๐Ÿค– Added ${llmsAliasesAdded} llms text aliases (.txt)`);
443
+ }
444
+
422
445
  console.log(`๐Ÿ” Added static compatibility for ${routes.length} routes (${aliasCount} .html aliases, ${redirectAdded} redirects)`);
423
446
  }
424
447