bunki 0.17.1 → 0.18.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -799,16 +799,139 @@ export S3_PUBLIC_URL="https://img.example.com"
799
799
  - WebP for photos
800
800
  - SVG for icons/graphics
801
801
 
802
+ ## Incremental Builds
803
+
804
+ Bunki supports incremental builds for significantly faster rebuild times during development. When enabled, only changed content is reprocessed while unchanged files are loaded from cache.
805
+
806
+ ### Performance Impact
807
+
808
+ **Large site example (455 posts):**
809
+
810
+ - Full build: 3,128ms
811
+ - Incremental build (no changes): 985ms (**3.2x faster**)
812
+
813
+ **Speedup breakdown:**
814
+
815
+ - Markdown parsing: 1,202ms → 55ms (**22x faster**)
816
+ - CSS processing: 1,024ms → 1ms (**1024x faster**)
817
+ - Overall: **68% faster builds**
818
+
819
+ ### Usage
820
+
821
+ ```bash
822
+ # Enable incremental builds
823
+ bunki generate --incremental
824
+
825
+ # First run (creates cache)
826
+ # Config changed, full rebuild required
827
+ # Total: 3,128ms (same as normal build)
828
+
829
+ # Subsequent runs (no changes)
830
+ # No content changes detected, using cached posts
831
+ # ✨ Loaded 455 posts from cache (0ms parsing)
832
+ # ⏭️ Skipping CSS (unchanged)
833
+ # Total: 985ms (3.2x faster!)
834
+
835
+ # When one file changes
836
+ # 📦 Incremental build: 1/456 files changed (~2730ms saved)
837
+ # Parsed: 1 new/changed, loaded: 455 from cache
838
+ # Total: ~1,000ms
839
+ ```
840
+
841
+ ### How It Works
842
+
843
+ 1. **First build** creates `.bunki-cache.json` with:
844
+ - File hashes and modification times
845
+ - Parsed post data (title, content, metadata)
846
+ - CSS file checksums
847
+ - Config file hash
848
+
849
+ 2. **Subsequent builds** detect changes by comparing:
850
+ - Config file hash (triggers full rebuild if changed)
851
+ - Markdown file hashes/mtimes
852
+ - CSS file hashes
853
+
854
+ 3. **Selective processing**:
855
+ - Only parse changed markdown files
856
+ - Load unchanged posts from cache
857
+ - Skip CSS if unchanged
858
+ - Regenerate all pages (currently not selective)
859
+
860
+ ### Cache Management
861
+
862
+ The cache is stored in `.bunki-cache.json` at your project root:
863
+
864
+ ```bash
865
+ # View cache status
866
+ cat .bunki-cache.json | jq '.version, .configHash'
867
+
868
+ # Clear cache (force full rebuild)
869
+ rm .bunki-cache.json
870
+
871
+ # Exclude from version control
872
+ echo ".bunki-cache.json" >> .gitignore
873
+ ```
874
+
875
+ ### When to Use
876
+
877
+ **Recommended for:**
878
+
879
+ - Large sites (100+ posts)
880
+ - Development workflow with frequent rebuilds
881
+ - Sites with slow CSS processing (Tailwind, PostCSS)
882
+
883
+ **Not needed for:**
884
+
885
+ - Small sites (<50 posts) - already fast enough
886
+ - CI/CD builds - prefer clean full builds
887
+ - Production deployments - always use full builds
888
+
889
+ ### Cache Format
890
+
891
+ Version 2.0.0 cache structure:
892
+
893
+ ```json
894
+ {
895
+ "version": "2.0.0",
896
+ "configHash": "abc123",
897
+ "files": {
898
+ "/path/to/post.md": {
899
+ "hash": "def456",
900
+ "mtime": 1771720766417,
901
+ "post": {
902
+ "title": "Post Title",
903
+ "date": "2024-01-01",
904
+ "content": "...",
905
+ "html": "..."
906
+ }
907
+ },
908
+ "/path/to/main.css": {
909
+ "hash": "ghi789",
910
+ "mtime": 1771720800000
911
+ }
912
+ }
913
+ }
914
+ ```
915
+
916
+ ### Future Optimizations
917
+
918
+ Current implementation (v0.18.0) optimizes parsing and CSS processing. Future versions may add:
919
+
920
+ - Selective page regeneration (only rebuild changed posts)
921
+ - Incremental sitemap/RSS updates
922
+ - Smart index page regeneration
923
+
802
924
  ## CLI Commands
803
925
 
804
926
  ```bash
805
- bunki init [--config FILE] # Initialize new site
806
- bunki new <TITLE> [--tags TAG1,TAG2] # Create new post
807
- bunki generate [--config FILE] # Build static site
808
- bunki validate [--config FILE] # Validate frontmatter
809
- bunki serve [--port 3000] # Start dev server
810
- bunki css [--watch] # Process CSS
811
- bunki images:push [--domain DOMAIN] # Upload images to cloud
927
+ bunki init [--config FILE] # Initialize new site
928
+ bunki new <TITLE> [--tags TAG1,TAG2] # Create new post
929
+ bunki generate [--config FILE] # Build static site (full)
930
+ bunki generate --incremental # Build with caching (3x faster)
931
+ bunki validate [--config FILE] # Validate frontmatter
932
+ bunki serve [--port 3000] # Start dev server
933
+ bunki css [--watch] # Process CSS
934
+ bunki images:push [--domain DOMAIN] # Upload images to cloud
812
935
  ```
813
936
 
814
937
  ## Output Structure
@@ -895,6 +1018,7 @@ site-generator.ts (orchestrator)
895
1018
  - **Frontmatter Validation**: Automatic validation of business location data with clear error messages
896
1019
  - **Security**: XSS protection, sanitized HTML, link hardening
897
1020
  - **High Performance**:
1021
+ - **Incremental builds** with smart caching (3.2x faster, 68% speedup)
898
1022
  - Parallel page generation (40-60% faster builds)
899
1023
  - Batched post processing (10x faster for 100+ posts)
900
1024
  - Pre-compiled regex patterns (2-3x faster parsing)
@@ -973,7 +1097,37 @@ bunki/
973
1097
 
974
1098
  ## Changelog
975
1099
 
976
- ### v0.17.0 (Current)
1100
+ ### v0.18.1 (Current)
1101
+
1102
+ - **Page Generation Optimization**: Cache JSON-LD schemas and metadata during initialization
1103
+ - Eliminates 910 redundant operations per build (455 posts × 2)
1104
+ - `extractFirstImageUrl()` called once during initialization, cached in `post.image`
1105
+ - Word count calculated once, cached in `post.wordCount`
1106
+ - JSON-LD schemas pre-generated and cached in `post.jsonLd`
1107
+ - Removed duplicate schema generation from page and feed generators
1108
+ - **Deployment Optimization**: All deploy commands now use incremental builds by default
1109
+ - `deploy:all` now builds incrementally for faster deployments
1110
+ - Individual site deployments also use incremental builds
1111
+ - Full builds available via `build:full` when needed
1112
+
1113
+ ### v0.18.0
1114
+
1115
+ - **Incremental Builds**: Smart caching for 3.2x faster development builds
1116
+ - File change detection using content hashing and modification times
1117
+ - Selective markdown parsing (only parse changed files)
1118
+ - CSS caching (skip processing if unchanged)
1119
+ - Cache format v2.0.0 stores full parsed post data
1120
+ - Automatic config change detection triggers full rebuilds
1121
+ - `.bunki-cache.json` stores file hashes, mtimes, and parsed posts
1122
+ - **Performance Results** (455 posts):
1123
+ - Full build: 3,128ms
1124
+ - Incremental (no changes): 985ms (68% faster)
1125
+ - Markdown parsing: 1,202ms → 55ms (22x faster)
1126
+ - CSS processing: 1,024ms → 1ms (1024x faster)
1127
+ - **CLI Enhancement**: New `--incremental` flag for `bunki generate`
1128
+ - **Code Cleanup**: Removed unused imports, reverted template extraction
1129
+
1130
+ ### v0.17.0
977
1131
 
978
1132
  - **Major Architecture Refactoring**: Modular design with single responsibility modules
979
1133
  - Split `site-generator.ts` from 957 to 282 lines (-70%)