Socket
Socket
Sign inDemoInstall

gulp-amphtml-validator

Package Overview
Dependencies
62
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.1 to 1.0.2

36

index.js

@@ -125,8 +125,9 @@ /**

/**
* Fail when the stream ends if any AMP validation error(s) occurred.
* Fail when the stream ends if for any AMP validation results,
* isFailure(ampValidationResult) returns true.
*
* @param {!function(amphtmlValidator.ValidationResult): boolean} isFailure
* @return {!stream} gulp file stream
*/
module.exports.failAfterError = function() {
function failAfter(isFailure) {
let failedFiles = 0;

@@ -138,4 +139,3 @@

}
const status = file.ampValidationResult.status;
if (status === STATUS_FAIL || status === STATUS_UNKNOWN) {
if (isFailure(file.ampValidationResult)) {
failedFiles++;

@@ -155,2 +155,28 @@ }

return through.obj(collectFailedFiles, failOnError);
}
/**
* Fail when the stream ends if any AMP validation error(s) occurred.
*
* @return {!stream} gulp file stream
*/
module.exports.failAfterError = function() {
return failAfter(function(ampValidationResult) {
return ampValidationResult.status === STATUS_FAIL ||
ampValidationResult.status === STATUS_UNKNOWN;
});
};
/**
* Fail when the stream ends if any AMP validation warning(s) or
* error(s) occurred.
*
* @return {!stream} gulp file stream
*/
module.exports.failAfterWarningOrError = function() {
return failAfter(function(ampValidationResult) {
return ampValidationResult.errors.length > 0 ||
ampValidationResult.status === STATUS_FAIL ||
ampValidationResult.status === STATUS_UNKNOWN;
});
};

4

package.json
{
"name": "gulp-amphtml-validator",
"version": "1.0.1",
"version": "1.0.2",
"description": "Gulp plugin for the official AMP HTML validator (www.ampproject.org)",

@@ -23,3 +23,3 @@ "keywords": [

"dependencies": {
"amphtml-validator": "1.0.18",
"amphtml-validator": "1.0.21",
"gulp-util": "^3.0.7",

@@ -26,0 +26,0 @@ "through2": "^2.0.1"

@@ -31,7 +31,21 @@ # Gulp AMPHTML Validator

To treat warnings as errors, replace the last line of the validation closure with:
```js
// Exit the process with error code (1) if an AMP validation warning or
// error occurred.
.pipe(gulpAmpValidator.failAfterWarningOrError());
```
## Release Notes
### 1.0.2
* Add failAfterWarningOrError option
* Upgrade amphtml-validator version to 1.0.21
### 1.0.1
* Set amphtml-validator version to 1.0.18
* Upgrade amphtml-validator version to 1.0.18

@@ -38,0 +52,0 @@ ### 1.0.0

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