Socket
Socket
Sign inDemoInstall

backstop-crawl

Package Overview
Dependencies
94
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.0 to 2.1.0

lib/limit-similar.js

25

index.js

@@ -15,17 +15,28 @@ #!/usr/bin/env node

--outfile, -o Save the backstop config to this file
--debug Logs out errors produced while crawling
--ignore-robots Ignore the sites robots.txt
--ignore-ssl-errors Treat any certificate as valid (e.g. self-signed
or expired)
--debug Logs out errors produced while crawling
--allow-subdomains Allow crawling links found to subdomains of the
current domain
--limit-similar[=3] Limits the number of similar URLs to a set number
Defaults to 3
e.g /blog/1, /blog/2, /blog/3
Examples
$ backstop-crawl http://localhost
`, {
alias: {
o: 'outfile',
},
});
`,
{
alias: {
o: 'outfile',
},
});
if (cli.flags.limitSimilar) {
if (!Number.isInteger(cli.flags.limitSimilar)) {
// Set default if true
cli.flags.limitSimilar = 3;
}
}
if (cli.input.length) {

@@ -35,3 +46,3 @@ if (validurl(cli.input[0])) {

} else {
console.error(`Error: "${cli.input[0]}" isn't a valid URL`);
console.error(`> Error: "${cli.input[0]}" isn't a valid URL`);
process.exit(1);

@@ -38,0 +49,0 @@ }

@@ -11,6 +11,7 @@ 'use strict';

const defaultConf = require('./default-config');
const limitSimilar = require('./limit-similar');
const EXT_BLACKLIST = /\.pdf|\.js|\.css|\.png|\.jpg|\.jpeg|\.gif|\.json|\.xml|\.txt$/i;
const SPINNER_WIDTH = 2;
const urls = [];
let urls = [];

@@ -87,2 +88,10 @@ module.exports = function crawl (url, flags) {

crawler.on('complete', () => {
if (flags.limitSimilar) {
spinner.stopAndPersist({
symbol: '>',
text: `Limiting similar urls to ${flags.limitSimilar} of each`,
});
urls = limitSimilar(urls, flags.limitSimilar);
}
defaultConf.scenarios = urls;

@@ -89,0 +98,0 @@ const path = dirname(outfile);

{
"name": "backstop-crawl",
"version": "2.0.0",
"version": "2.1.0",
"description": "Crawl a site to generate a backstopjs config",

@@ -52,8 +52,10 @@ "repository": "https://github.com/fffunction/backstop-crawl",

"mkpath": "1.0.0",
"object.entries": "^1.0.4",
"ora": "1.1.0",
"simplecrawler": "1.0.3",
"url-parse": "^1.1.7",
"valid-url": "1.0.9"
},
"devDependencies": {
"ava": "git://github.com/avajs/ava.git#magic-assert",
"ava": "0.18.1",
"coveralls": "2.11.15",

@@ -60,0 +62,0 @@ "eslint": "3.14.1",

@@ -17,6 +17,2 @@ # $ backstop-crawl

```
$ npm install --global backstop-crawl
```
```
❯ backstop-crawl

@@ -31,6 +27,11 @@

--outfile, -o Save the backstop config to this file
--debug Logs out errors produced while crawling
--ignore-robots Ignore the sites robots.txt
--ignore-ssl-errors Treat any certificate as valid (e.g. self-signed
or expired)
--debug Logs out errors produced while crawling
--allow-subdomains Allow crawling links found to subdomains of the
current domain
--limit-similar[=3] Limits the number of similar URLs to a set number
Defaults to 3
e.g /blog/1, /blog/2, /blog/3

@@ -45,2 +46,2 @@ Examples

MIT © fffunction [fffunction.co](fffunction.co)
MIT © fffunction [fffunction.co](https://fffunction.co)
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc