@decocms/parity 0.11.8 → 0.11.10

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.
Files changed (3) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cli.js +43 -18
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/).
7
7
 
8
+ ## [0.11.10](https://github.com/decocms/parity/compare/v0.11.9...v0.11.10) (2026-06-17)
9
+
10
+ ### Fixed
11
+
12
+ * **Runtime auto-install of Chromium when `postinstall` didn't run.** The 0.11.7 `postinstall` hook works when npm runs it — but plenty of installs skip lifecycle scripts (`npm config set ignore-scripts true`, `npm 11+` global-install default, monorepos with `--ignore-scripts`). Users saw a friendly "run `npx playwright install chromium`" message but still had to run a second command before `parity` worked. Now `launchBrowser` catches the missing-browser error and runs `npx --yes playwright install chromium` inline (with stdio inherited so the download progress is visible), then retries the launch once. The original "you must run X" path is preserved via `PARITY_SKIP_PLAYWRIGHT_INSTALL=1` for CI / Docker / monorepos that want explicit control. Net effect: a fresh `npm i -g @decocms/parity && parity run …` works in one command even when lifecycle scripts are disabled.
13
+
14
+ ## [0.11.9](https://github.com/decocms/parity/compare/v0.11.8...v0.11.9) (2026-06-17)
15
+
16
+ ### Fixed
17
+
18
+ * **Re-publish to refresh `@latest` and let the Publish workflow create the GitHub release.** All the 0.11.x manual `gh release create` calls collided with the CI Publish job's `gh release create --generate-notes` step (it gets `HTTP 422: Release.tag_name already exists` and exits non-zero), which made the workflow look red even though npm publish succeeded each time. This bump has no code changes — it triggers a clean end-to-end publish so the workflow can prove green and `@latest` carries the same artifact as 0.11.8 with a fresh install signature. From now on no manual release creation — the workflow does it.
19
+
8
20
  ## [0.11.8](https://github.com/decocms/parity/compare/v0.11.7...v0.11.8) (2026-06-17)
9
21
 
10
22
  ### Fixed
package/dist/cli.js CHANGED
@@ -1618,6 +1618,7 @@ function countBy(arr, pick) {
1618
1618
  }
1619
1619
 
1620
1620
  // src/engine/browser.ts
1621
+ import { spawnSync } from "node:child_process";
1621
1622
  import { chromium, devices } from "playwright";
1622
1623
 
1623
1624
  // src/engine/carousel-stabilizer.ts
@@ -1790,30 +1791,54 @@ var VIEWPORT_PRESETS = {
1790
1791
  }
1791
1792
  };
1792
1793
  async function launchBrowser(opts = {}) {
1794
+ const doLaunch = () => chromium.launch({
1795
+ headless: opts.headless ?? true,
1796
+ slowMo: opts.slowMo ?? 0,
1797
+ args: ["--disable-blink-features=AutomationControlled"]
1798
+ });
1793
1799
  try {
1794
- return await chromium.launch({
1795
- headless: opts.headless ?? true,
1796
- slowMo: opts.slowMo ?? 0,
1797
- args: ["--disable-blink-features=AutomationControlled"]
1798
- });
1800
+ return await doLaunch();
1799
1801
  } catch (err) {
1800
1802
  const msg = err.message ?? "";
1801
- if (msg.includes("Executable doesn't exist")) {
1802
- const friendly = new Error([
1803
- "Playwright's Chromium binary is not installed yet. Run:",
1804
- "",
1805
- " npx playwright install chromium",
1806
- "",
1807
- "(one-time, ~140 MB download). Then re-run parity. This usually happens",
1808
- "after a fresh `npm install -g @decocms/parity`."
1809
- ].join(`
1810
- `));
1811
- friendly.cause = err;
1812
- throw friendly;
1803
+ if (!msg.includes("Executable doesn't exist"))
1804
+ throw err;
1805
+ if (process.env.PARITY_SKIP_PLAYWRIGHT_INSTALL === "1") {
1806
+ throw missingBrowserError(err);
1807
+ }
1808
+ console.log("");
1809
+ console.log(" ⚠ Playwright's Chromium binary is not installed yet downloading now (~140 MB, one-time)…");
1810
+ console.log(" Set PARITY_SKIP_PLAYWRIGHT_INSTALL=1 to disable this auto-install.");
1811
+ console.log("");
1812
+ const installRc = installChromiumSync();
1813
+ if (installRc !== 0)
1814
+ throw missingBrowserError(err);
1815
+ console.log(" ✓ Chromium ready. Continuing the run.");
1816
+ console.log("");
1817
+ try {
1818
+ return await doLaunch();
1819
+ } catch (retryErr) {
1820
+ throw missingBrowserError(retryErr);
1813
1821
  }
1814
- throw err;
1815
1822
  }
1816
1823
  }
1824
+ function installChromiumSync() {
1825
+ const result = spawnSync("npx", ["--yes", "playwright", "install", "chromium"], {
1826
+ stdio: "inherit",
1827
+ env: process.env
1828
+ });
1829
+ return result.status ?? 1;
1830
+ }
1831
+ function missingBrowserError(cause) {
1832
+ const original = cause instanceof Error ? cause.message : String(cause);
1833
+ return new Error([
1834
+ "Playwright's Chromium binary is not installed.",
1835
+ "Run: npx playwright install chromium",
1836
+ "Or set PARITY_SKIP_PLAYWRIGHT_INSTALL=0 and rerun `parity` to auto-install.",
1837
+ "",
1838
+ `Original error: ${original}`
1839
+ ].join(`
1840
+ `));
1841
+ }
1817
1842
  async function newContext(browser, opts) {
1818
1843
  const baseContext = VIEWPORT_PRESETS[opts.viewport];
1819
1844
  const ctx = await browser.newContext({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decocms/parity",
3
- "version": "0.11.8",
3
+ "version": "0.11.10",
4
4
  "description": "E2E parity validator for site migrations. Compares prod vs cand and reports UI, functional, SEO, visual, and Web Vitals deltas with an LLM-ranked HTML report.",
5
5
  "type": "module",
6
6
  "license": "MIT",