vector-framework 0.9.0 → 0.9.2

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.
@@ -1,4 +1,4 @@
1
- import { promises as fs } from 'node:fs';
1
+ import { existsSync, promises as fs } from 'node:fs';
2
2
  import { join, relative, resolve, sep } from 'node:path';
3
3
  import type { GeneratedRoute } from '../types';
4
4
 
@@ -6,17 +6,29 @@ export class RouteScanner {
6
6
  private routesDir: string;
7
7
 
8
8
  constructor(routesDir = './routes') {
9
+ // Always resolve from the current working directory (user's project)
9
10
  this.routesDir = resolve(process.cwd(), routesDir);
10
11
  }
11
12
 
12
13
  async scan(): Promise<GeneratedRoute[]> {
13
14
  const routes: GeneratedRoute[] = [];
14
15
 
16
+ // Check if routes directory exists before attempting to scan
17
+ if (!existsSync(this.routesDir)) {
18
+ console.log(` → Routes directory not found: ${this.routesDir}`);
19
+ console.log(' → No routes will be auto-discovered');
20
+ return [];
21
+ }
22
+
15
23
  try {
24
+ console.log(` → Scanning routes from: ${this.routesDir}`);
16
25
  await this.scanDirectory(this.routesDir, routes);
26
+ if (routes.length > 0) {
27
+ console.log(` ✓ Found ${routes.length} route${routes.length === 1 ? '' : 's'}`);
28
+ }
17
29
  } catch (error) {
18
30
  if ((error as any).code === 'ENOENT') {
19
- console.warn(`Routes directory not found: ${this.routesDir}`);
31
+ console.warn(`Routes directory not accessible: ${this.routesDir}`);
20
32
  return [];
21
33
  }
22
34
  throw error;