Updates
This commit is contained in:
parent
56462e6cc2
commit
3faf4be368
@ -21,7 +21,10 @@
|
||||
"bun": ">=1.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "tsc --watch"
|
||||
"dev": "tsc --watch",
|
||||
"compile": "rm -rf dist tsconfig.tsbuildinfo && tsc -p tsconfig.json",
|
||||
"typecheck": "tsc -p tsconfig.json --noEmit",
|
||||
"prepublishOnly": "bun run compile"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/bun": "latest",
|
||||
|
||||
44
publish.sh
44
publish.sh
@ -2,23 +2,51 @@
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
if [ -z "${1:-}" ]; then
|
||||
msg="Updates"
|
||||
else
|
||||
msg="$1"
|
||||
fi
|
||||
|
||||
tsc --noEmit
|
||||
rm -rf dist
|
||||
tsc
|
||||
# Always use the project's TypeScript (global `tsc` may not emit)
|
||||
export PATH="$(pwd)/node_modules/.bin:$PATH"
|
||||
|
||||
# Ensure CLI shebang survived compile
|
||||
if ! head -1 dist/commands/index.js | grep -q '#!/usr/bin/env bun'; then
|
||||
echo "ERROR: dist/commands/index.js is missing the bun shebang"
|
||||
if [ ! -x "./node_modules/.bin/tsc" ]; then
|
||||
echo "Installing dependencies..."
|
||||
bun install
|
||||
fi
|
||||
|
||||
echo "Typechecking..."
|
||||
tsc -p tsconfig.json --noEmit
|
||||
|
||||
echo "Compiling..."
|
||||
# Clear emit output AND incremental cache. Otherwise a prior --noEmit run leaves
|
||||
# tsbuildinfo "up to date" and tsc emits nothing after `rm -rf dist`.
|
||||
rm -rf dist tsconfig.tsbuildinfo
|
||||
tsc -p tsconfig.json
|
||||
|
||||
if [ ! -f dist/commands/index.js ]; then
|
||||
echo "ERROR: compile failed — dist/commands/index.js was not produced"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
git add .
|
||||
# Ensure CLI shebang survived compile
|
||||
if ! head -1 dist/commands/index.js | grep -q '^#!/usr/bin/env bun'; then
|
||||
echo "Restoring bun shebang on dist/commands/index.js"
|
||||
printf '%s\n' '#!/usr/bin/env bun' | cat - dist/commands/index.js > dist/commands/index.js.tmp
|
||||
mv dist/commands/index.js.tmp dist/commands/index.js
|
||||
fi
|
||||
|
||||
chmod +x dist/commands/index.js
|
||||
|
||||
echo "Build OK: $(head -1 dist/commands/index.js)"
|
||||
|
||||
echo "Publishing package..."
|
||||
git add -A
|
||||
git commit -m "$msg" || true
|
||||
git push
|
||||
git push || true
|
||||
bun publish
|
||||
|
||||
echo "Done."
|
||||
|
||||
Loading…
Reference in New Issue
Block a user