Skip to content

Commit e55b9be

Browse files
committed
removed fetch error messages, fixed count, made module private
1 parent 01a3fc0 commit e55b9be

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
{
22
"name": "@lgraubner/w3c-validator",
33
"description": "Crawls a given site and checks for W3C validity.",
4-
"version": "1.0.0",
4+
"version": "1.0.1",
55
"homepage": "https://github.com/lgraubner/node-w3c-validator",
66
"license": "MIT",
77
"author": "Lars Graubner <mail@larsgraubner.de>",
88
"repository": {
99
"type": "git",
1010
"url": "https://github.com/lgraubner/node-w3c-validator.git"
1111
},
12+
"private": true,
1213
"engines": {
1314
"node": ">=0.10"
1415
},

w3c-validator.js

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ if (!program.args[0]) {
1616
}
1717

1818
var chunk = [],
19+
count = 0,
1920
valid = 0,
2021
invalid = 0,
2122
c = new Crawler(program.args[0]);
@@ -33,17 +34,10 @@ c.on("fetchcomplete", function(item) {
3334
chunk.push(item.url);
3435
});
3536

36-
c.on("fetch404", function(item, response) {
37-
console.log(chalk.red.bold("Not found:"), chalk.gray(item.url));
38-
});
39-
40-
c.on("fetcherror", function(item, response) {
41-
console.log(chalk.red.bold("Fetch error:"), chalk.gray(item.url));
42-
});
43-
4437
c.on("complete", function() {
4538

4639
if (chunk.length > 0) {
40+
count = chunk.length;
4741
console.log(chalk.white("Done! Validating..."));
4842
checkURL(chunk);
4943
} else {
@@ -68,7 +62,7 @@ var checkURL = function(chunk) {
6862
if (chunk.length > 0) {
6963
return checkURL(chunk);
7064
} else {
71-
return console.log(chalk.white("Checked %s sites. %s valid, %s invalid."), c.queue.complete(), valid, invalid);
65+
return console.log(chalk.white("Checked %s sites. %s valid, %s invalid."), count, valid, invalid);
7266
}
7367
});
7468
};
@@ -86,7 +80,7 @@ var font = c.addFetchCondition(function(parsedURL) {
8680
});
8781

8882
var data = c.addFetchCondition(function(parsedURL) {
89-
return !parsedURL.path.match(/\.(json|rss|atom|gz|zip|rar|7z)/i);
83+
return !parsedURL.path.match(/\.(json|rss|atom|gz|zip|rar|7z|vcf)/i);
9084
});
9185

9286
var misc = c.addFetchCondition(function(parsedURL) {

0 commit comments

Comments
 (0)