linkinator
Advanced tools
Comparing version 2.5.1 to 2.6.0
@@ -15,2 +15,3 @@ "use strict"; | ||
const p_queue_1 = require("p-queue"); | ||
const globby = require("glob"); | ||
const links_1 = require("./links"); | ||
@@ -20,2 +21,3 @@ const url_1 = require("url"); | ||
const readFile = util.promisify(fs.readFile); | ||
const glob = util.promisify(globby); | ||
var LinkState; | ||
@@ -118,2 +120,11 @@ (function (LinkState) { | ||
} | ||
// expand globs into paths | ||
if (!isUrlType) { | ||
const paths = []; | ||
for (const path of options.path) { | ||
const expandedPaths = await glob(path); | ||
paths.push(...expandedPaths); | ||
} | ||
options.path = paths; | ||
} | ||
// Figure out which directory should be used as the root for the web server, | ||
@@ -120,0 +131,0 @@ // and how that impacts the path to the file for the first request. |
{ | ||
"name": "linkinator", | ||
"description": "Find broken links, missing images, etc in your HTML. Scurry around your site and find all those broken links.", | ||
"version": "2.5.1", | ||
"version": "2.6.0", | ||
"license": "MIT", | ||
@@ -26,2 +26,3 @@ "repository": "JustinBeckwith/linkinator", | ||
"gaxios": "^4.0.0", | ||
"glob": "^7.1.6", | ||
"jsonexport": "^3.0.0", | ||
@@ -39,2 +40,3 @@ "marked": "^1.2.5", | ||
"@types/finalhandler": "^1.1.0", | ||
"@types/glob": "^7.1.3", | ||
"@types/marked": "^1.2.0", | ||
@@ -41,0 +43,0 @@ "@types/meow": "^5.0.0", |
@@ -30,8 +30,9 @@ # 🐿 linkinator | ||
``` | ||
$ linkinator LOCATION [ --arguments ] | ||
$ linkinator LOCATIONS [ --arguments ] | ||
Positional arguments | ||
LOCATION | ||
Required. Either the URL or the path on disk to check for broken links. | ||
LOCATIONS | ||
Required. Either the URLs or the paths on disk to check for broken links. | ||
Supports multiple paths, and globs. | ||
@@ -116,5 +117,11 @@ Flags | ||
```sh | ||
$ linkinator ./README.md | ||
$ linkinator ./README.md --markdown | ||
``` | ||
You know what, we better check all of the markdown files! | ||
```sh | ||
$ linkinator "**/*.md" --markdown | ||
``` | ||
### Configuration file | ||
@@ -147,3 +154,3 @@ 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. | ||
Asynchronous method that runs a site wide scan. Options come in the form of an object that includes: | ||
- `path` (string) - A fully qualified path to the url to be scanned, or the path to the directory on disk that contains files to be scanned. *required*. | ||
- `path` (string|string[]) - A fully qualified path to the url to be scanned, or the path(s) to the directory on disk that contains files to be scanned. *required*. | ||
- `concurrency` (number) - The number of connections to make simultaneously. Defaults to 100. | ||
@@ -259,7 +266,17 @@ - `port` (number) - When the `path` is provided as a local path on disk, the `port` on which to start the temporary web server. Defaults to a random high range order port. | ||
## Using a proxy | ||
## Notes | ||
### Using a proxy | ||
This library supports proxies via the `HTTP_PROXY` and `HTTPS_PROXY` environment variables. This [guide](https://www.golinuxcloud.com/set-up-proxy-http-proxy-environment-variable/) provides a nice overview of how to format and set these variables. | ||
### Globbing | ||
You may have noticed in the example, when using a glob the pattern is encapsulated in quotes: | ||
```sh | ||
$ linkinator "**/*.md" --markdown | ||
``` | ||
Without the quotes, some shells will attempt to expand the glob paths on their own. Various shells (bash, zsh) have different, somewhat unpredictable behaviors when left to their own devices. Using the quotes ensures consistent, predictable behavior by letting the library expand the pattern. | ||
## License | ||
[MIT](LICENSE.md) |
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
61852
797
279
12
22
+ Addedglob@^7.1.6
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedglob@7.2.3(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)