Skip to content

Commit c6d53d8

Browse files
committed
chore(deps): vendor smart-account-kit + bindings as tgz for deploy parity
1 parent 12dcc62 commit c6d53d8

3 files changed

Lines changed: 165 additions & 33 deletions

File tree

.husky/commit-msg

Lines changed: 53 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,57 @@
1+
#!/usr/bin/env sh
12

3+
# Conventional Commits validator
4+
# Spec: https://www.conventionalcommits.org/en/v1.0.0/
5+
# Format: <type>(<scope>)?(!)?: <description>
6+
# Types from @commitlint/config-conventional
27

3-
# Conventional commit message format
4-
# Format: <type>(<scope>): <description>
5-
# Types: feat, fix, docs, style, refactor, test, chore, perf, ci, build, revert, merge
6-
# Also allows Git's standard merge commit format: "Merge branch '...' of ... into ..."
7-
8-
# Regex for conventional commits
9-
conventional_regex='^(feat|fix|docs|style|refactor|test|chore|perf|ci|build|revert|merge)(\(.+\))?: .{1,50}'
10-
11-
# Regex for Git merge commits
12-
merge_regex='^Merge branch .* of .* into .*'
13-
merge_regex='^Merge branch .* of .*'
14-
15-
# Combined regex - either conventional or merge format
16-
commit_regex="($conventional_regex|$merge_regex)"
17-
18-
if ! grep -qE "$commit_regex" "$1"; then
19-
echo "❌ Invalid commit message format."
20-
echo "✅ Please use either:"
21-
echo " 1. Conventional commit format: <type>(<scope>): <description>"
22-
echo " 2. Git's standard merge format: Merge branch '...' of ... into ..."
23-
echo ""
24-
echo "📝 Examples:"
25-
echo " feat: add new wallet connection feature"
26-
echo " fix(wallet): resolve persistence issue"
27-
echo " docs: update README with setup instructions"
28-
echo " style: format code with prettier"
29-
echo " refactor(components): improve wallet button"
30-
echo " Merge branch 'main' of https://github.com/user/repo into feature/branch"
31-
echo ""
32-
echo "🔧 Types: feat, fix, docs, style, refactor, test, chore, perf, ci, build, revert, merge"
33-
exit 1
8+
commit_msg_file="$1"
9+
first_line=$(head -n1 "$commit_msg_file")
10+
11+
# Ignore comment lines and empty messages
12+
if [ -z "$first_line" ] || echo "$first_line" | grep -qE '^#'; then
13+
exit 0
14+
fi
15+
16+
# Conventional commits regex (types from @commitlint/config-conventional)
17+
conventional_regex='^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\([a-z0-9._\-]+\))?!?: .+'
18+
19+
# Git auto-generated merge/revert commits
20+
merge_regex='^Merge (branch|remote-tracking branch|tag|pull request) '
21+
revert_regex='^Revert ".+"'
22+
23+
# Fixup/squash commits (used with `git commit --fixup` / `--squash`, resolved on rebase)
24+
fixup_regex='^(fixup|squash)! '
25+
26+
if echo "$first_line" | grep -qE "$conventional_regex"; then
27+
exit 0
28+
fi
29+
30+
if echo "$first_line" | grep -qE "$merge_regex"; then
31+
exit 0
32+
fi
33+
34+
if echo "$first_line" | grep -qE "$revert_regex"; then
35+
exit 0
36+
fi
37+
38+
if echo "$first_line" | grep -qE "$fixup_regex"; then
39+
exit 0
3440
fi
3541

36-
echo "✅ Commit message format is valid!"
42+
echo "❌ Invalid commit message format."
43+
echo ""
44+
echo "Expected Conventional Commits format:"
45+
echo " <type>(<scope>)?: <description>"
46+
echo ""
47+
echo "Allowed types:"
48+
echo " build, chore, ci, docs, feat, fix, perf, refactor, revert, style, test"
49+
echo ""
50+
echo "Examples:"
51+
echo " feat: add new wallet connection feature"
52+
echo " fix(wallet): resolve persistence issue"
53+
echo " chore(deps): bump smart-account-kit to 0.4.2"
54+
echo " refactor(components)!: drop legacy wallet button props"
55+
echo ""
56+
echo "Tip: for dependency bumps use 'chore(deps):' or 'build(deps):'."
57+
exit 1

next.config.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import type { NextConfig } from 'next';
22

33
const nextConfig: NextConfig = {
4-
transpilePackages: ['smart-account-kit'],
4+
// Both vendored as tgz now (see vendor/); npm extracts them into node_modules
5+
// as real directories, so Turbopack resolves them normally — no alias needed.
6+
transpilePackages: ['smart-account-kit', 'smart-account-kit-bindings'],
57
outputFileTracingRoot: __dirname,
68
async redirects() {
79
return [

scripts/update-sak.sh

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Rebuild + re-vendor smart-account-kit + smart-account-kit-bindings.
4+
#
5+
# Run this whenever you want to pick up new commits from the SAK upstream.
6+
# Assumes the SAK repo is cloned as a sibling: ../smart-account-kit
7+
#
8+
# Why this exists: smart-account-kit is consumed as a vendored tgz committed
9+
# under ./vendor/ so production deploys (Railway, CI, anywhere) have no need
10+
# for a sibling-repo checkout. See ./vendor/README.md.
11+
#
12+
# Usage:
13+
# ./scripts/update-sak.sh # pulls latest main from upstream, rebuilds, vendors
14+
# ./scripts/update-sak.sh --no-pull # skip git pull (use whatever's checked out locally)
15+
16+
set -euo pipefail
17+
18+
THIS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
19+
BOUNDLESS_ROOT="$(cd "$THIS_DIR/.." && pwd)"
20+
SAK_ROOT="$(cd "$BOUNDLESS_ROOT/../smart-account-kit" && pwd)"
21+
VENDOR_DIR="$BOUNDLESS_ROOT/vendor"
22+
23+
NO_PULL=false
24+
for arg in "$@"; do
25+
case "$arg" in
26+
--no-pull) NO_PULL=true ;;
27+
*) echo "Unknown arg: $arg" >&2; exit 1 ;;
28+
esac
29+
done
30+
31+
if [ ! -d "$SAK_ROOT" ]; then
32+
echo "ERROR: SAK repo not found at $SAK_ROOT" >&2
33+
echo " Clone it as a sibling: git clone <url> ../smart-account-kit" >&2
34+
exit 1
35+
fi
36+
37+
echo "▸ SAK source: $SAK_ROOT"
38+
echo "▸ Boundless root: $BOUNDLESS_ROOT"
39+
echo "▸ Vendor dir: $VENDOR_DIR"
40+
echo
41+
42+
cd "$SAK_ROOT"
43+
44+
if [ "$NO_PULL" = false ]; then
45+
echo "▸ Pulling latest main from SAK upstream"
46+
git checkout main
47+
git pull --ff-only
48+
fi
49+
50+
echo "▸ Installing SAK dependencies"
51+
pnpm install --frozen-lockfile
52+
53+
echo "▸ Building SAK + bindings"
54+
pnpm build
55+
56+
echo "▸ Packing SAK (uses pnpm pack to resolve workspace: refs)"
57+
rm -f smart-account-kit-*.tgz
58+
pnpm pack >/dev/null
59+
60+
echo "▸ Packing bindings"
61+
cd packages/smart-account-kit-bindings
62+
rm -f smart-account-kit-bindings-*.tgz
63+
pnpm pack >/dev/null
64+
cd "$SAK_ROOT"
65+
66+
SAK_TGZ=$(ls smart-account-kit-*.tgz | head -1)
67+
BINDINGS_TGZ="packages/smart-account-kit-bindings/$(ls packages/smart-account-kit-bindings/smart-account-kit-bindings-*.tgz | head -1 | xargs basename)"
68+
69+
if [ -z "$SAK_TGZ" ] || [ -z "$BINDINGS_TGZ" ]; then
70+
echo "ERROR: pack failed to produce tgz files" >&2
71+
exit 1
72+
fi
73+
74+
mkdir -p "$VENDOR_DIR"
75+
76+
echo "▸ Copying tgz files into vendor/"
77+
rm -f "$VENDOR_DIR"/smart-account-kit-*.tgz \
78+
"$VENDOR_DIR"/smart-account-kit-bindings-*.tgz
79+
cp "$SAK_TGZ" "$VENDOR_DIR/"
80+
cp "$BINDINGS_TGZ" "$VENDOR_DIR/"
81+
82+
NEW_SAK_NAME=$(basename "$SAK_TGZ")
83+
NEW_BINDINGS_NAME=$(basename "$BINDINGS_TGZ")
84+
85+
echo "▸ Updating package.json references (if version changed)"
86+
cd "$BOUNDLESS_ROOT"
87+
# Use node to do a safe in-place edit (preserves formatting)
88+
node -e "
89+
const fs = require('fs');
90+
const path = 'package.json';
91+
const pkg = JSON.parse(fs.readFileSync(path, 'utf8'));
92+
pkg.dependencies['smart-account-kit'] = 'file:./vendor/$NEW_SAK_NAME';
93+
pkg.dependencies['smart-account-kit-bindings'] = 'file:./vendor/$NEW_BINDINGS_NAME';
94+
fs.writeFileSync(path, JSON.stringify(pkg, null, 2) + '\n');
95+
"
96+
97+
echo "▸ Reinstalling in boundless"
98+
rm -rf node_modules/smart-account-kit node_modules/smart-account-kit-bindings \
99+
node_modules/.cache .next
100+
npm install
101+
102+
echo
103+
echo "✓ Done. Vendored:"
104+
ls -lh "$VENDOR_DIR"/*.tgz
105+
echo
106+
echo "Next steps:"
107+
echo " git add vendor/ package.json package-lock.json"
108+
echo " git commit -m 'chore: bump vendored smart-account-kit'"
109+
echo " npm run dev # verify locally"

0 commit comments

Comments
 (0)