Skip to content

Commit 033d334

Browse files
committed
ci(astro): smoke-test via static grep (vanilla Node can't import .astro re-export)
v0.1.2 re-exports <Image> from dist/index.js using 'export { default as Image } from "./Image.astro"'. Node has no loader for .astro, so vanilla 'node import("./dist/index.js")' fails with 'Unknown file extension'. That's expected — only Astro/Vite consumers can evaluate this module. Smoke test switches to static grep over the tarball contents, which catches packaging regressions (wrong main path, missing export, broken re-export specifier) without requiring an Astro build runner.
1 parent 82c97f5 commit 033d334

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

.github/workflows/publish-astro.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,22 @@ jobs:
155155
echo "$STRAY_TS"
156156
exit 1
157157
fi
158-
# Scratch install + entry-point import must succeed:
158+
# Scratch install verifies the package's own deps + peers resolve.
159159
(cd "$SMOKE/extract/package" && npm install --omit=dev)
160-
node -e "import('$SMOKE/extract/package/dist/index.js').then(m => { if (typeof m.run402 !== 'function') { console.error('run402 export is not a function'); process.exit(1); } console.log('Smoke OK'); }).catch(e => { console.error('Import failed:', e.message); process.exit(1); })"
160+
# Static structural validation. We deliberately do NOT
161+
# `import('./dist/index.js')` in vanilla Node — the module
162+
# re-exports `<Image>` from `./Image.astro`, and Node has no
163+
# loader for `.astro`. This is expected; only Astro/Vite
164+
# consumers can evaluate this module. So smoke-test the file
165+
# structure + the static export list via grep, which catches
166+
# packaging regressions (wrong main path, missing export,
167+
# broken re-export specifier) without requiring an Astro build.
168+
grep -q "^export function run402" "$SMOKE/extract/package/dist/index.js" \
169+
|| (echo "Missing run402 export from dist/index.js" && exit 1)
170+
grep -q "^export { default as Image } from" "$SMOKE/extract/package/dist/index.js" \
171+
|| (echo "Missing Image re-export from dist/index.js" && exit 1)
172+
grep -q "buildPictureHtml" "$SMOKE/extract/package/dist/Image.astro" \
173+
|| (echo "Image.astro missing expected import" && exit 1)
161174
162175
- name: Publish to npm
163176
if: ${{ !inputs.dry_run }}

0 commit comments

Comments
 (0)