@inixiative/foundry-core 0.5.0 → 0.5.1
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/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { realpathSync } from 'node:fs';
|
|
1
|
+
import { existsSync, realpathSync } from 'node:fs';
|
|
2
2
|
import { realpath, stat } from 'node:fs/promises';
|
|
3
3
|
import { homedir } from 'node:os';
|
|
4
4
|
import { basename, dirname, extname, isAbsolute, join, relative, resolve, sep } from 'node:path';
|
|
@@ -33,6 +33,8 @@ export class MarkdownDocs {
|
|
|
33
33
|
/** Scan and load all matching files. */
|
|
34
34
|
async load(): Promise<Map<string, string>> {
|
|
35
35
|
const results = new Map<string, string>();
|
|
36
|
+
// A docs directory that doesn't exist yet (a fresh install's home) has no docs.
|
|
37
|
+
if (!existsSync(this.dir)) return results;
|
|
36
38
|
const scanner = new Bun.Glob(this.glob).scan({ cwd: this.dir, absolute: false });
|
|
37
39
|
|
|
38
40
|
for await (const relPath of scanner) {
|
|
@@ -65,6 +67,7 @@ export class MarkdownDocs {
|
|
|
65
67
|
/** List all matching files. */
|
|
66
68
|
async list(): Promise<string[]> {
|
|
67
69
|
const paths: string[] = [];
|
|
70
|
+
if (!existsSync(this.dir)) return paths;
|
|
68
71
|
const scanner = new Bun.Glob(this.glob).scan({ cwd: this.dir, absolute: false });
|
|
69
72
|
for await (const relPath of scanner) {
|
|
70
73
|
paths.push(relPath);
|