Skip to content

Commit 86303cf

Browse files
committed
Error if package.json missing on dist branch
The script can't auto-generate a correct package.json from main (paths would be wrong: ./dist/index.js vs ./index.js). Initial dist setup must be done manually.
1 parent eab9969 commit 86303cf

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

scripts/build-dist.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,16 @@ git clean -fdx -e dist -e node_modules -e package.json.dist
2929
mv dist/* . 2>/dev/null || true
3030
rmdir dist 2>/dev/null || true
3131

32-
# Restore dist branch's package.json (or add metadata from source if first build)
32+
# Restore dist branch's package.json
3333
if [ -f package.json.dist ]; then
3434
mv package.json.dist package.json
3535
else
36-
# First build: checkout from source and fix paths
37-
git checkout "$SOURCE_SHA" -- package.json README.md LICENSE 2>/dev/null || true
36+
echo "ERROR: No package.json found on dist branch"
37+
echo "This script requires an existing dist branch with a package.json"
38+
echo "For initial dist branch setup, manually create package.json with correct paths:"
39+
echo " main: ./index.cjs (not ./dist/index.cjs)"
40+
echo " module: ./index.js (not ./dist/index.js)"
41+
exit 1
3842
fi
3943

4044
# Stage all changes

0 commit comments

Comments
 (0)