sitemap-generator-cli
Advanced tools
Comparing version 3.1.2 to 3.2.0
{ | ||
"extends": "airbnb/base", | ||
"extends": "graubnla/legacy", | ||
"rules": { | ||
@@ -4,0 +4,0 @@ "no-console": 0, |
@@ -16,2 +16,3 @@ #!/usr/bin/env node | ||
.option('-p, --path [path]', 'specifies output path') | ||
.option('-s, --silent', 'omit crawler notifications') | ||
.parse(process.argv); | ||
@@ -29,3 +30,4 @@ | ||
filename: program.filename, | ||
silent: program.silent, | ||
}); | ||
generator.start(); |
@@ -34,2 +34,6 @@ 'use strict'; | ||
// only crawl regular links | ||
this.crawler.parseScriptTags = false; | ||
this.crawler.parseHTMLComments = false; | ||
if (process.env.NODE_ENV === 'development') { | ||
@@ -76,5 +80,9 @@ port = 8000; | ||
console.log(chalk.cyan.bold('Found:'), chalk.gray(item.url)); | ||
if (!this.options.silent) { | ||
console.log(chalk.cyan.bold('Found:'), chalk.gray(item.url)); | ||
} | ||
} else { | ||
console.log(chalk.bold.magenta('Ignored:'), chalk.gray(item.url)); | ||
if (!this.options.silent) { | ||
console.log(chalk.bold.magenta('Ignored:'), chalk.gray(item.url)); | ||
} | ||
} | ||
@@ -84,4 +92,6 @@ }.bind(this)); | ||
this.crawler.on('fetch404', function (item) { | ||
console.log(chalk.red.bold('Not found:'), chalk.gray(item.url)); | ||
}); | ||
if (!this.options.silent) { | ||
console.log(chalk.red.bold('Not found:'), chalk.gray(item.url)); | ||
} | ||
}.bind(this)); | ||
@@ -103,4 +113,6 @@ this.crawler.on('fetcherror', function (item) { | ||
} else { | ||
console.log(chalk.white('Added %s sites, encountered %s errors.'), | ||
this.chunk.length, this.crawler.queue.errors()); | ||
console.log(chalk.white('Added %s sites, encountered %s %s.'), | ||
this.chunk.length, | ||
this.crawler.queue.errors(), | ||
(this.crawler.queue.errors() === 1 ? 'error' : 'errors')); | ||
console.log(chalk.green.bold('Sitemap successfully created!')); | ||
@@ -152,2 +164,3 @@ process.exit(); | ||
} | ||
return err; | ||
}); | ||
@@ -154,0 +167,0 @@ }; |
{ | ||
"name": "sitemap-generator-cli", | ||
"version": "3.1.2", | ||
"version": "3.2.0", | ||
"description": "Create xml sitemaps from the command line.", | ||
@@ -29,5 +29,5 @@ "homepage": "https://github.com/lgraubner/node-sitemap-generator-cli", | ||
"dependencies": { | ||
"simplecrawler": "^0.5.4", | ||
"lodash": "^3.10.1", | ||
"xmlbuilder": "^4.2.0", | ||
"simplecrawler": "^0.6.2", | ||
"lodash": "^4.6.0", | ||
"xmlbuilder": "^4.2.1", | ||
"commander": "^2.9.0", | ||
@@ -37,3 +37,3 @@ "chalk": "^1.1.1", | ||
"robots-parser": "^1.0.0", | ||
"request": "^2.67.0" | ||
"request": "^2.69.0" | ||
}, | ||
@@ -49,6 +49,6 @@ "preferGlobal": true, | ||
"devDependencies": { | ||
"chai": "^3.4.1", | ||
"eslint": "^1.10.3", | ||
"eslint-config-airbnb": "^3.1.0", | ||
"mocha": "^2.3.4" | ||
"chai": "^3.5.0", | ||
"eslint": "^2.2.0", | ||
"eslint-config-graubnla": "^2.0.2", | ||
"mocha": "^2.4.5" | ||
}, | ||
@@ -55,0 +55,0 @@ "scripts": { |
@@ -94,2 +94,16 @@ /* globals it:false, before:false, describe:false */ | ||
}); | ||
it('should ignore script URLs', function (done) { | ||
fs.readFile('./sitemap.xml', function (err, data) { | ||
data.toString().should.not.contain('127.0.0.1/ignore-scripts'); | ||
done(); | ||
}); | ||
}); | ||
it('should ignore HTML comment URLs', function (done) { | ||
fs.readFile('./sitemap.xml', function (err, data) { | ||
data.toString().should.not.contain('127.0.0.1/ignore-comments'); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
@@ -96,0 +110,0 @@ |
@@ -0,1 +1,2 @@ | ||
/* eslint-disable */ | ||
var http = require('http'); | ||
@@ -10,3 +11,3 @@ | ||
}); | ||
res.write('<a href=\'/site\'>Link 1</a><a href=\'/ignore\'>Link 2</a>'); | ||
res.write('<a href=\'/site\'>Link 1</a><!--<a href="/ignore-comments">Link</a>--><a href=\'/ignore\'>Link 2</a><script>var a = "/ignore-scripts";</script>'); | ||
res.end(); | ||
@@ -13,0 +14,0 @@ }, |
199650
403
+ Addediconv-lite@0.4.24(transitive)
+ Addedsimplecrawler@0.6.2(transitive)
- Removedlodash@3.10.1(transitive)
- Removedsimplecrawler@0.5.4(transitive)
Updatedlodash@^4.6.0
Updatedrequest@^2.69.0
Updatedsimplecrawler@^0.6.2
Updatedxmlbuilder@^4.2.1