@cleartrip/frontguard 0.2.3 → 0.2.4

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": "@cleartrip/frontguard",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "Org-wide frontend PR guardrails: linting, hygiene, any-delta, cycles, dead code, bundle/CWV hints, custom rules, optional LLM brief",
5
5
  "type": "module",
6
6
  "bin": {
@@ -0,0 +1,30 @@
1
+ # Optional fragment: PNG of the Checks table in the PR comment (Bitbucket Cloud)
2
+ #
3
+ # Merge into pull-requests after `frontguard run` produces:
4
+ # - frontguard-checks.html (--checksSnapshotOut)
5
+ # - frontguard-report.html (--htmlOut)
6
+ #
7
+ # Flow:
8
+ # 1. Screenshot the minimal HTML with Playwright (Chromium).
9
+ # 2. Upload the PNG somewhere HTTPS-public (examples below).
10
+ # 3. export FRONTGUARD_CHECKS_IMAGE_URL='https://.../frontguard-checks.png'
11
+ # 4. Run frontguard again with --prCommentOut (or only export + re-run snippet step) so the comment includes ![...](url).
12
+ #
13
+ # The PR body is Markdown: Bitbucket renders ![](https://...) images when the URL is reachable.
14
+
15
+ # --- Example: screenshot + upload to Bitbucket Downloads (public file URL for repo viewers) ---
16
+ # - npx playwright@1.49.0 install chromium
17
+ # - |
18
+ # FILE_URL="$(node --input-type=module -e "import { pathToFileURL } from 'node:url'; console.log(pathToFileURL('frontguard-checks.html').href)")"
19
+ # npx playwright@1.49.0 screenshot "$FILE_URL" frontguard-checks.png --viewport-size=920,2000
20
+ # - |
21
+ # curl --silent --show-error --fail --request POST \
22
+ # --url "https://api.bitbucket.org/2.0/repositories/${BITBUCKET_REPO_FULL_NAME}/downloads" \
23
+ # --header "Authorization: Bearer ${BITBUCKET_ACCESS_TOKEN}" \
24
+ # --form "files=@frontguard-checks.png"
25
+ # # Then set FRONTGUARD_CHECKS_IMAGE_URL to the href Bitbucket returns for that file (see API response),
26
+ # # or construct the known downloads URL pattern for your workspace.
27
+ #
28
+ # --- Example: same image hosted on your CDN / object storage ---
29
+ # - aws s3 cp frontguard-checks.png s3://my-bucket/ci/frontguard-checks-${BITBUCKET_BUILD_NUMBER}.png --acl public-read
30
+ # - export FRONTGUARD_CHECKS_IMAGE_URL="https://my-bucket.s3.amazonaws.com/ci/frontguard-checks-${BITBUCKET_BUILD_NUMBER}.png"
@@ -22,6 +22,27 @@ On **Bitbucket Pipelines** pull-request builds, FrontGuard reads **`BITBUCKET_PR
22
22
  - **Limits:** Per FreeKit docs — e.g. HTML payload size caps, **rate limits** (creates per minute per IP), possible `429`. Large reports or busy runners may need retries or another host.
23
23
  - **No delete token in CI:** Each run creates a **new** site URL. Old FreeKit URLs may still work until you delete them with the `deleteToken` returned in the API response (this template does not store it).
24
24
 
25
+ ## Checks table image in PR comments
26
+
27
+ Bitbucket renders **`![](https://.../checks.png)`** in PR comments when the URL is public HTTPS. FrontGuard can emit a **minimal HTML** file that contains only the Checks table (same styling as the full report):
28
+
29
+ ```bash
30
+ yarn frontguard run --markdown \
31
+ --htmlOut frontguard-report.html \
32
+ --checksSnapshotOut frontguard-checks.html \
33
+ > frontguard-report.md
34
+ ```
35
+
36
+ Then:
37
+
38
+ 1. **Screenshot** `frontguard-checks.html` with headless Chromium (e.g. `npx playwright screenshot "<file://...>" frontguard-checks.png`).
39
+ 2. **Upload** the PNG to a reachable URL (Bitbucket Downloads API, S3, CDN, etc.).
40
+ 3. Set **`FRONTGUARD_CHECKS_IMAGE_URL`** to that URL **before** writing the PR comment (e.g. before `formatBitbucketPrSnippet` / `--prCommentOut`).
41
+
42
+ The snippet places the image at the **top** of the comment and keeps the **full interactive report** link below (with a short line explaining that details are in the HTML).
43
+
44
+ See **`templates/checks-snapshot-bitbucket-snippet.yml`** for merge-ready pipeline examples.
45
+
25
46
  ## Compared to Surge
26
47
 
27
48
  Surge credentials (`SURGE_LOGIN` / `SURGE_TOKEN`) are **not** required for FreeKit’s open POST flow. If you remove Surge, you can delete any old Surge-related secured variables from the repository.