From 146ef9e8caff970fcfda6a0e3a5af894176689b2 Mon Sep 17 00:00:00 2001 From: slayerjain Date: Fri, 4 Dec 2026 20:19:26 +0530 Subject: [PATCH 1/2] docs(developer): show all plans on Kubernetes developer pages and Free allowance - Update the ProductTier badge on all 9 developer/*.md pages and both keploy-cloud/kubernetes*.md setup pages from tiers="Enterprise" to tiers="Free, Teams, Scale, Enterprise" (matching api-server's IntegrationTesting plan entitlements and the UI Testing pages). - Replace the Enterprise-only account prerequisite on keploy-cloud/kubernetes.md and kubernetes-local-setup.md with any Keploy plan (including Free). - Note Free's monthly allowance (10,000 tests run plus mocks used a month) on developer/overview.md and developer/ci.md. - Add scripts/verify-developer-plan-badges.js, wire it into package.json and .github/workflows/build_and_check.yml. Signed-off-by: slayerjain --- .github/workflows/build_and_check.yml | 3 + package.json | 1 + scripts/verify-developer-plan-badges.js | 127 ++++++++++++++++++ .../version-4.0.0/developer/auto-replay.md | 2 +- versioned_docs/version-4.0.0/developer/ci.md | 4 +- .../version-4.0.0/developer/coverage.md | 2 +- .../version-4.0.0/developer/edit-test-data.md | 2 +- .../developer/fix-failing-tests.md | 2 +- .../version-4.0.0/developer/manual-replay.md | 2 +- .../version-4.0.0/developer/overview.md | 4 +- .../version-4.0.0/developer/record.md | 2 +- .../version-4.0.0/developer/setup.md | 2 +- .../keploy-cloud/kubernetes-local-setup.md | 4 +- .../version-4.0.0/keploy-cloud/kubernetes.md | 4 +- 14 files changed, 148 insertions(+), 13 deletions(-) create mode 100644 scripts/verify-developer-plan-badges.js diff --git a/.github/workflows/build_and_check.yml b/.github/workflows/build_and_check.yml index 4d0594351..16bb31ca6 100644 --- a/.github/workflows/build_and_check.yml +++ b/.github/workflows/build_and_check.yml @@ -69,6 +69,9 @@ jobs: - name: Verify every docs link the UI Capture SDK ships run: yarn verify-ui-capture-sdk-links + - name: Verify Kubernetes developer plan badges + run: yarn verify-developer-plan-badges + # A page moved or deleted with no redirect is not in src/redirects.js, # so build the branch this PR goes into, set up the same way: the next # step checks that every page in its sitemap still has its URL here. diff --git a/package.json b/package.json index 9afeb9a5e..4166a8a85 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "verify-linkedin-tag": "node scripts/verify-linkedin-tag.js build", "verify-lastmod": "node scripts/verify-lastmod.js build", "verify-ui-capture-sdk-links": "node scripts/verify-ui-capture-sdk-links.js build", + "verify-developer-plan-badges": "node scripts/verify-developer-plan-badges.js build", "verify-moved-urls": "node scripts/verify-moved-urls.js build", "swizzle": "docusaurus swizzle", "deploy": "docusaurus deploy", diff --git a/scripts/verify-developer-plan-badges.js b/scripts/verify-developer-plan-badges.js new file mode 100644 index 000000000..c3efab186 --- /dev/null +++ b/scripts/verify-developer-plan-badges.js @@ -0,0 +1,127 @@ +// Verifies that Kubernetes developer-workflow pages carry the full plan badge +// ("Free, Teams, Scale, Enterprise") matching api-server's IntegrationTesting +// plan entitlements (Free, Teams, Scale, Enterprise), do not claim an +// Enterprise-only plan prerequisite on Kubernetes setup pages, and when a +// Docusaurus build directory is supplied, render all four plan chips in the +// built HTML. +// +// Usage: node scripts/verify-developer-plan-badges.js [build dir] +const fs = require("fs"); +const path = require("path"); + +const REPO_ROOT = path.resolve(__dirname, ".."); +const DEV_DIR = path.join( + REPO_ROOT, + "versioned_docs", + "version-4.0.0", + "developer" +); +const K8S_SETUP_FILES = [ + path.join( + REPO_ROOT, + "versioned_docs", + "version-4.0.0", + "keploy-cloud", + "kubernetes.md" + ), + path.join( + REPO_ROOT, + "versioned_docs", + "version-4.0.0", + "keploy-cloud", + "kubernetes-local-setup.md" + ), +]; + +const WANT_BADGE = + ''; +const WANT_CHIPS = ["Free", "Teams", "Scale", "Enterprise"]; +const FORBID_TEXT = /Keploy account on the Enterprise plan/i; + +const errors = []; + +const devFiles = fs + .readdirSync(DEV_DIR) + .filter((f) => f.endsWith(".md") || f.endsWith(".mdx")) + .sort() + .map((f) => path.join(DEV_DIR, f)); + +if (devFiles.length === 0) { + errors.push(`no markdown files found in ${DEV_DIR}`); +} + +const allChecked = [...devFiles, ...K8S_SETUP_FILES]; + +for (const file of allChecked) { + const rel = path.relative(REPO_ROOT, file); + const src = fs.readFileSync(file, "utf8"); + if (!src.includes(WANT_BADGE)) { + const match = src.match(/]*>/); + errors.push( + `${rel}: expected ${WANT_BADGE}, found ${match ? match[0] : "(none)"}` + ); + } + if (FORBID_TEXT.test(src)) { + errors.push(`${rel}: must not claim an Enterprise-only plan prerequisite`); + } +} + +for (const allowanceFile of ["overview.md", "ci.md"]) { + const full = path.join(DEV_DIR, allowanceFile); + const rel = path.relative(REPO_ROOT, full); + const src = fs.readFileSync(full, "utf8"); + if (!/10,000 tests run plus mocks used/i.test(src)) { + errors.push( + `${rel}: missing Free plan monthly allowance (10,000 tests run plus mocks used)` + ); + } +} + +const buildDir = process.argv[2] ? path.resolve(process.argv[2]) : null; +if (buildDir) { + for (const file of allChecked) { + const rel = path.relative(REPO_ROOT, file); + const idMatch = fs.readFileSync(file, "utf8").match(/^id:\s*(.+)$/m); + const slug = idMatch + ? idMatch[1].trim() + : path.basename(file, path.extname(file)); + const section = path.basename(path.dirname(file)); + const htmlPath = path.join(buildDir, section, slug, "index.html"); + if (!fs.existsSync(htmlPath)) { + errors.push(`${rel}: built HTML missing at ${htmlPath}`); + continue; + } + const html = fs.readFileSync(htmlPath, "utf8"); + const chipBlockMatch = html.match( + /
([\s\S]*?)<\/div>/ + ); + if (!chipBlockMatch) { + errors.push(`${rel}: built HTML missing .product-tier-chips block`); + continue; + } + const chipBlock = chipBlockMatch[1]; + for (const chip of WANT_CHIPS) { + if (!chipBlock.includes(`>${chip}`)) { + errors.push(`${rel}: built HTML missing plan chip "${chip}"`); + } + } + if (FORBID_TEXT.test(html)) { + errors.push( + `${rel}: built HTML still claims an Enterprise-only plan prerequisite` + ); + } + } +} + +if (errors.length > 0) { + console.error("Developer plan badge verification failed:"); + for (const e of errors) { + console.error(` - ${e}`); + } + process.exit(1); +} + +console.log( + `OK: ${allChecked.length} Kubernetes developer/setup pages verified` + + (buildDir ? ` (source + built HTML in ${buildDir})` : " (source)") +); diff --git a/versioned_docs/version-4.0.0/developer/auto-replay.md b/versioned_docs/version-4.0.0/developer/auto-replay.md index 6976f362a..9985d3262 100644 --- a/versioned_docs/version-4.0.0/developer/auto-replay.md +++ b/versioned_docs/version-4.0.0/developer/auto-replay.md @@ -16,7 +16,7 @@ keywords: import ProductTier from '@site/src/components/ProductTier'; - +