Skip to content

Commit

Permalink
Release v1.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dpilafian committed Apr 27, 2024
1 parent 66e9684 commit b847207
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 17 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/release-on-vtag.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
name: release
name: Create Release

on:
push:
tags:
- 'v*'

jobs:
build:
name: Create Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4 #see: https://github.com/actions/checkout/releases
- uses: actions/create-release@v1
- uses: actions/checkout@v4 #see: https://github.com/actions/checkout/releases
- uses: actions/create-release@v1 #see: https://github.com/actions/create-release/releases
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/run-spec-on-push.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: build
name: Build and Run Specifications

on: [push]

jobs:
build:
name: Run Specifications
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4 #see: https://github.com/actions/checkout/releases
Expand Down
5 changes: 4 additions & 1 deletion dist/w3c-html-validator.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! w3c-html-validator v1.7.0 ~~ https://github.com/center-key/w3c-html-validator ~~ MIT License
//! w3c-html-validator v1.8.0 ~~ https://github.com/center-key/w3c-html-validator ~~ MIT License

export type ValidatorSettings = {
html: string;
Expand All @@ -8,6 +8,7 @@ export type ValidatorSettings = {
ignoreLevel: 'info' | 'warning';
ignoreMessages: (string | RegExp)[];
output: ValidatorResultsOutput;
skip: boolean;
};
export type ValidatorResultsMessage = {
type: 'info' | 'error' | 'non-document-error' | 'network-error';
Expand All @@ -33,6 +34,7 @@ export type ValidatorResults = {
status: number;
messages: ValidatorResultsMessage[] | null;
display: string | null;
skip: boolean;
};
export type ValidatorResultsOutput = ValidatorResults['output'];
export type ReporterSettings = {
Expand All @@ -44,6 +46,7 @@ export type ReporterSettings = {
declare const w3cHtmlValidator: {
version: string;
validate(options: Partial<ValidatorSettings>): Promise<ValidatorResults>;
skipNotice(): void;
summary(numFiles: number): void;
reporter(results: ValidatorResults, options?: Partial<ReporterSettings>): ValidatorResults;
};
Expand Down
18 changes: 15 additions & 3 deletions dist/w3c-html-validator.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
//! w3c-html-validator v1.7.0 ~~ https://github.com/center-key/w3c-html-validator ~~ MIT License
//! w3c-html-validator v1.8.0 ~~ https://github.com/center-key/w3c-html-validator ~~ MIT License

import chalk from 'chalk';
import fs from 'fs';
import log from 'fancy-log';
import request from 'superagent';
import slash from 'slash';
const w3cHtmlValidator = {
version: '1.7.0',
version: '1.8.0',
validate(options) {
const defaults = {
checkUrl: 'https://validator.w3.org/nu/',
ignoreLevel: null,
ignoreMessages: [],
output: 'json',
skip: false,
};
const settings = { ...defaults, ...options };
if (!settings.html && !settings.filename && !settings.website)
Expand Down Expand Up @@ -60,6 +61,7 @@ const w3cHtmlValidator = {
status: response.statusCode || -1,
messages: json ? response.body.messages : null,
display: json ? null : response.text,
skip: settings.skip,
});
const handleError = (reason) => {
const errRes = reason.response ?? {};
Expand All @@ -68,7 +70,17 @@ const w3cHtmlValidator = {
errRes.body = { messages: [{ type: 'network-error', message: message.join(' ') }] };
return toValidatorResults(errRes);
};
return w3cRequest.then(filterMessages).then(toValidatorResults).catch(handleError);
const pseudoResponse = {
statusCode: 200,
body: { messages: [] },
text: 'Validation skipped.',
};
const pseudoRequest = () => new Promise(resolve => resolve(pseudoResponse));
const validation = settings.skip ? pseudoRequest() : w3cRequest;
return validation.then(filterMessages).then(toValidatorResults).catch(handleError);
},
skipNotice() {
log(chalk.gray('w3c-html-validator'), chalk.yellowBright('skip mode:'), chalk.whiteBright('validation being bypassed'));
},
summary(numFiles) {
log(chalk.gray('w3c-html-validator'), chalk.magenta('files: ' + numFiles));
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "w3c-html-validator",
"version": "1.7.0",
"version": "1.8.0",
"description": "Check the markup validity of HTML files using the W3C validator",
"license": "MIT",
"type": "module",
Expand Down Expand Up @@ -81,22 +81,22 @@
"fancy-log": "~2.0",
"glob": "~10.3",
"slash": "~5.1",
"superagent": "~8.1"
"superagent": "~9.0"
},
"devDependencies": {
"@types/fancy-log": "~2.0",
"@types/node": "~20.11",
"@types/node": "~20.12",
"@types/superagent": "~8.1",
"@typescript-eslint/eslint-plugin": "~7.3",
"@typescript-eslint/parser": "~7.3",
"@typescript-eslint/eslint-plugin": "~7.7",
"@typescript-eslint/parser": "~7.7",
"add-dist-header": "~1.4",
"assert-deep-strict-equal": "~1.2",
"copy-file-util": "~1.2",
"copy-folder-util": "~1.1",
"eslint": "~8.57",
"eslint": "8.57.0",
"jshint": "~2.13",
"merge-stream": "~2.0",
"mocha": "~10.3",
"mocha": "~10.4",
"rimraf": "~5.0",
"run-scripts-util": "~1.2",
"typescript": "~5.4"
Expand Down

0 comments on commit b847207

Please sign in to comment.