linkinator
Advanced tools
Comparing version 1.4.3 to 1.5.0
@@ -9,2 +9,3 @@ #!/usr/bin/env node | ||
const util_1 = require("util"); | ||
const config_1 = require("./config"); | ||
const toCSV = util_1.promisify(require('jsonexport')); | ||
@@ -23,2 +24,5 @@ const pkg = require('../../package.json'); | ||
Flags | ||
--config | ||
Path to the config file to use. Looks for \`linkinator.config.json\` by default. | ||
--recurse, -r | ||
@@ -47,6 +51,7 @@ Recurively follow links on the same root domain. | ||
flags: { | ||
recurse: { type: 'boolean', alias: 'r' }, | ||
config: { type: 'string' }, | ||
recurse: { type: 'boolean', alias: 'r', default: undefined }, | ||
skip: { type: 'string', alias: 's' }, | ||
format: { type: 'string', alias: 'f' }, | ||
silent: { type: 'boolean' }, | ||
silent: { type: 'boolean', default: undefined }, | ||
}, | ||
@@ -60,3 +65,3 @@ }); | ||
} | ||
flags = cli.flags; | ||
flags = await config_1.getConfig(cli.flags); | ||
const start = Date.now(); | ||
@@ -92,6 +97,10 @@ if (!flags.silent) { | ||
}); | ||
const opts = { path: cli.input[0], recurse: cli.flags.recurse }; | ||
if (cli.flags.skip) { | ||
const skips = cli.flags.skip; | ||
opts.linksToSkip = skips.split(' ').filter(x => !!x); | ||
const opts = { path: cli.input[0], recurse: flags.recurse }; | ||
if (flags.skip) { | ||
if (typeof flags.skip === 'string') { | ||
opts.linksToSkip = flags.skip.split(' ').filter(x => !!x); | ||
} | ||
else if (Array.isArray(flags.skip)) { | ||
opts.linksToSkip = flags.skip; | ||
} | ||
} | ||
@@ -98,0 +107,0 @@ const result = await checker.check(opts); |
{ | ||
"name": "linkinator", | ||
"description": "Find broken links, missing images, etc in your HTML. Scurry around your site and find all those broken links.", | ||
"version": "1.4.3", | ||
"version": "1.5.0", | ||
"license": "MIT", | ||
@@ -16,5 +16,5 @@ "repository": "JustinBeckwith/linkinator", | ||
"compile": "tsc -p .", | ||
"test": "nyc mocha build/test", | ||
"test": "c8 mocha build/test", | ||
"fix": "gts fix", | ||
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json", | ||
"codecov": "c8 report --reporter=json && codecov -f coverage/*.json", | ||
"lint": "gts check" | ||
@@ -44,2 +44,4 @@ }, | ||
"@types/update-notifier": "^2.5.0", | ||
"assert-rejects": "^1.0.0", | ||
"c8": "^5.0.1", | ||
"codecov": "^3.2.0", | ||
@@ -49,3 +51,2 @@ "gts": "^1.0.0", | ||
"nock": "^10.0.6", | ||
"nyc": "^14.0.0", | ||
"semantic-release": "^15.13.15", | ||
@@ -74,3 +75,3 @@ "sinon": "^7.2.3", | ||
], | ||
"nyc": { | ||
"c8": { | ||
"exclude": [ | ||
@@ -77,0 +78,0 @@ "build/test" |
@@ -37,2 +37,6 @@ # 🐿 linkinator | ||
Flags | ||
--config | ||
Path to the config file to use. Looks for `linkinator.config.json` by default. | ||
--recurse, -r | ||
@@ -95,2 +99,22 @@ Recurively follow links on the same root domain. | ||
### Configuration file | ||
You can pass options directly to the `linkinator` CLI, or you can define a config file. By default, `linkinator` will look for a `linkinator.config.json` file in the current working directory. | ||
All options are optional. It should look like this: | ||
```json | ||
{ | ||
"format": "json", | ||
"recurse": true, | ||
"silent": true, | ||
"skip": "www.googleapis.com" | ||
} | ||
``` | ||
To load config settings outside the CWD, you can pass the `--config` flag to the `linkinator` CLI: | ||
```sh | ||
$ linkinator --config /some/path/your-config.json | ||
``` | ||
## API Usage | ||
@@ -97,0 +121,0 @@ |
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
36849
15
455
228
20
2