@nitpicker/report-google-sheets 0.6.4 → 0.6.5-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nitpicker/report-google-sheets",
3
- "version": "0.6.4",
3
+ "version": "0.6.5-alpha.0",
4
4
  "description": "Nitpicker reporter that outputs crawl and analysis results to Google Sheets",
5
5
  "author": "D-ZERO",
6
6
  "license": "Apache-2.0",
@@ -31,8 +31,8 @@
31
31
  "@d-zero/google-auth": "0.5.6",
32
32
  "@d-zero/google-sheets": "0.7.1",
33
33
  "@d-zero/shared": "0.20.1",
34
- "@nitpicker/crawler": "0.6.3",
35
- "@nitpicker/types": "0.6.3",
34
+ "@nitpicker/crawler": "0.6.5-alpha.0",
35
+ "@nitpicker/types": "0.6.5-alpha.0",
36
36
  "ansi-colors": "4.1.3",
37
37
  "debug": "4.4.3",
38
38
  "enquirer": "2.4.1",
@@ -44,5 +44,5 @@
44
44
  "googleapis": "171.4.0",
45
45
  "vitest": "4.0.18"
46
46
  },
47
- "gitHead": "840d4c33a2d0ea9469d511b4f74a69f7fb38ee2b"
47
+ "gitHead": "e084aba5a0887a80059ff8aa0608f61a58cc9288"
48
48
  }
@@ -1,19 +0,0 @@
1
- import type { CreateSheet } from '../sheets/types.js';
2
- /**
3
- * Creates the "Compares" sheet configuration.
4
- *
5
- * Generates comparison data from two sources:
6
- *
7
- * 1. **Link Text vs Page Title** (via `eachPage`): For every anchor on
8
- * each page, creates a row comparing the link's text content with the
9
- * linked page's title. This helps identify misleading or inconsistent
10
- * link labels.
11
- *
12
- * 2. **Plugin comparisons** (via `addRows`): Includes any comparison data
13
- * produced by analyze plugins (e.g. meta tag consistency checks).
14
- *
15
- * Both data sources are written to the same sheet, distinguished by
16
- * the "Type" column.
17
- * @param reports
18
- */
19
- export declare const createCompares: CreateSheet;
@@ -1,64 +0,0 @@
1
- import { pLog } from '../debug.js';
2
- import { createCellData } from '../sheets/create-cell-data.js';
3
- import { defaultCellFormat } from '../sheets/default-cell-format.js';
4
- const log = pLog.extend('Compares');
5
- /**
6
- * Creates the "Compares" sheet configuration.
7
- *
8
- * Generates comparison data from two sources:
9
- *
10
- * 1. **Link Text vs Page Title** (via `eachPage`): For every anchor on
11
- * each page, creates a row comparing the link's text content with the
12
- * linked page's title. This helps identify misleading or inconsistent
13
- * link labels.
14
- *
15
- * 2. **Plugin comparisons** (via `addRows`): Includes any comparison data
16
- * produced by analyze plugins (e.g. meta tag consistency checks).
17
- *
18
- * Both data sources are written to the same sheet, distinguished by
19
- * the "Type" column.
20
- * @param reports
21
- */
22
- export const createCompares = (reports) => {
23
- return {
24
- name: 'Compares',
25
- createHeaders() {
26
- return ['Type', 'A URL', 'A', 'B', 'B URL', 'Note'];
27
- },
28
- async eachPage(page) {
29
- const anchors = await page.getAnchors();
30
- const data = [];
31
- log('Create text link compares');
32
- log('Found %d anchors', anchors.length);
33
- for (const anchor of anchors) {
34
- data.push([
35
- createCellData({ value: 'Link Text vs Page Title' }, defaultCellFormat),
36
- createCellData({ value: page.url.href }, defaultCellFormat),
37
- createCellData({ value: anchor.textContent }, defaultCellFormat),
38
- createCellData({ value: anchor.title }, defaultCellFormat),
39
- createCellData({ value: anchor.url }, defaultCellFormat),
40
- createCellData({ value: '' }, defaultCellFormat),
41
- ]);
42
- }
43
- return data;
44
- },
45
- addRows() {
46
- const data = [];
47
- for (const report of reports) {
48
- if (!report.compares) {
49
- continue;
50
- }
51
- for (const compare of report.compares) {
52
- data.push([
53
- createCellData({ value: compare.itemARefUrl, note: compare.itemARefUrlNote }, defaultCellFormat),
54
- createCellData({ value: compare.itemA, note: compare.itemANote }, defaultCellFormat),
55
- createCellData({ value: compare.itemB, note: compare.itemBNote }, defaultCellFormat),
56
- createCellData({ value: compare.itemBRefUrl, note: compare.itemBRefUrlNote }, defaultCellFormat),
57
- createCellData({ value: compare.note }, defaultCellFormat),
58
- ]);
59
- }
60
- }
61
- return data;
62
- },
63
- };
64
- };
package/lib/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export { report } from './report.js';
package/lib/index.js DELETED
@@ -1 +0,0 @@
1
- export { report } from './report.js';
@@ -1,5 +0,0 @@
1
- /**
2
- *
3
- * @param array
4
- */
5
- export declare function arrayDuplicated<T>(array: T[]): T[];
@@ -1,15 +0,0 @@
1
- /**
2
- *
3
- * @param array
4
- */
5
- export function arrayDuplicated(array) {
6
- const set = new Set();
7
- const duplicated = new Set();
8
- for (const item of array) {
9
- if (set.has(item)) {
10
- duplicated.add(item);
11
- }
12
- set.add(item);
13
- }
14
- return [...duplicated];
15
- }
@@ -1,6 +0,0 @@
1
- /**
2
- *
3
- * @param data
4
- * @param top
5
- */
6
- export declare function getRankTop(data: [number, string][], top?: number): [number, [number, string]][];
@@ -1,36 +0,0 @@
1
- /**
2
- *
3
- * @param data
4
- * @param top
5
- */
6
- export function getRankTop(data, top = 3) {
7
- const ordered = data.toSorted((a, b) => {
8
- if (a[0] < b[0]) {
9
- return 1;
10
- }
11
- if (a[0] > b[0]) {
12
- return -1;
13
- }
14
- return 0;
15
- });
16
- const topList = [];
17
- let last = null;
18
- let keepIndex = 0;
19
- for (let i = 0; i < top; i++) {
20
- const [value] = ordered[i] || [];
21
- if (value == null) {
22
- continue;
23
- }
24
- let rankIndex = i;
25
- if (last && last[0] && last[0] === value) {
26
- rankIndex = keepIndex;
27
- }
28
- else {
29
- keepIndex = rankIndex;
30
- }
31
- const orderedItem = ordered[i] ?? [0, ''];
32
- topList.push([rankIndex + 1, orderedItem]);
33
- last = orderedItem;
34
- }
35
- return topList;
36
- }
@@ -1,6 +0,0 @@
1
- import type { Resource } from '@nitpicker/crawler';
2
- /**
3
- *
4
- * @param resource
5
- */
6
- export declare function isBitmapImage(resource: Resource): boolean;
@@ -1,10 +0,0 @@
1
- /**
2
- *
3
- * @param resource
4
- */
5
- export function isBitmapImage(resource) {
6
- if (!resource.contentType) {
7
- return false;
8
- }
9
- return /^image\/(?:jpe?g|png|gif|tiff|webp?)$/i.test(resource.contentType);
10
- }