Skip to content

Commit ce5bf75

Browse files
committed
ci: verify the packed package with publint, attw and size-limit
Replaces the bespoke 700-line release gate with off-the-shelf tooling, keeping only the one check nothing off-the-shelf covers. Two new jobs run against the packed tarball the publish job uploads verbatim, so they check the exact bytes that ship: Verify package publint --strict, attw, size-limit Verify package loads entry-load.mjs on React 18 and 19 publint and attw cannot see the #759 class: their output is identical across 4.2.3 through 4.2.6, because that regression was a require call inlined into the body of a structurally valid ESM file. Loading the package is the only thing that catches it, which is why entry-load.mjs survives. They do catch two live consumer-facing bugs the bespoke gate never did. Published 4.2.6 gives TypeScript CJS consumers under node16 resolution no type declarations at all, and the package declared no sideEffects. Both are fixed here: types conditions on both exports branches, a duplicated .d.cts, and sideEffects false. Also repoints the size-limit config, which named TSDX-era filenames the vite build stopped emitting, so npm run size was checking nothing. publint runs with --strict because it exits 0 on warnings, and the missing types condition is a warning. attw ignores internal-resolution-error via .attw.json: the emitted .d.ts use extensionless relative imports, which is a real pre-existing bug with its own fix, and ignoring the one rule keeps every other resolution check enforcing. Addresses #765 items 1 to 5. Item 6 is #749 and lands separately.
1 parent 67c6780 commit ce5bf75

7 files changed

Lines changed: 689 additions & 10 deletions

File tree

‎.attw.json‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"$schema": "https://cdn.jsdelivr.net/npm/@arethetypeswrong/cli@0.18.5/config-schema.json",
3+
"ignoreRules": ["internal-resolution-error"]
4+
}

‎.eslintrc.json‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,22 @@
2323
"@typescript-eslint",
2424
"no-only-tests"
2525
],
26+
"overrides": [
27+
{
28+
"files": ["**/*.mjs"],
29+
"env": {
30+
"browser": false,
31+
"node": true
32+
},
33+
"globals": {
34+
"describe": "readonly",
35+
"it": "readonly",
36+
"expect": "readonly",
37+
"beforeEach": "readonly",
38+
"afterEach": "readonly"
39+
}
40+
}
41+
],
2642
"rules": {
2743
"no-only-tests/no-only-tests": "error",
2844
"@typescript-eslint/no-explicit-any": "warn",

‎.github/workflows/test.yaml‎

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,68 @@ jobs:
4646
publish.sh
4747
unpack.sh
4848
retention-days: 1
49+
verify-package:
50+
runs-on: ubuntu-latest
51+
needs: build
52+
name: Verify package
53+
steps:
54+
- name: Checkout
55+
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
56+
with:
57+
persist-credentials: false
58+
- name: Setup node
59+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
60+
with:
61+
node-version: '24'
62+
cache: 'npm'
63+
- name: Install deps
64+
run: npm ci
65+
- name: 'Download Artifacts'
66+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
67+
# Unpacking makes the repo root the shipped package, which is what the
68+
# next two steps need: publint takes a directory, and size-limit reads
69+
# dist/, which is gitignored and so absent from a fresh checkout.
70+
- name: Expand Artifact
71+
run: |
72+
chmod +x reactfire-${{ github.run_id }}/unpack.sh
73+
./reactfire-${{ github.run_id }}/unpack.sh
74+
# --strict because publint exits 0 on warnings, and the manifest problems
75+
# worth gating on (a missing types condition, for one) are warnings.
76+
- name: Lint package
77+
run: npm run lint:package
78+
# Points at the tarball rather than re-packing, so it checks the exact
79+
# bytes that ship. .attw.json ignores internal-resolution-error, because
80+
# the emitted .d.ts use extensionless relative imports, which node16
81+
# resolution rejects. That is a real pre-existing bug with its own fix;
82+
# ignoring the one rule keeps every other resolution check enforcing.
83+
- name: Lint types
84+
run: npm run lint:types -- reactfire-${{ github.run_id }}/reactfire.tgz
85+
- name: Bundle size
86+
run: npm run size
87+
verify-loads:
88+
runs-on: ubuntu-latest
89+
needs: build
90+
name: Verify package loads (React ${{ matrix.react }})
91+
strategy:
92+
matrix:
93+
react: ['18', '19']
94+
fail-fast: false
95+
steps:
96+
- name: Checkout
97+
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
98+
with:
99+
persist-credentials: false
100+
- name: Setup node
101+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
102+
with:
103+
node-version: '24'
104+
- name: 'Download Artifacts'
105+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
106+
# Installs the packed tarball into a throwaway project with real react and
107+
# firebase, then actually loads both entry points. No npm ci: the script
108+
# builds its own dependency tree, which is why it is a separate job.
109+
- name: Entry-point load test
110+
run: node scripts/entry-load.mjs reactfire-${{ github.run_id }}/reactfire.tgz --react ${{ matrix.react }}
49111
test:
50112
runs-on: ubuntu-latest
51113
needs: build
@@ -116,7 +178,7 @@ jobs:
116178
publish:
117179
runs-on: ubuntu-latest
118180
name: Publish (NPM)
119-
needs: test
181+
needs: [test, verify-package, verify-loads]
120182
if: ${{ github.ref == 'refs/heads/main' || github.event_name == 'release' }}
121183
steps:
122184
- name: Setup node

0 commit comments

Comments
 (0)