Skip to content

Commit 3dd6c87

Browse files
ci: add verify-types job to prevent missing typings on publish (#1576)
## Summary Preventive measures to avoid a repeat of #1573. ### CI: new `verify-types` job Adds a dedicated CI job that runs `npm run build:types` in parallel with unit tests on every PR. If type declaration generation fails, the build fails before merge. ### Remove `scripts/prepack.js` This file originally existed to flatten rpt2's output — rpt2 dumped declarations into `dist/typings/src/` instead of `dist/typings/`, so the script moved them up before publish. Since #1574 moved declaration generation to `tsc --project tsconfig.types.json`, this script became dead code. `tsc` outputs directly to `dist/typings/` with no `src/` subdirectory. More importantly, if `tsc` fails it exits non-zero — stopping the `prepack` chain and blocking publish. A separate guard file adds nothing on top of that. `prepack` simplified from: ``` npm run build && npm run build:types && node ./scripts/prepack ``` to: ``` npm run build && npm run build:types ```
1 parent 3784ed2 commit 3dd6c87

3 files changed

Lines changed: 27 additions & 33 deletions

File tree

.github/workflows/test.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,32 @@ jobs:
7878
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # pin@6.0.0
7979
with:
8080
token: ${{ secrets.CODECOV_TOKEN }}
81+
82+
verify-types:
83+
needs: test
84+
85+
name: Verify Type Declarations
86+
runs-on: ubuntu-latest
87+
88+
steps:
89+
- name: Checkout code
90+
uses: actions/checkout@v6
91+
92+
- name: Setup Node
93+
uses: actions/setup-node@v6
94+
with:
95+
node-version: ${{ env.NODE_VERSION }}
96+
package-manager-cache: false
97+
98+
- name: Restore build artifacts
99+
uses: actions/cache/restore@v5
100+
with:
101+
path: .
102+
key: ${{ env.CACHE_KEY }}
103+
104+
- name: Generate type declarations
105+
run: npm run build:types
106+
81107
gatsby:
82108
needs: test
83109

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"serve:coverage": "serve coverage/lcov-report -n",
5252
"serve:stats": "serve bundle-stats -n",
5353
"print-bundle-size": "node ./scripts/print-bundle-size.mjs",
54-
"prepack": "npm run build && npm run build:types && node ./scripts/prepack",
54+
"prepack": "npm run build && npm run build:types",
5555
"publish:cdn": "ccu --trace"
5656
},
5757
"devDependencies": {

scripts/prepack.js

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)