Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

linkinator

Package Overview
Dependencies
Maintainers
1
Versions
114
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

linkinator - npm Package Compare versions

Comparing version 1.2.1 to 1.3.0

34

build/src/cli.js

@@ -16,2 +16,4 @@ #!/usr/bin/env node

const index_1 = require("./index");
const util_1 = require("util");
const toCSV = util_1.promisify(require('jsonexport'));
const pkg = require('../../package.json');

@@ -35,2 +37,5 @@ updateNotifier({ pkg }).notify();

--format, -f
Return the data in CSV or JSON format.
--help

@@ -44,2 +49,3 @@ Show this command.

$ linkinator . --skip www.googleapis.com
$ linkinator . --format CSV
`, {

@@ -49,4 +55,6 @@ flags: {

skip: { type: 'string', alias: 's' },
format: { type: 'string', alias: 'f' }
}
});
let flags;
function main() {

@@ -58,7 +66,8 @@ return __awaiter(this, void 0, void 0, function* () {

}
flags = cli.flags;
const start = Date.now();
console.log(`🏊‍♂️ crawling ${cli.input}`);
log(`🏊‍♂️ crawling ${cli.input}`);
const checker = new index_1.LinkChecker();
checker.on('pagestart', url => {
console.log(`\n Scanning ${chalk_1.default.grey(url)}`);
log(`\n Scanning ${chalk_1.default.grey(url)}`);
});

@@ -80,3 +89,3 @@ checker.on('link', (link) => {

}
console.log(` ${state} ${chalk_1.default.gray(link.url)}`);
log(` ${state} ${chalk_1.default.gray(link.url)}`);
});

@@ -89,3 +98,13 @@ const opts = { path: cli.input[0], recurse: cli.flags.recurse };

const result = yield checker.check(opts);
console.log();
log();
const format = flags.format ? flags.format.toLowerCase() : null;
if (format === 'json') {
console.log(result);
return;
}
else if (format === 'csv') {
const csv = yield toCSV(result.links);
console.log(csv);
return;
}
const total = (Date.now() - start) / 1000;

@@ -97,6 +116,11 @@ if (!result.passed) {

}
console.log(chalk_1.default.bold(`🤖 Successfully scanned ${chalk_1.default.green(result.links.length.toString())} links in ${chalk_1.default.cyan(total.toString())} seconds.`));
log(chalk_1.default.bold(`🤖 Successfully scanned ${chalk_1.default.green(result.links.length.toString())} links in ${chalk_1.default.cyan(total.toString())} seconds.`));
});
}
function log(message = '\n') {
if (!flags.format) {
console.log(message);
}
}
main();
//# sourceMappingURL=cli.js.map

5

package.json
{
"name": "linkinator",
"description": "Find broken links, missing images, etc in your HTML. Scurry around your site and find all those broken links.",
"version": "1.2.1",
"version": "1.3.0",
"license": "MIT",

@@ -27,2 +27,3 @@ "repository": "JustinBeckwith/linkinator",

"gaxios": "^1.7.0",
"jsonexport": "^2.4.1",
"meow": "^5.0.0",

@@ -47,3 +48,3 @@ "server-destroy": "^1.0.1",

"nock": "^10.0.6",
"nyc": "^13.3.0",
"nyc": "^14.0.0",
"semantic-release": "^15.13.3",

@@ -50,0 +51,0 @@ "sinon": "^7.2.3",

@@ -46,2 +46,5 @@ # 🐿 linkinator

--format, -f
Return the data in CSV or JSON format.
--help

@@ -83,2 +86,8 @@ Show this command.

Maybe you're going to pipe the output to another program. Use the `--format` option to get JSON or CSV!
```sh
$ linkinator ./docs --format CSV
```
## API Usage

@@ -85,0 +94,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc