Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
"engines": {
"node": ">=16"
},
"version": "7.0.0",
"version": "7.0.1",
"type": "module",
"description": "A GLSL ES 1.0 and 3.0 parser and preprocessor that can preserve whitespace and comments",
"scripts": {
"prepare": "npm run build && ./prepublish.sh",
"postpublish": "./postbuild.sh",
"build": "./build.sh",
"watch-test": "vitest --watch",
"test": "vitest"
"test": "vitest",
"test-publish": "./test-publish.sh"
},
"files": [
"ast",
Expand Down
2 changes: 2 additions & 0 deletions prepublish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ cp -r dist/src/* .
# Copy peggy-generated parsers to their directories (build.sh places these in
# dist/parser/ and dist/preprocessor/, separate from the compiled TypeScript in dist/src/)
cp dist/parser/parser.js parser/
cp dist/parser/parser.d.ts parser/
cp dist/preprocessor/preprocessor-parser.js preprocessor/
cp dist/preprocessor/preprocessor-parser.d.ts preprocessor/

# Remove test files from the published directories - they're not part of the package
# and if present they confuse Vitest into running compiled JS tests with broken module paths
Expand Down
35 changes: 35 additions & 0 deletions test-publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash
set -e

# Test that the published package contains all required type declaration files.
# Run this before publishing to catch missing .d.ts files.

PACK_OUTPUT=$(npm pack --dry-run 2>&1)

REQUIRED_FILES=(
"parser/parser.d.ts"
"preprocessor/preprocessor-parser.d.ts"
"index.d.ts"
"parser/index.d.ts"
"preprocessor/index.d.ts"
"ast/index.d.ts"
)

FAILED=0
for FILE in "${REQUIRED_FILES[@]}"; do
if echo "$PACK_OUTPUT" | grep -q "$FILE"; then
echo " ok $FILE"
else
echo "MISSING $FILE"
FAILED=1
fi
done

if [ $FAILED -ne 0 ]; then
echo ""
echo "Publish type check FAILED — missing .d.ts files in package"
exit 1
else
echo ""
echo "Publish type check passed"
fi