Skip to content

Commit

Permalink
Merge pull request #15 from UmbrellaDocs/bugfix-12
Browse files Browse the repository at this point in the history
Updated dependencies, local file check bug fix, version update
  • Loading branch information
gaurav-nelson authored Jan 12, 2024
2 parents 4b8f608 + c27b5c9 commit 2917682
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
Binary file modified bun.lockb
Binary file not shown.
8 changes: 6 additions & 2 deletions lib/batch-check-links.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import puppeteer from "puppeteer";
import url from "url";
import fs from "fs";
import path from "path";

let __dirname = path.resolve(path.dirname(''));

function isUrl(s) {
try {
Expand Down Expand Up @@ -34,7 +37,8 @@ async function processLink(link, page, aliveStatusCodes) {
}
} else {
try {
if (fs.existsSync(link.url)) {
let filePath = path.join(__dirname, link.url)
if (fs.existsSync(filePath)) {
linkStatus.status_code = "200";
linkStatus.status = "alive";
} else {
Expand All @@ -43,7 +47,7 @@ async function processLink(link, page, aliveStatusCodes) {
linkStatus.error_message = `Cannot find: ${link.url}.`
}
} catch (err){
console.error(`Error in checking if file ${link.url} exist!`)
console.error(`Error in checking if file ${link.url} exist! ${err}`)
}

}
Expand Down
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@umbrelladocs/linkspector",
"version": "0.2.3",
"version": "0.2.4",
"description": "Uncover broken links in your content.",
"type": "module",
"main": "linkspector.js",
Expand All @@ -21,16 +21,16 @@
},
"homepage": "https://github.com/UmbrellaDocs/linkspector#readme",
"dependencies": {
"commander": "^11.0.0",
"glob": "^10.3.4",
"ignore": "^5.2.4",
"joi": "^17.10.1",
"commander": "^11.1.0",
"glob": "^10.3.10",
"ignore": "^5.3.0",
"joi": "^17.11.0",
"js-yaml": "^4.1.0",
"kleur": "^4.1.5",
"ora": "^7.0.1",
"puppeteer": "^21.1.1",
"remark-gfm": "^3.0.1",
"remark-parse": "^10.0.2",
"unified": "^11.0.3"
"ora": "^8.0.1",
"puppeteer": "^21.7.0",
"remark-gfm": "^4.0.0",
"remark-parse": "^11.0.0",
"unified": "^11.0.4"
}
}

0 comments on commit 2917682

Please sign in to comment.