@nitpicker/report-google-sheets 0.6.3 → 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.
@@ -50,6 +50,7 @@ export const createDiscrepancies = (reports) => {
50
50
  }
51
51
  for (const discrepancy of report.discrepancies) {
52
52
  data.push([
53
+ createCellData({ value: report.name }, defaultCellFormat),
53
54
  createCellData({ value: discrepancy.leftSourceUrl, note: discrepancy.leftSourceUrlNote }, defaultCellFormat),
54
55
  createCellData({ value: discrepancy.left, note: discrepancy.leftNote }, defaultCellFormat),
55
56
  createCellData({ value: discrepancy.right, note: discrepancy.rightNote }, defaultCellFormat),
@@ -52,7 +52,7 @@ export const createImageList = () => {
52
52
  createCellData({ value: img.height }, defaultCellFormat),
53
53
  // createCellData({ value: img.naturalWidth }, defaultCellFormat),
54
54
  // createCellData({ value: img.naturalHeight }, defaultCellFormat),
55
- createCellData({ value: img.loading === 'lazy' }, defaultCellFormat),
55
+ createCellData({ value: img.getAttribute('loading') === 'lazy' }, defaultCellFormat),
56
56
  createCellData({ value: img.outerHTML }, defaultCellFormat),
57
57
  ];
58
58
  imgData.push(data);
@@ -5,8 +5,6 @@ import { defaultCellFormat } from '../sheets/default-cell-format.js';
5
5
  import { booleanFormatError } from '../sheets/format.js';
6
6
  import { nonNullFilter } from '../utils/non-null-filter.js';
7
7
  const log = pLog.extend('PageList');
8
- const indexTitles = new Map();
9
- const indexRefs = new Map();
10
8
  /**
11
9
  * Creates the "Page List" sheet configuration -- the primary sitemap-style report.
12
10
  *
@@ -35,6 +33,8 @@ const indexRefs = new Map();
35
33
  * @param reports - Analyze plugin reports to extract per-page data columns from
36
34
  */
37
35
  export const createPageList = (reports) => {
36
+ const indexTitles = new Map();
37
+ const indexRefs = new Map();
38
38
  const reportPageData = reports
39
39
  .map((r) => (r.pageData ? { name: r.name, pageData: r.pageData } : null))
40
40
  .filter(nonNullFilter);
package/lib/report.js CHANGED
@@ -155,7 +155,9 @@ export async function report(params) {
155
155
  ? 'Too Many Requests (429)'
156
156
  : message.message === 'UserRateLimitExceededError'
157
157
  ? 'Rate Limit Exceeded (403)'
158
- : 'Connection Reset';
158
+ : message.message === 'ServerError'
159
+ ? `Server Error (${message.code ?? '5xx'})`
160
+ : 'Connection Reset';
159
161
  lanes.update(RATE_LIMIT_LANE, c.yellow(`${label}: waiting %countdown(${message.waitTime}, ${id}, s)%s`));
160
162
  }
161
163
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nitpicker/report-google-sheets",
3
- "version": "0.6.3",
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",
@@ -29,10 +29,10 @@
29
29
  "dependencies": {
30
30
  "@d-zero/dealer": "1.7.0",
31
31
  "@d-zero/google-auth": "0.5.6",
32
- "@d-zero/google-sheets": "0.6.0",
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": "4b58ca83e5f48833b22889ed46d96984938fa1c9"
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
- }