-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (68 loc) · 3.06 KB
/
Copy pathtest.yml
File metadata and controls
83 lines (68 loc) · 3.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: Test
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: read
# Matrix spans the engines.node range this package promises (>=22.0.0):
# 22 is the supported floor, 24 is the LTS the consuming apps now run on.
# Testing only the newest would leave the floor unverified.
strategy:
fail-fast: false
matrix:
node-version: ['22', '24']
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v7
with:
node-version: ${{ matrix.node-version }}
# Node 22 bundles npm 10.9, whose resolver can crash on a fresh dependency
# graph ("Cannot read properties of null (reading 'edgesOut')" in
# #loadPeerSet, 2026-09-03). This lane verifies our code on the engines
# floor, not npm 10; with no lockfile, every run resolves from the live
# registry, so a current npm keeps the lane about Node rather than npm.
- name: Use a current npm on the Node 22 lane
if: matrix.node-version == '22'
run: npm install -g npm@11
- name: Install dependencies
run: npm install
- name: Check formatting
run: npm run format:check
- name: Lint
run: npm run lint
- name: Typecheck
run: npm run typecheck
- name: Test
run: npm run test
- name: Build
run: npm run build
- name: Validate package structure
run: |
# Note: no Node-ESM import smoke test here (unlike report-components).
# This package targets bundler resolution only — the compiled output
# keeps extensionless directory imports that Next/vite resolve but
# Node's native ESM loader rejects.
test -f dist/package.json || (echo "❌ dist/package.json missing" && exit 1)
test -f dist/index.js || (echo "❌ dist/index.js missing" && exit 1)
test -f dist/index.d.ts || (echo "❌ dist/index.d.ts missing" && exit 1)
test -f dist/README.md || (echo "❌ dist/README.md missing" && exit 1)
test -f dist/types/entity.d.ts || (echo "❌ dist/types/entity.d.ts missing" && exit 1)
# 'use client' / 'use server' directives must survive compilation
CLIENT_COUNT=$(grep -rl "^'use client';" dist --include='*.js' | wc -l)
SERVER_COUNT=$(grep -rl "^'use server';" dist --include='*.js' | wc -l)
echo "use client files: $CLIENT_COUNT, use server files: $SERVER_COUNT"
[ "$CLIENT_COUNT" -ge 40 ] || (echo "❌ expected 'use client' directives in dist" && exit 1)
[ "$SERVER_COUNT" -ge 2 ] || (echo "❌ expected 'use server' directives in dist" && exit 1)
# The published manifest must not be private
node -e "const p=require('./dist/package.json'); if (p.private) { console.error('❌ dist package.json is private'); process.exit(1) }"
echo "✅ Package structure validated"