@cleartrip/frontguard 0.1.9 → 0.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/dist/cli.js +195 -197
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +10 -5
- package/package.json +1 -1
- package/templates/freekit-ci-setup.md +7 -0
package/dist/index.d.ts
CHANGED
|
@@ -67,7 +67,7 @@ interface FrontGuardConfig {
|
|
|
67
67
|
tsAnyDelta: {
|
|
68
68
|
enabled: boolean;
|
|
69
69
|
gate: CheckGate;
|
|
70
|
-
/** Fallback when
|
|
70
|
+
/** Fallback merge-base ref when `BITBUCKET_PR_DESTINATION_BRANCH` is unset (e.g. `main`) */
|
|
71
71
|
baseRef: string;
|
|
72
72
|
/** Warn/block when added-any count exceeds this (0 = only report delta). */
|
|
73
73
|
maxAdded: number;
|
|
@@ -88,18 +88,23 @@ interface FrontGuardConfig {
|
|
|
88
88
|
/** Max lines of ts-prune output to attach */
|
|
89
89
|
maxReportLines: number;
|
|
90
90
|
};
|
|
91
|
-
/**
|
|
91
|
+
/**
|
|
92
|
+
* Static bundle size: optionally run `buildCommand`, then sum bytes under `measureGlobs`.
|
|
93
|
+
* For default `npm run build`, the run is skipped (info) when `package.json` has no matching script — use `buildCommand` / `runBuild: false` for non-standard repos.
|
|
94
|
+
*/
|
|
92
95
|
bundle: {
|
|
93
96
|
enabled: boolean;
|
|
94
97
|
gate: CheckGate;
|
|
95
|
-
/**
|
|
98
|
+
/** When false, only measures existing files (no build). Set false for libs/backends with no web bundle. */
|
|
96
99
|
runBuild: boolean;
|
|
100
|
+
/** E.g. `npm run build`, `pnpm run vite-build`, or any command that produces artifacts under measureGlobs */
|
|
97
101
|
buildCommand: string;
|
|
98
102
|
measureGlobs: string[];
|
|
99
103
|
baselinePath: string;
|
|
100
104
|
/**
|
|
101
|
-
* Git ref used to read `baselinePath` from the base branch when the file is not on disk
|
|
102
|
-
*
|
|
105
|
+
* Git ref used to read `baselinePath` from the base branch when the file is not on disk.
|
|
106
|
+
* Bitbucket PR pipelines set `BITBUCKET_PR_DESTINATION_BRANCH`, which is preferred for resolving the ref.
|
|
107
|
+
* Separate from `tsAnyDelta.baseRef` so bundle can track a release branch.
|
|
103
108
|
*/
|
|
104
109
|
baselineRef: string;
|
|
105
110
|
maxDeltaBytes: number | null;
|
package/package.json
CHANGED
|
@@ -8,6 +8,13 @@ The Bitbucket template uploads `frontguard-report.html` with **no signup or API
|
|
|
8
8
|
|
|
9
9
|
Optional env (advanced): **`FREEKIT_BASE_URL`** — override the API host (e.g. self‑hosted instance per FreeKit docs).
|
|
10
10
|
|
|
11
|
+
## PR checks (`pr-hygiene`, `pr-size`)
|
|
12
|
+
|
|
13
|
+
On **Bitbucket Pipelines** pull-request builds, FrontGuard reads **`BITBUCKET_PR_ID`** (and related branch env vars) and computes diff size with **`git diff <destination>...HEAD --numstat`**, so **`pr-size` runs** when the destination ref exists in the clone.
|
|
14
|
+
|
|
15
|
+
- **`pr-hygiene`** needs the PR description text. Bitbucket does not expose the body in default env vars — set **`FRONTGUARD_PR_BODY`** in the pipeline (e.g. fetch from the [Bitbucket PR API](https://developer.atlassian.com/cloud/bitbucket/rest/api-group-pullrequests/) in a prior step and `export` it) if you want body-length / section / AI-disclosure rules to apply.
|
|
16
|
+
- **Shallow clones:** If `git` cannot resolve `BITBUCKET_PR_DESTINATION_BRANCH`, add a **`git fetch`** of the base branch so `pr-size` can measure the PR (see Bitbucket “clone depth” docs).
|
|
17
|
+
|
|
11
18
|
## Things to know
|
|
12
19
|
|
|
13
20
|
- **Public:** Anyone with the link can open the report. Do not use for highly sensitive content unless you add FreeKit **password** protection via their API (requires passing `password` in the JSON — not in this template).
|