refactor: share one headless-Chrome helper between check-render and build-og-card
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 72/100
- issue の種類
- リファクタリング
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- javascript, node.js
- 領域
- tooling
調査の方向性
scripts/check-render.mjs と scripts/build-og-card.mjs を読み、それぞれの Chrome の検出、起動、終了、および CDP クライアントのコードを比較します。共通部分を scripts/chrome.mjs に抽出し、レンダリング固有の動作と呼び出し側の PAGE_TIMEOUT_MS の判断はそのまま残します。npm run check-render と npm run og-card を実行します。レンダリングの失敗が同一のままで、card が引き続きバイト単位で比較可能であれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Branch off master and PR into master, not main. This is the v1 site.
scripts/build-og-card.mjs (#130) needs headless Chrome for exactly the same reasons scripts/check-render.mjs does, and it now carries its own copy of the same four pieces of plumbing:
findChrome()— theCHROME_PATHoverride and the per-platform install locationslaunchChrome()— the flag set, and scraping the DevTools URL out of stderrstopChrome()— waiting for the exit rather than the signal, because Windows keeps the user-data-dir locked until Chrome has goneconnect()/withTimeout()— the minimal CDP client over one browser-level socket
The card builder's copy is the smaller of the two: it drives one page, so it drops the event waitFor and the per-target session bookkeeping check-render needs. Nothing about the Chrome handling itself differs.
This is the shape #162 was about. There, check-canonicals and check-render had a static.yml allowlist parser each, and they had already drifted in a way that mattered: the render check read only the first cp ... _site/, so a page added in a later cp deployed but was never rendered. One parser in scripts/static-allowlist.mjs fixed it. The same argument applies here before these two copies drift — a fix to Chrome discovery, or a new flag needed for a future Chrome, currently has to be made twice, and only one of the two runs in CI, so the other can rot unnoticed.
Not urgent: the copies are identical today, and build-og-card.mjs is a manual tool run rarely rather than a check. Filed so it is a decision rather than an accident.
Proposal
Extract the shared parts into scripts/chrome.mjs, alongside scripts/static-allowlist.mjs, and have both scripts import it. check-render.mjs keeps whatever is genuinely specific to rendering every page (the viewport list, the is-loading and image-ratio measurement, the page loop).
Worth deciding as part of it: whether PAGE_TIMEOUT_MS belongs to the module or stays per-caller, since the two have no reason to agree.
Acceptance criteria
- One copy of Chrome discovery, launch, shutdown and the CDP client
-
npm run check-renderbehaves identically — same failures on a broken image, a distorted aspect ratio and a stuckis-loading -
npm run og-cardstill produces a byte-comparable card - Neither script reaches into the other
Refs #130, #162
- 主要言語
- HTML
- スター
- 0
- フォーク
- 0
- 平均マージ
- 9時間 52分
- マージ済み PR(30日)
- 59
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
laywill/laywill.github.io のほかの issue
-
design
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
laywill/laywill.github.io#186 ·
メンテナーはふだん 1 日以内に返信
-
design
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
laywill/laywill.github.io#183 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 半日 初心者へのやさしさ 74/100
laywill/laywill.github.io#135 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
laywill/laywill.github.io#106 ·
メンテナーはふだん 1 日以内に返信
-
infra needs-william
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
laywill/laywill.github.io#35 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
laywill/laywill.github.io の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
acsandmann/rift#577 ·
メンテナーはふだん 1 日以内に返信
-
type: bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
blamechris/chroxy#8579 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
enhancement good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
-
needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
darnitdevorg/darnit#587 ·
メンテナーはふだん 1 日以内に返信