linkinator
Advanced tools
Comparing version 3.1.0 to 4.0.0
@@ -5,3 +5,2 @@ #!/usr/bin/env node | ||
import chalk from 'chalk'; | ||
import jsonexport from 'jsonexport'; | ||
import fs from 'fs'; | ||
@@ -127,2 +126,6 @@ import { URL } from 'url'; | ||
const checker = new LinkChecker(); | ||
if (format === Format.CSV) { | ||
const header = 'url,status,state,parent,failureDetails'; | ||
console.log(header); | ||
} | ||
checker.on('retry', (info) => { | ||
@@ -147,2 +150,8 @@ logger.warn(`Retrying: ${info.url} in ${info.secondsUntilRetry} seconds.`); | ||
} | ||
if (format === Format.CSV) { | ||
const showIt = shouldShowResult(link, verbosity); | ||
if (showIt) { | ||
console.log(`"${link.url}",${link.status},${link.state},"${link.parent || ''}","${link.failureDetails || ''}"`); | ||
} | ||
} | ||
}); | ||
@@ -186,15 +195,3 @@ const opts = { | ||
const result = await checker.check(opts); | ||
const filteredResults = result.links.filter(link => { | ||
switch (link.state) { | ||
case LinkState.OK: | ||
return verbosity <= LogLevel.WARNING; | ||
case LinkState.BROKEN: | ||
if (verbosity > LogLevel.DEBUG) { | ||
link.failureDetails = undefined; | ||
} | ||
return verbosity <= LogLevel.ERROR; | ||
case LinkState.SKIPPED: | ||
return verbosity <= LogLevel.INFO; | ||
} | ||
}); | ||
const filteredResults = result.links.filter(link => shouldShowResult(link, verbosity)); | ||
if (format === Format.JSON) { | ||
@@ -206,5 +203,2 @@ result.links = filteredResults; | ||
else if (format === Format.CSV) { | ||
result.links = filteredResults; | ||
const csv = await jsonexport(result.links); | ||
console.log(csv); | ||
return; | ||
@@ -314,3 +308,16 @@ } | ||
} | ||
function shouldShowResult(link, verbosity) { | ||
switch (link.state) { | ||
case LinkState.OK: | ||
return verbosity <= LogLevel.WARNING; | ||
case LinkState.BROKEN: | ||
if (verbosity > LogLevel.DEBUG) { | ||
link.failureDetails = undefined; | ||
} | ||
return verbosity <= LogLevel.ERROR; | ||
case LinkState.SKIPPED: | ||
return verbosity <= LogLevel.INFO; | ||
} | ||
} | ||
main(); | ||
//# sourceMappingURL=cli.js.map |
{ | ||
"name": "linkinator", | ||
"description": "Find broken links, missing images, etc in your HTML. Scurry around your site and find all those broken links.", | ||
"version": "3.1.0", | ||
"version": "4.0.0", | ||
"license": "MIT", | ||
@@ -31,3 +31,2 @@ "repository": "JustinBeckwith/linkinator", | ||
"htmlparser2": "^8.0.1", | ||
"jsonexport": "^3.2.0", | ||
"marked": "^4.0.3", | ||
@@ -37,9 +36,7 @@ "meow": "^10.1.1", | ||
"server-destroy": "^1.0.1", | ||
"update-notifier": "^5.1.0" | ||
"update-notifier": "^6.0.0" | ||
}, | ||
"devDependencies": { | ||
"@types/chai": "^4.2.22", | ||
"@types/escape-html": "^1.0.1", | ||
"@types/glob": "^7.2.0", | ||
"@types/jsonexport": "^3.0.2", | ||
"@types/marked": "^4.0.0", | ||
@@ -51,8 +48,7 @@ "@types/mime": "^2.0.3", | ||
"@types/sinon": "^10.0.6", | ||
"@types/update-notifier": "^5.1.0", | ||
"@types/update-notifier": "^6.0.0", | ||
"c8": "^7.10.0", | ||
"chai": "^4.3.4", | ||
"codecov": "^3.8.2", | ||
"execa": "^6.0.0", | ||
"gts": "^3.1.0", | ||
"gts": "^4.0.0", | ||
"mocha": "^10.0.0", | ||
@@ -67,3 +63,3 @@ "nock": "^13.2.1", | ||
"engines": { | ||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0" | ||
"node": ">=14" | ||
}, | ||
@@ -70,0 +66,0 @@ "files": [ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
105711
10
20
1428
+ Added@pnpm/config.env-replace@1.1.0(transitive)
+ Added@pnpm/network.ca-file@1.0.2(transitive)
+ Added@pnpm/npm-conf@2.3.1(transitive)
+ Added@sindresorhus/is@5.6.0(transitive)
+ Added@szmarczak/http-timer@5.0.1(transitive)
+ Added@types/http-cache-semantics@4.0.4(transitive)
+ Addedansi-regex@6.1.0(transitive)
+ Addedansi-styles@6.2.1(transitive)
+ Addedboxen@7.1.1(transitive)
+ Addedcacheable-lookup@7.0.0(transitive)
+ Addedcacheable-request@10.2.14(transitive)
+ Addedcamelcase@7.0.1(transitive)
+ Addedci-info@3.9.0(transitive)
+ Addedcli-boxes@3.0.0(transitive)
+ Addedconfig-chain@1.1.13(transitive)
+ Addedconfigstore@6.0.0(transitive)
+ Addedcrypto-random-string@4.0.0(transitive)
+ Addeddecompress-response@6.0.0(transitive)
+ Addeddefer-to-connect@2.0.1(transitive)
+ Addeddot-prop@6.0.1(transitive)
+ Addedeastasianwidth@0.2.0(transitive)
+ Addedemoji-regex@9.2.2(transitive)
+ Addedescape-goat@4.0.0(transitive)
+ Addedform-data-encoder@2.1.4(transitive)
+ Addedget-stream@6.0.1(transitive)
+ Addedgot@12.6.1(transitive)
+ Addedgraceful-fs@4.2.10(transitive)
+ Addedhas-yarn@3.0.0(transitive)
+ Addedhttp2-wrapper@2.2.1(transitive)
+ Addedimport-lazy@4.0.0(transitive)
+ Addedis-ci@3.0.1(transitive)
+ Addedis-npm@6.0.0(transitive)
+ Addedis-yarn-global@0.4.1(transitive)
+ Addedjson-buffer@3.0.1(transitive)
+ Addedkeyv@4.5.4(transitive)
+ Addedlatest-version@7.0.0(transitive)
+ Addedlowercase-keys@3.0.0(transitive)
+ Addedmimic-response@3.1.04.0.0(transitive)
+ Addednormalize-url@8.0.1(transitive)
+ Addedp-cancelable@3.0.0(transitive)
+ Addedpackage-json@8.1.1(transitive)
+ Addedproto-list@1.2.4(transitive)
+ Addedpupa@3.1.0(transitive)
+ Addedregistry-auth-token@5.0.2(transitive)
+ Addedregistry-url@6.0.1(transitive)
+ Addedresolve-alpn@1.2.1(transitive)
+ Addedresponselike@3.0.0(transitive)
+ Addedsemver-diff@4.0.0(transitive)
+ Addedstring-width@5.1.2(transitive)
+ Addedstrip-ansi@7.1.0(transitive)
+ Addedtype-fest@2.19.0(transitive)
+ Addedunique-string@3.0.0(transitive)
+ Addedupdate-notifier@6.0.2(transitive)
+ Addedwidest-line@4.0.1(transitive)
+ Addedwrap-ansi@8.1.0(transitive)
+ Addedxdg-basedir@5.1.0(transitive)
- Removedjsonexport@^3.2.0
- Removed@sindresorhus/is@0.14.0(transitive)
- Removed@szmarczak/http-timer@1.1.2(transitive)
- Removedansi-styles@4.3.0(transitive)
- Removedboxen@5.1.2(transitive)
- Removedcacheable-request@6.1.0(transitive)
- Removedchalk@4.1.2(transitive)
- Removedci-info@2.0.0(transitive)
- Removedcli-boxes@2.2.1(transitive)
- Removedclone-response@1.0.3(transitive)
- Removedcolor-convert@2.0.1(transitive)
- Removedcolor-name@1.1.4(transitive)
- Removedconfigstore@5.0.1(transitive)
- Removedcrypto-random-string@2.0.0(transitive)
- Removeddecompress-response@3.3.0(transitive)
- Removeddefer-to-connect@1.1.3(transitive)
- Removeddot-prop@5.3.0(transitive)
- Removedduplexer3@0.1.5(transitive)
- Removedend-of-stream@1.4.4(transitive)
- Removedescape-goat@2.1.1(transitive)
- Removedget-stream@4.1.05.2.0(transitive)
- Removedgot@9.6.0(transitive)
- Removedhas-flag@4.0.0(transitive)
- Removedhas-yarn@2.1.0(transitive)
- Removedimport-lazy@2.1.0(transitive)
- Removedis-ci@2.0.0(transitive)
- Removedis-npm@5.0.0(transitive)
- Removedis-yarn-global@0.3.0(transitive)
- Removedjson-buffer@3.0.0(transitive)
- Removedjsonexport@3.2.0(transitive)
- Removedkeyv@3.1.0(transitive)
- Removedlatest-version@5.1.0(transitive)
- Removedlowercase-keys@1.0.12.0.0(transitive)
- Removedmake-dir@3.1.0(transitive)
- Removedmimic-response@1.0.1(transitive)
- Removednormalize-url@4.5.1(transitive)
- Removedp-cancelable@1.1.0(transitive)
- Removedpackage-json@6.5.0(transitive)
- Removedprepend-http@2.0.0(transitive)
- Removedpump@3.0.2(transitive)
- Removedpupa@2.1.1(transitive)
- Removedregistry-auth-token@4.2.2(transitive)
- Removedregistry-url@5.1.0(transitive)
- Removedresponselike@1.0.2(transitive)
- Removedsemver@6.3.1(transitive)
- Removedsemver-diff@3.1.1(transitive)
- Removedsupports-color@7.2.0(transitive)
- Removedto-readable-stream@1.0.0(transitive)
- Removedtype-fest@0.20.2(transitive)
- Removedunique-string@2.0.0(transitive)
- Removedupdate-notifier@5.1.0(transitive)
- Removedurl-parse-lax@3.0.0(transitive)
- Removedwidest-line@3.1.0(transitive)
- Removedwrap-ansi@7.0.0(transitive)
- Removedxdg-basedir@4.0.0(transitive)
Updatedupdate-notifier@^6.0.0