@se-studio/site-check 2.19.1 → 2.22.1

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 (95) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/README.md +11 -0
  3. package/develop-published-gate.mjs +701 -0
  4. package/dist/check-pages-exist.d.ts.map +1 -1
  5. package/dist/check-pages-exist.js +2 -1
  6. package/dist/check-pages-exist.js.map +1 -1
  7. package/dist/check-rewrites.d.ts.map +1 -1
  8. package/dist/check-rewrites.js +2 -1
  9. package/dist/check-rewrites.js.map +1 -1
  10. package/dist/cli.js +8 -1
  11. package/dist/cli.js.map +1 -1
  12. package/dist/collect-markdown-urls.d.ts.map +1 -1
  13. package/dist/collect-markdown-urls.js +2 -1
  14. package/dist/collect-markdown-urls.js.map +1 -1
  15. package/dist/download.d.ts.map +1 -1
  16. package/dist/download.js +2 -1
  17. package/dist/download.js.map +1 -1
  18. package/dist/fetch-timeout.d.ts +9 -0
  19. package/dist/fetch-timeout.d.ts.map +1 -0
  20. package/dist/fetch-timeout.js +17 -0
  21. package/dist/fetch-timeout.js.map +1 -0
  22. package/dist/smoke-test/cms-page-checks.d.ts.map +1 -1
  23. package/dist/smoke-test/cms-page-checks.js +1 -0
  24. package/dist/smoke-test/cms-page-checks.js.map +1 -1
  25. package/dist/smoke-test/config.d.ts.map +1 -1
  26. package/dist/smoke-test/config.js +106 -0
  27. package/dist/smoke-test/config.js.map +1 -1
  28. package/dist/smoke-test/content-assert.d.ts +14 -1
  29. package/dist/smoke-test/content-assert.d.ts.map +1 -1
  30. package/dist/smoke-test/content-assert.js +29 -5
  31. package/dist/smoke-test/content-assert.js.map +1 -1
  32. package/dist/smoke-test/dead-links.d.ts +58 -0
  33. package/dist/smoke-test/dead-links.d.ts.map +1 -0
  34. package/dist/smoke-test/dead-links.js +180 -0
  35. package/dist/smoke-test/dead-links.js.map +1 -0
  36. package/dist/smoke-test/environment.d.ts +19 -0
  37. package/dist/smoke-test/environment.d.ts.map +1 -0
  38. package/dist/smoke-test/environment.js +55 -0
  39. package/dist/smoke-test/environment.js.map +1 -0
  40. package/dist/smoke-test/index.d.ts +7 -2
  41. package/dist/smoke-test/index.d.ts.map +1 -1
  42. package/dist/smoke-test/index.js +4 -1
  43. package/dist/smoke-test/index.js.map +1 -1
  44. package/dist/smoke-test/runner.d.ts.map +1 -1
  45. package/dist/smoke-test/runner.js +90 -18
  46. package/dist/smoke-test/runner.js.map +1 -1
  47. package/dist/smoke-test/smoke-coverage/classify.d.ts +10 -0
  48. package/dist/smoke-test/smoke-coverage/classify.d.ts.map +1 -0
  49. package/dist/smoke-test/smoke-coverage/classify.js +90 -0
  50. package/dist/smoke-test/smoke-coverage/classify.js.map +1 -0
  51. package/dist/smoke-test/smoke-coverage/evaluate.d.ts +29 -0
  52. package/dist/smoke-test/smoke-coverage/evaluate.d.ts.map +1 -0
  53. package/dist/smoke-test/smoke-coverage/evaluate.js +270 -0
  54. package/dist/smoke-test/smoke-coverage/evaluate.js.map +1 -0
  55. package/dist/smoke-test/smoke-coverage/index.d.ts +8 -0
  56. package/dist/smoke-test/smoke-coverage/index.d.ts.map +1 -0
  57. package/dist/smoke-test/smoke-coverage/index.js +7 -0
  58. package/dist/smoke-test/smoke-coverage/index.js.map +1 -0
  59. package/dist/smoke-test/smoke-coverage/model.d.ts +20 -0
  60. package/dist/smoke-test/smoke-coverage/model.d.ts.map +1 -0
  61. package/dist/smoke-test/smoke-coverage/model.js +114 -0
  62. package/dist/smoke-test/smoke-coverage/model.js.map +1 -0
  63. package/dist/smoke-test/smoke-coverage/run.d.ts +19 -0
  64. package/dist/smoke-test/smoke-coverage/run.d.ts.map +1 -0
  65. package/dist/smoke-test/smoke-coverage/run.js +123 -0
  66. package/dist/smoke-test/smoke-coverage/run.js.map +1 -0
  67. package/dist/smoke-test/smoke-coverage/sitemap.d.ts +34 -0
  68. package/dist/smoke-test/smoke-coverage/sitemap.d.ts.map +1 -0
  69. package/dist/smoke-test/smoke-coverage/sitemap.js +148 -0
  70. package/dist/smoke-test/smoke-coverage/sitemap.js.map +1 -0
  71. package/dist/smoke-test/smoke-coverage/types.d.ts +74 -0
  72. package/dist/smoke-test/smoke-coverage/types.d.ts.map +1 -0
  73. package/dist/smoke-test/smoke-coverage/types.js +13 -0
  74. package/dist/smoke-test/smoke-coverage/types.js.map +1 -0
  75. package/dist/smoke-test/static.d.ts.map +1 -1
  76. package/dist/smoke-test/static.js +69 -6
  77. package/dist/smoke-test/static.js.map +1 -1
  78. package/dist/smoke-test/types.d.ts +23 -6
  79. package/dist/smoke-test/types.d.ts.map +1 -1
  80. package/dist/smoke-test/types.js.map +1 -1
  81. package/dist/validate.d.ts.map +1 -1
  82. package/dist/validate.js +5 -3
  83. package/dist/validate.js.map +1 -1
  84. package/dist/xml-entities.d.ts +3 -0
  85. package/dist/xml-entities.d.ts.map +1 -0
  86. package/dist/xml-entities.js +10 -0
  87. package/dist/xml-entities.js.map +1 -0
  88. package/docs/develop-published.md +36 -0
  89. package/docs/llms.md +1 -0
  90. package/docs/smoke-assertions.md +72 -0
  91. package/docs/smoke-coverage.md +92 -0
  92. package/package.json +6 -2
  93. package/smoke-coverage-dry-run.mjs +61 -0
  94. package/templates/develop-published/develop-published-gate.yml +129 -0
  95. package/templates/develop-published/update-develop-published.yml +58 -0
@@ -0,0 +1,129 @@
1
+ # Template from @se-studio/site-check (templates/develop-published). Replace __PROJECT_NAME__ (the Vercel
2
+ # project name), __PROD_URL__ and __DRAFT_CANARY__ (a draft-only path), and check the integration branch.
3
+ # If one repo gates several apps, copy the file per app and give each copy its own GATE_CONTEXT (e.g.
4
+ # `develop-published gate (<project>)`) and workflow name; the skip-if-green check reads that context.
5
+ # Promote gate: full smoke, content smoke and prod compare against the develop-published build.
6
+ # Runs when Vercel finishes a develop-published deployment, and on demand. Posts a commit status
7
+ # `develop-published gate` on the exact commit, so a develop -> main promote PR (whose head is
8
+ # develop's head) shows it.
9
+ name: develop-published gate
10
+
11
+ on:
12
+ repository_dispatch:
13
+ types:
14
+ - vercel.deployment.ready
15
+ workflow_dispatch:
16
+ inputs:
17
+ deployment_url:
18
+ description: develop-published deployment URL
19
+ required: true
20
+ type: string
21
+ deployment_sha:
22
+ description: Commit the deployment was built from
23
+ required: true
24
+ type: string
25
+ promote_sha:
26
+ description: Commit being promoted (default = deployment_sha)
27
+ required: false
28
+ type: string
29
+
30
+ permissions:
31
+ contents: read
32
+ statuses: write
33
+
34
+ # One gate run per commit. A develop-published SHA is normally built twice (the branch push and the deploy
35
+ # hook), and each READY deployment sends its own vercel.deployment.ready event; the newer run cancels the
36
+ # older one. Events the job would skip anyway get a unique group so they can never cancel a real run.
37
+ concurrency:
38
+ group: develop-published-gate-${{ github.event_name == 'workflow_dispatch' && (inputs.promote_sha || inputs.deployment_sha) || (github.event.client_payload.project.name == '__PROJECT_NAME__' && github.event.client_payload.git.ref == 'develop-published' && github.event.client_payload.environment == 'preview' && github.event.client_payload.git.sha) || github.run_id }}
39
+ cancel-in-progress: true
40
+
41
+ jobs:
42
+ gate:
43
+ if: |
44
+ github.event_name == 'workflow_dispatch' ||
45
+ (
46
+ github.event_name == 'repository_dispatch' &&
47
+ github.event.client_payload.project.name == '__PROJECT_NAME__' &&
48
+ github.event.client_payload.git.ref == 'develop-published' &&
49
+ github.event.client_payload.environment == 'preview'
50
+ )
51
+ runs-on: ubuntu-latest
52
+ # A healthy prod compare of a large sitemap takes about 20 minutes; this only stops a hung run. A
53
+ # timed-out job counts as cancelled, so it posts no status (the promote PR shows none, not green).
54
+ timeout-minutes: 35
55
+ env:
56
+ GATE_CONTEXT: develop-published gate
57
+ DEPLOYMENT_URL: ${{ github.event_name == 'workflow_dispatch' && inputs.deployment_url || github.event.client_payload.url }}
58
+ DEPLOYMENT_SHA: ${{ github.event_name == 'workflow_dispatch' && inputs.deployment_sha || github.event.client_payload.git.sha }}
59
+ PROMOTE_SHA: ${{ github.event_name == 'workflow_dispatch' && (inputs.promote_sha || inputs.deployment_sha) || github.event.client_payload.git.sha }}
60
+ steps:
61
+ # A third deploy of a SHA that already passed must not run the gate again. Only a `success` status
62
+ # skips: failure, error, pending or no status runs the gate, and so does an API error. The newest
63
+ # status for the context wins, so a later failure re-opens the gate. Manual runs always run.
64
+ - name: Skip when this commit already has a green gate status
65
+ id: already
66
+ if: github.event_name == 'repository_dispatch'
67
+ env:
68
+ GH_TOKEN: ${{ github.token }}
69
+ run: |
70
+ latest=$(gh api --paginate "repos/${GITHUB_REPOSITORY}/commits/${PROMOTE_SHA}/statuses?per_page=100" \
71
+ --jq '.[] | select(.context == env.GATE_CONTEXT) | .state' | sed -n 1p) || latest=""
72
+ echo "Latest '${GATE_CONTEXT}' status on ${PROMOTE_SHA}: ${latest:-none}"
73
+ if [ "$latest" = "success" ]; then
74
+ echo "skip=true" >> "$GITHUB_OUTPUT"
75
+ echo "## develop-published gate: skipped" >> "$GITHUB_STEP_SUMMARY"
76
+ echo "A \`success\` status for \`${GATE_CONTEXT}\` already exists on ${PROMOTE_SHA}; no new status posted." >> "$GITHUB_STEP_SUMMARY"
77
+ fi
78
+ - name: Checkout the promoted commit
79
+ if: steps.already.outputs.skip != 'true'
80
+ uses: actions/checkout@v7
81
+ with:
82
+ ref: ${{ env.PROMOTE_SHA }}
83
+ fetch-depth: 0
84
+ - uses: pnpm/action-setup@v6
85
+ if: steps.already.outputs.skip != 'true'
86
+ - uses: actions/setup-node@v7
87
+ if: steps.already.outputs.skip != 'true'
88
+ with:
89
+ node-version: '24'
90
+ cache: pnpm
91
+ - run: pnpm install --frozen-lockfile
92
+ if: steps.already.outputs.skip != 'true'
93
+ - name: Gate
94
+ if: steps.already.outputs.skip != 'true'
95
+ env:
96
+ VERCEL_PROTECTION_BYPASS_TOKEN: ${{ secrets.VERCEL_PROTECTION_BYPASS_TOKEN }}
97
+ run: |
98
+ pnpm exec develop-published-gate \
99
+ --url "$DEPLOYMENT_URL" \
100
+ --prod-url "__PROD_URL__" \
101
+ --host-prefix "__PROJECT_NAME__-" \
102
+ --deployment-sha "$DEPLOYMENT_SHA" \
103
+ --expect-sha "$PROMOTE_SHA" \
104
+ --draft-canary "__DRAFT_CANARY__" \
105
+ --json gate-result.json
106
+ - name: Gate summary
107
+ if: always() && steps.already.outputs.skip != 'true'
108
+ run: |
109
+ if [ -f gate-result.json ]; then
110
+ node -e 'const r=require("./gate-result.json");console.log("## develop-published gate: "+(r.ok?"PASS":"FAIL")+"\n");for(const s of r.stages)console.log("- "+(s.ok?"PASS":"FAIL")+" "+s.name+": "+s.detail)' >> "$GITHUB_STEP_SUMMARY"
111
+ fi
112
+ - uses: actions/upload-artifact@v7
113
+ if: always() && steps.already.outputs.skip != 'true'
114
+ with:
115
+ name: develop-published-gate
116
+ path: gate-result.json
117
+ if-no-files-found: ignore
118
+ - name: Post commit status
119
+ if: ${{ !cancelled() && steps.already.outputs.skip != 'true' }}
120
+ env:
121
+ GH_TOKEN: ${{ github.token }}
122
+ STATE: ${{ job.status == 'success' && 'success' || 'failure' }}
123
+ run: |
124
+ # On the promoted commit (the promote PR head). Same SHA as the build unless Vercel skipped it.
125
+ gh api "repos/${GITHUB_REPOSITORY}/statuses/${PROMOTE_SHA}" \
126
+ -f state="$STATE" \
127
+ -f context="$GATE_CONTEXT" \
128
+ -f description="Smoke, content smoke and prod compare on the develop-published build" \
129
+ -f target_url="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
@@ -0,0 +1,58 @@
1
+ # Template from @se-studio/site-check (templates/develop-published). Change `develop` below if the site integrates on another branch.
2
+ # Keeps the `develop-published` branch at develop's head. Vercel builds that branch as a preview
3
+ # with DRAFT_ONLY=false (branch-scoped Preview env var), so it serves PUBLISHED Contentful content.
4
+ #
5
+ # develop-published only ever fast-forwards. Nobody edits it, and this job never force-pushes:
6
+ # if develop-published cannot fast-forward to develop, the job fails and nothing is pushed.
7
+ name: Update develop-published
8
+
9
+ on:
10
+ push:
11
+ branches:
12
+ - develop
13
+ workflow_dispatch:
14
+
15
+ permissions:
16
+ contents: write
17
+
18
+ # Runs queue in order; never cancel one mid-push.
19
+ concurrency:
20
+ group: develop-published
21
+ cancel-in-progress: false
22
+
23
+ jobs:
24
+ fast-forward:
25
+ runs-on: ubuntu-latest
26
+ steps:
27
+ - uses: actions/checkout@v7
28
+ with:
29
+ ref: develop
30
+ fetch-depth: 0
31
+ - name: Fast-forward develop-published to develop
32
+ run: |
33
+ set -euo pipefail
34
+ git fetch --quiet origin develop
35
+ target="$(git rev-parse origin/develop)"
36
+ if git ls-remote --exit-code --heads origin develop-published >/dev/null 2>&1; then
37
+ git fetch --quiet origin develop-published
38
+ current="$(git rev-parse origin/develop-published)"
39
+ if [ "$current" = "$target" ] || git merge-base --is-ancestor "$target" "$current"; then
40
+ echo "develop-published ($current) already contains develop ($target); nothing to do."
41
+ exit 0
42
+ fi
43
+ if ! git merge-base --is-ancestor "$current" "$target"; then
44
+ echo "::error::develop-published ($current) is not an ancestor of develop ($target). It cannot fast-forward. Not pushing. Someone edited develop-published or develop was rewritten: stop and investigate."
45
+ exit 1
46
+ fi
47
+ fi
48
+ # Plain push, no --force: the remote rejects anything that is not a fast-forward.
49
+ git push origin "$target:refs/heads/develop-published"
50
+ echo "develop-published -> $target"
51
+ # Vercel's Git integration does not build a second branch that points at a commit it has already
52
+ # built, so the push above may create no deployment. Trigger the build explicitly, for example with
53
+ # a Vercel deploy hook for ref develop-published (repo secret DEVELOP_PUBLISHED_DEPLOY_HOOK).
54
+ # Left commented: creating the hook is a Vercel project setting that the site owner approves.
55
+ # - name: Trigger the develop-published build
56
+ # env:
57
+ # DEPLOY_HOOK: ${{ secrets.DEVELOP_PUBLISHED_DEPLOY_HOOK }}
58
+ # run: curl -fsS -X POST "$DEPLOY_HOOK"