check-html-links
Advanced tools
Comparing version 0.1.0 to 0.1.1
# check-html-links | ||
## 0.1.1 | ||
### Patch Changes | ||
- eb74110: Add info about how many files and links will be checked | ||
## 0.1.0 | ||
### Minor Changes | ||
- cd22231: Initial release |
@@ -5,3 +5,6 @@ /** | ||
*/ | ||
export function validateFiles(files: string[], rootDir: string): Promise<import("../types/main.js").Error[]>; | ||
export function validateFiles(files: string[], rootDir: string): Promise<{ | ||
errors: import("../types/main.js").Error[]; | ||
numberLinks: number; | ||
}>; | ||
/** | ||
@@ -8,0 +11,0 @@ * @param {string} inRootDir |
{ | ||
"name": "check-html-links", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"publishConfig": { | ||
@@ -5,0 +5,0 @@ "access": "public" |
@@ -19,3 +19,3 @@ # Check Html Links | ||
## Comparision | ||
## Comparison | ||
@@ -22,0 +22,0 @@ Checking the output of [11ty-website](https://github.com/11ty/11ty-website) with 13 missing reference targets (used by 516 links) while checking 501 files. (on January 17, 2021) |
@@ -16,3 +16,13 @@ #!/usr/bin/env node | ||
const files = await listFiles('**/*.html', rootDir); | ||
const errors = await validateFiles(files, rootDir); | ||
const filesOutput = | ||
files.length == 0 | ||
? '🧐 No files to check. Did you select the correct folder?' | ||
: `🔥 Found a total of ${chalk.green.bold(files.length)} files to check!`; | ||
console.log(filesOutput); | ||
const { errors, numberLinks } = await validateFiles(files, rootDir); | ||
console.log(`🔗 Found a total of ${chalk.green.bold(numberLinks)} links to validate!\n`); | ||
const performance = process.hrtime(performanceStart); | ||
@@ -19,0 +29,0 @@ if (errors.length > 0) { |
@@ -270,4 +270,6 @@ /* eslint-disable @typescript-eslint/ban-ts-comment */ | ||
idCache = new Map(); | ||
let numberLinks = 0; | ||
for (const htmlFilePath of files) { | ||
const { links } = await extractReferences(htmlFilePath); | ||
numberLinks += links.length; | ||
await resolveLinks(links, { htmlFilePath, rootDir }); | ||
@@ -277,3 +279,3 @@ } | ||
return errors; | ||
return { errors: errors, numberLinks: numberLinks }; | ||
} | ||
@@ -287,4 +289,4 @@ | ||
const files = await listFiles('**/*.html', rootDir); | ||
const errors = await validateFiles(files, rootDir); | ||
const { errors } = await validateFiles(files, rootDir); | ||
return errors; | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
76669
447