feat: Replace foliate-js submodule with npm git dependency

Migrate from git submodule to npm package management for better
developer experience and simplified deployment.
Changes:
- Add @bookhoard/foliate-js from GitHub fork
(john-okeefe/foliate-js#bookhoard-panel-detection)
- Update vite alias to point to node_modules instead of vendor
- Delete .gitmodules (no submodules tracked)
- Remove scripts/setup-git-hooks.sh (no longer needed)
- Delete web/vendor/foliate-js/ submodule directory
- Remove sc-commit git alias (submodule-specific)
Benefits:
- Standard npm workflow (npm install / npm update)
- No authentication issues for end users (public GitHub)
- Simpler deployment (npm ci in containers)
- foliate-js protected in node_modules (AI won't rewrite)
- Independent project management
- Cleaner git history
Technical details:
- Import remains unchanged: import "foliate-js/view.js"
- Vite alias maps "foliate-js" to "/node_modules/@bookhoard/foliate-js"
- Build verified working (reader.js includes foliate-js)
- Package installed from git branch: bookhoard-panel-detection
This commit is contained in:
2026-04-12 17:09:19 -04:00
parent fd6cee0997
commit c7a9098c69
5 changed files with 3 additions and 30 deletions
-3
View File
@@ -1,3 +0,0 @@
[submodule "web/vendor/foliate-js"]
path = web/vendor/foliate-js
url = git@github.com:john-okeefe/foliate-js.git
+2 -1
View File
@@ -21,7 +21,8 @@
"pdfjs-dist": "^5.6.205",
"@techstark/opencv-js": "^4.12.0-release.1",
"@tensorflow/tfjs": "^4.22.0",
"@tensorflow-models/coco-ssd": "^2.2.3"
"@tensorflow-models/coco-ssd": "^2.2.3",
"@bookhoard/foliate-js": "github:john-okeefe/foliate-js#bookhoard-panel-detection"
},
"devDependencies": {
"@tailwindcss/forms": "^0.5.11",
-24
View File
@@ -1,24 +0,0 @@
#!/bin/bash
# One-time setup for git hooks on this machine
echo "🔒 Installing pre-push safety hook to prevent pushing with uncommitted submodule changes..."
# Create hooks directory
mkdir -p .git/hooks
# Create pre-push hook
cat >.git/hooks/pre-push <<'EOF'
#!/bin/bash
# Prevent pushing if submodules have uncommitted changes
uncommitted=$(git submodule foreach --quiet 'if [ "$(git status --porcelain)" != "" ]; then echo $name; fi')
if [ -n "$uncommitted" ]; then
echo "❌ ERROR: Submodules have uncommitted changes:"
echo "$uncommitted"
echo "Commit submodules first (or use git sc-commit)"
exit 1
fi
EOF
# Make hook executable
chmod +x .git/hooks/pre-push
# Add git alias for submodule commit
git config --global alias.sc-commit '!sh -c "git submodule foreach \"git add -A && git commit -m \\\"$1\\\" && git push\"" -'
echo "✅ Git hooks and alias installed!"
echo " - Pre-push hook: Checks for uncommitted submodule changes"
echo " - Alias: 'git sc-commit' to commit and push all submodules"
+1 -1
View File
@@ -3,7 +3,7 @@ export default defineConfig({
resolve: {
alias: {
"@": "/web/src",
"foliate-js": "/web/vendor/foliate-js",
"foliate-js": "/node_modules/@bookhoard/foliate-js", // Updated path
},
},
base: "/static/",
Submodule web/vendor/foliate-js deleted from 9a9dccebb1