@cleartrip/frontguard 0.1.8 → 0.1.9
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 +22 -9
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/templates/bitbucket-pipelines.yml +45 -54
- package/templates/freekit-ci-setup.md +20 -0
package/dist/cli.js
CHANGED
|
@@ -2458,7 +2458,7 @@ export default defineConfig({
|
|
|
2458
2458
|
// },
|
|
2459
2459
|
|
|
2460
2460
|
// checks: {
|
|
2461
|
-
// bundle: {
|
|
2461
|
+
// bundle: { baselineRef: 'main', maxDeltaBytes: 50_000 }, // ref for git baseline file
|
|
2462
2462
|
// cycles: { enabled: true },
|
|
2463
2463
|
// deadCode: { enabled: true, gate: 'info' },
|
|
2464
2464
|
// // LLM: cloud keys in CI, or local Ollama (no API key) on dev/self-hosted runners:
|
|
@@ -2544,6 +2544,11 @@ function bitbucketDownloadsPageUrl() {
|
|
|
2544
2544
|
}
|
|
2545
2545
|
function formatBitbucketPrSnippet(report) {
|
|
2546
2546
|
const publicReport = process.env.FRONTGUARD_PUBLIC_REPORT_URL?.trim();
|
|
2547
|
+
const linkOnly = process.env.FRONTGUARD_BITBUCKET_COMMENT_LINK_ONLY === "1";
|
|
2548
|
+
if (linkOnly && publicReport) {
|
|
2549
|
+
return publicReport.endsWith("\n") ? publicReport : `${publicReport}
|
|
2550
|
+
`;
|
|
2551
|
+
}
|
|
2547
2552
|
const downloadsName = process.env.FRONTGUARD_REPORT_DOWNLOAD_NAME?.trim();
|
|
2548
2553
|
const downloadsPage = bitbucketDownloadsPageUrl();
|
|
2549
2554
|
const pipeline = bitbucketPipelineResultsUrl();
|
|
@@ -2839,7 +2844,7 @@ var defaultConfig = {
|
|
|
2839
2844
|
tsAnyDeltaToBlock: true
|
|
2840
2845
|
}
|
|
2841
2846
|
},
|
|
2842
|
-
prSize: { warnLines: 400, softBlockLines: 800 },
|
|
2847
|
+
prSize: { enabled: true, warnLines: 400, softBlockLines: 800 },
|
|
2843
2848
|
tsAnyDelta: {
|
|
2844
2849
|
enabled: true,
|
|
2845
2850
|
gate: "warn",
|
|
@@ -2847,24 +2852,25 @@ var defaultConfig = {
|
|
|
2847
2852
|
maxAdded: 0
|
|
2848
2853
|
},
|
|
2849
2854
|
cycles: {
|
|
2850
|
-
enabled:
|
|
2855
|
+
enabled: true,
|
|
2851
2856
|
gate: "warn",
|
|
2852
2857
|
entries: ["src"],
|
|
2853
2858
|
extraArgs: []
|
|
2854
2859
|
},
|
|
2855
2860
|
deadCode: {
|
|
2856
|
-
enabled:
|
|
2861
|
+
enabled: true,
|
|
2857
2862
|
gate: "info",
|
|
2858
2863
|
extraArgs: [],
|
|
2859
2864
|
maxReportLines: 80
|
|
2860
2865
|
},
|
|
2861
2866
|
bundle: {
|
|
2862
|
-
enabled:
|
|
2867
|
+
enabled: true,
|
|
2863
2868
|
gate: "warn",
|
|
2864
2869
|
runBuild: true,
|
|
2865
2870
|
buildCommand: "npm run build",
|
|
2866
2871
|
measureGlobs: ["dist/**/*", "build/static/**/*", ".next/static/**/*"],
|
|
2867
2872
|
baselinePath: ".frontguard/bundle-baseline.json",
|
|
2873
|
+
baselineRef: "main",
|
|
2868
2874
|
maxDeltaBytes: null,
|
|
2869
2875
|
maxTotalBytes: null
|
|
2870
2876
|
},
|
|
@@ -4159,6 +4165,14 @@ function sectionMentioned(body, hint) {
|
|
|
4159
4165
|
// src/checks/pr-size.ts
|
|
4160
4166
|
function runPrSize(config, pr) {
|
|
4161
4167
|
const t0 = performance.now();
|
|
4168
|
+
if (!config.checks.prSize.enabled) {
|
|
4169
|
+
return {
|
|
4170
|
+
checkId: "pr-size",
|
|
4171
|
+
findings: [],
|
|
4172
|
+
durationMs: 0,
|
|
4173
|
+
skipped: "disabled in config"
|
|
4174
|
+
};
|
|
4175
|
+
}
|
|
4162
4176
|
if (!pr) {
|
|
4163
4177
|
return {
|
|
4164
4178
|
checkId: "pr-size",
|
|
@@ -4584,7 +4598,7 @@ async function runBundle(cwd, config, stack) {
|
|
|
4584
4598
|
durationMs: Math.round(performance.now() - t0)
|
|
4585
4599
|
};
|
|
4586
4600
|
}
|
|
4587
|
-
const baseRef = await gitOkQuick(cwd) ? await resolveDiffBaseRef(cwd,
|
|
4601
|
+
const baseRef = await gitOkQuick(cwd) ? await resolveDiffBaseRef(cwd, cfg.baselineRef) : null;
|
|
4588
4602
|
const baseline = await readBaseline(cwd, cfg.baselinePath, baseRef);
|
|
4589
4603
|
const findings = [];
|
|
4590
4604
|
const infoLines = [
|
|
@@ -5107,7 +5121,6 @@ function buildHtmlReport(p2) {
|
|
|
5107
5121
|
.badges { margin-bottom: 1.25rem; display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
|
|
5108
5122
|
.badge { height: 28px; width: auto; max-width: 100%; image-rendering: crisp-edges; }
|
|
5109
5123
|
details { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 0.75rem; }
|
|
5110
|
-
details.open-default { border-color: #3d4f6a; }
|
|
5111
5124
|
summary {
|
|
5112
5125
|
cursor: pointer; padding: 0.65rem 1rem; font-weight: 600;
|
|
5113
5126
|
list-style: none; display: flex; align-items: center; gap: 0.5rem;
|
|
@@ -5172,12 +5185,12 @@ function buildHtmlReport(p2) {
|
|
|
5172
5185
|
<tbody>${checkRows}</tbody>
|
|
5173
5186
|
</table>
|
|
5174
5187
|
|
|
5175
|
-
<details
|
|
5188
|
+
<details>
|
|
5176
5189
|
<summary>Blocking (${blocks})</summary>
|
|
5177
5190
|
<div class="details-body">${blockingHtml}</div>
|
|
5178
5191
|
</details>
|
|
5179
5192
|
|
|
5180
|
-
<details
|
|
5193
|
+
<details>
|
|
5181
5194
|
<summary>Warnings (${warns})</summary>
|
|
5182
5195
|
<div class="details-body">${warningsHtml}</div>
|
|
5183
5196
|
</details>
|