markdown_link_checker_sc 0.0.141 → 0.0.142

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/index.js CHANGED
@@ -35,8 +35,8 @@ program
35
35
  )
36
36
  .option(
37
37
  "-d, --doc [directory]",
38
- "Docs root directory, relative to -r (such as `docs`). Defaults to '' (all docs in root of repo). Use -d as well to restrict search to a particular subfolder. Defaults to current directory.",
39
- process.cwd()
38
+ "Docs root directory, relative to -r (such as `docs`). Defaults to '' (all docs in root of repo).",
39
+ ""
40
40
  )
41
41
  .option(
42
42
  "-e, --subdir [directory]",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "markdown_link_checker_sc",
3
- "version": "0.0.141",
3
+ "version": "0.0.142",
4
4
  "description": "Markdown Link Checker",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -15,10 +15,13 @@ var otherFileTypes = []; // Just used for logging in function below.
15
15
  async function getAllImageFilesInDirectory(dir, options) {
16
16
  logFunction(options, `Function: getAllImageFilesInDirectory(${dir})`);
17
17
 
18
- // TODO put this all in a try catch and return a better error.
19
- // Or perhaps put around parent.
20
-
21
- const files = await fs.promises.readdir(dir, { withFileTypes: true });
18
+ let files;
19
+ try {
20
+ files = await fs.promises.readdir(dir, { withFileTypes: true });
21
+ } catch {
22
+ console.warn(`Warning: Image directory not found, skipping orphan check: ${dir}`);
23
+ return [];
24
+ }
22
25
  const images = [];
23
26
  for (let i = 0; i < files.length; i++) {
24
27
  const file = path.join(dir, files[i].name);