forked from docschina/webpack.js.org
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
754 additions
and
934 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/usr/bin/env node | ||
// Check piped links while allowing a fixed amount to fail | ||
// Adapted from tap-json. | ||
var parser = require('tap-parser'); | ||
var through = require('through2'); | ||
var duplexer = require('duplexer'); | ||
var minimist = require('minimist'); | ||
|
||
process.stdin | ||
.pipe(checkLinks()) | ||
.pipe(process.stdout); | ||
|
||
function checkLinks(args) { | ||
var argv = minimist(process.argv.slice(2)); | ||
var skip = argv.skip || 0; | ||
|
||
var tap = parser(); | ||
var out = through.obj(); | ||
var dup = duplexer(tap, out); | ||
|
||
var data = []; | ||
var name = null; | ||
|
||
tap.on('complete', function(res) { | ||
const failures = res.failures; | ||
|
||
if (failures.length > 0) { | ||
console.log(formatFailures(failures)); | ||
} | ||
|
||
// Fail hard only if over skip threshold | ||
if (failures.length > skip) { | ||
process.exit(1); | ||
} | ||
}); | ||
|
||
return dup; | ||
} | ||
|
||
function formatFailures(failures) { | ||
return failures.map(function(failure) { | ||
return failure.name + '\n' + failure.diag.actual + ' at ' + failure.diag.at; | ||
}).join('\n\n'); | ||
} |
Oops, something went wrong.