@d-zero/archaeologist 3.1.1 → 3.2.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/README.md CHANGED
@@ -5,9 +5,10 @@
5
5
  ウェブサイトの本番環境と開発環境や、新旧のページの比較するためのツールです。
6
6
 
7
7
  - Puppeteerを実行してページのスクリーンショットを撮影します
8
- - スクリーンショットはデスクトップとモバイルの2つのサイズでそれぞれ撮影します
8
+ - 複数のデバイスサイズでスクリーンショットを撮影可能(7種類のプリセット + カスタム設定)
9
9
  - スクリーンショットは画像差分(ビジュアルリグレッション)を検出・出力します
10
10
  - HTMLの差分も検出します
11
+ - レスポンシブデザインの差分検証に最適
11
12
 
12
13
  ## CLI
13
14
 
@@ -23,12 +24,35 @@ URLリストを持つファイルを指定して実行します。
23
24
  - `-t, --type <types>`: 比較タイプの指定(`image,dom,text`、カンマ区切り)
24
25
  - `-s, --selector <selector>`: 比較対象を限定するCSSセレクター
25
26
  - `-i, --ignore <selector>`: 無視するCSSセレクター
26
- - `--devices <devices>`: デバイス指定(`desktop,mobile,tablet`、カンマ区切り)
27
+ - `-d, --devices <devices>`: デバイスプリセット(カンマ区切り、デフォルト: desktop-compact,mobile
27
28
  - `--freeze <filepath>`: フリーズモード用ファイルパス
28
29
  - `--limit <number>`: 並列実行数の上限(デフォルト: 10)
29
30
  - `--debug`: デバッグモード(デフォルト: false)
30
31
  - `--verbose`: 詳細ログモード(デフォルト: false)
31
32
 
33
+ ### 利用可能なデバイスプリセット
34
+
35
+ - `desktop`: 1400px幅
36
+ - `tablet`: 768px幅
37
+ - `mobile`: 375px幅(2倍解像度)
38
+ - `desktop-hd`: 1920px幅
39
+ - `desktop-compact`: 1280px幅
40
+ - `mobile-large`: 414px幅(3倍解像度)
41
+ - `mobile-small`: 320px幅(2倍解像度)
42
+
43
+ ### 使用例
44
+
45
+ ```sh
46
+ # デフォルトデバイス(desktop-compact, mobile)
47
+ npx @d-zero/archaeologist -f urls.txt
48
+
49
+ # カスタムデバイス指定
50
+ npx @d-zero/archaeologist -f urls.txt --devices desktop,tablet,mobile
51
+
52
+ # フリーズモード(参照用スクリーンショット作成)
53
+ npx @d-zero/archaeologist --freeze urls.txt
54
+ ```
55
+
32
56
  ### ファイルフォーマット
33
57
 
34
58
  ファイルの先頭には比較対象のホストを指定します。[Frontmatter](https://jekyllrb.com/docs/front-matter/)形式で`comparisonHost`に指定します。
package/dist/cli.js CHANGED
@@ -9,8 +9,30 @@ const { options, hasConfigFile } = createCLI({
9
9
  t: 'type',
10
10
  s: 'selector',
11
11
  i: 'ignore',
12
+ d: 'devices',
12
13
  },
13
- usage: ['Usage: archaeologist -f <listfile> [--limit <number>]'],
14
+ usage: [
15
+ 'Usage: archaeologist -f <listfile> [options]',
16
+ '',
17
+ 'Options:',
18
+ '\t-f, --listfile <file> File containing URL pairs to analyze',
19
+ '\t-t, --type <types> Analysis types (comma-separated): image,dom,text',
20
+ '\t-d, --devices <devices> Device presets (comma-separated, default: desktop-compact,mobile)',
21
+ '\t-s, --selector <selector> CSS selector for specific elements',
22
+ '\t-i, --ignore <ignore> CSS selector for elements to ignore',
23
+ '\t--freeze <file> Freeze mode: capture reference screenshots',
24
+ '\t--limit <number> Limit concurrent processes',
25
+ '\t--debug Enable debug mode',
26
+ '\t--verbose Enable verbose logging',
27
+ '',
28
+ 'Available device presets:',
29
+ '\tdesktop, tablet, mobile, desktop-hd, desktop-compact, mobile-large, mobile-small',
30
+ '',
31
+ 'Examples:',
32
+ '\tarchaeologist -f urls.txt',
33
+ '\tarchaeologist -f urls.txt --devices desktop,mobile',
34
+ '\tarchaeologist --freeze urls.txt',
35
+ ],
14
36
  parseArgs: (cli) => ({
15
37
  ...parseCommonOptions(cli),
16
38
  listfile: cli.listfile,
@@ -1,5 +1,5 @@
1
1
  import { distill } from '@d-zero/html-distiller';
2
- import { defaultSizes } from '@d-zero/puppeteer-page-scan';
2
+ import { createSizesFromDevices } from '@d-zero/puppeteer-page-scan';
3
3
  import { screenshotListener, screenshot } from '@d-zero/puppeteer-screenshot';
4
4
  /**
5
5
  *
@@ -10,12 +10,8 @@ import { screenshotListener, screenshot } from '@d-zero/puppeteer-screenshot';
10
10
  */
11
11
  export async function getData(page, url, options, update) {
12
12
  const htmlDiffOnly = options.htmlDiffOnly ?? false;
13
- const devices = options.devices ?? ['desktop', 'mobile'];
14
- const sizes = {};
15
- for (const device of devices) {
16
- // @ts-ignore
17
- sizes[device] = defaultSizes[device];
18
- }
13
+ const devices = options.devices ?? ['desktop-compact', 'mobile'];
14
+ const sizes = createSizesFromDevices([...devices]);
19
15
  const screenshots = await screenshot(page, url, {
20
16
  sizes,
21
17
  hooks: options?.hooks ?? [],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d-zero/archaeologist",
3
- "version": "3.1.1",
3
+ "version": "3.2.0",
4
4
  "description": "Uncover visual and HTML differences in web pages with precision",
5
5
  "author": "D-ZERO",
6
6
  "license": "MIT",
@@ -27,9 +27,9 @@
27
27
  "@d-zero/cli-core": "1.1.1",
28
28
  "@d-zero/fs": "0.2.1",
29
29
  "@d-zero/html-distiller": "2.0.1",
30
- "@d-zero/puppeteer-dealer": "0.5.3",
31
- "@d-zero/puppeteer-page-scan": "4.0.4",
32
- "@d-zero/puppeteer-screenshot": "3.1.3",
30
+ "@d-zero/puppeteer-dealer": "0.5.4",
31
+ "@d-zero/puppeteer-page-scan": "4.1.0",
32
+ "@d-zero/puppeteer-screenshot": "3.1.4",
33
33
  "@d-zero/readtext": "1.1.8",
34
34
  "@d-zero/shared": "0.9.2",
35
35
  "ansi-colors": "4.1.3",
@@ -41,7 +41,7 @@
41
41
  "parse-diff": "0.11.1",
42
42
  "pixelmatch": "7.1.0",
43
43
  "pngjs": "7.0.0",
44
- "puppeteer": "24.17.1",
44
+ "puppeteer": "24.18.0",
45
45
  "strip-ansi": "7.1.0"
46
46
  },
47
47
  "devDependencies": {
@@ -49,5 +49,5 @@
49
49
  "@types/pixelmatch": "5.2.6",
50
50
  "@types/pngjs": "6.0.5"
51
51
  },
52
- "gitHead": "6fa0fd190c54351762a70039cd8dfcafc51caa0b"
52
+ "gitHead": "8081edac801400fed7c0b7ebeccc0ce66ccfe131"
53
53
  }