bunki 0.17.0 → 0.18.0

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,134 @@ 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
+ - Full build: 3,128ms
810
+ - Incremental build (no changes): 985ms (**3.2x faster**)
811
+
812
+ **Speedup breakdown:**
813
+ - Markdown parsing: 1,202ms → 55ms (**22x faster**)
814
+ - CSS processing: 1,024ms → 1ms (**1024x faster**)
815
+ - Overall: **68% faster builds**
816
+
817
+ ### Usage
818
+
819
+ ```bash
820
+ # Enable incremental builds
821
+ bunki generate --incremental
822
+
823
+ # First run (creates cache)
824
+ # Config changed, full rebuild required
825
+ # Total: 3,128ms (same as normal build)
826
+
827
+ # Subsequent runs (no changes)
828
+ # No content changes detected, using cached posts
829
+ # ✨ Loaded 455 posts from cache (0ms parsing)
830
+ # ⏭️ Skipping CSS (unchanged)
831
+ # Total: 985ms (3.2x faster!)
832
+
833
+ # When one file changes
834
+ # 📦 Incremental build: 1/456 files changed (~2730ms saved)
835
+ # Parsed: 1 new/changed, loaded: 455 from cache
836
+ # Total: ~1,000ms
837
+ ```
838
+
839
+ ### How It Works
840
+
841
+ 1. **First build** creates `.bunki-cache.json` with:
842
+ - File hashes and modification times
843
+ - Parsed post data (title, content, metadata)
844
+ - CSS file checksums
845
+ - Config file hash
846
+
847
+ 2. **Subsequent builds** detect changes by comparing:
848
+ - Config file hash (triggers full rebuild if changed)
849
+ - Markdown file hashes/mtimes
850
+ - CSS file hashes
851
+
852
+ 3. **Selective processing**:
853
+ - Only parse changed markdown files
854
+ - Load unchanged posts from cache
855
+ - Skip CSS if unchanged
856
+ - Regenerate all pages (currently not selective)
857
+
858
+ ### Cache Management
859
+
860
+ The cache is stored in `.bunki-cache.json` at your project root:
861
+
862
+ ```bash
863
+ # View cache status
864
+ cat .bunki-cache.json | jq '.version, .configHash'
865
+
866
+ # Clear cache (force full rebuild)
867
+ rm .bunki-cache.json
868
+
869
+ # Exclude from version control
870
+ echo ".bunki-cache.json" >> .gitignore
871
+ ```
872
+
873
+ ### When to Use
874
+
875
+ **Recommended for:**
876
+ - Large sites (100+ posts)
877
+ - Development workflow with frequent rebuilds
878
+ - Sites with slow CSS processing (Tailwind, PostCSS)
879
+
880
+ **Not needed for:**
881
+ - Small sites (<50 posts) - already fast enough
882
+ - CI/CD builds - prefer clean full builds
883
+ - Production deployments - always use full builds
884
+
885
+ ### Cache Format
886
+
887
+ Version 2.0.0 cache structure:
888
+
889
+ ```json
890
+ {
891
+ "version": "2.0.0",
892
+ "configHash": "abc123",
893
+ "files": {
894
+ "/path/to/post.md": {
895
+ "hash": "def456",
896
+ "mtime": 1771720766417,
897
+ "post": {
898
+ "title": "Post Title",
899
+ "date": "2024-01-01",
900
+ "content": "...",
901
+ "html": "..."
902
+ }
903
+ },
904
+ "/path/to/main.css": {
905
+ "hash": "ghi789",
906
+ "mtime": 1771720800000
907
+ }
908
+ }
909
+ }
910
+ ```
911
+
912
+ ### Future Optimizations
913
+
914
+ Current implementation (v0.18.0) optimizes parsing and CSS processing. Future versions may add:
915
+ - Selective page regeneration (only rebuild changed posts)
916
+ - Incremental sitemap/RSS updates
917
+ - Smart index page regeneration
918
+
802
919
  ## CLI Commands
803
920
 
804
921
  ```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
922
+ bunki init [--config FILE] # Initialize new site
923
+ bunki new <TITLE> [--tags TAG1,TAG2] # Create new post
924
+ bunki generate [--config FILE] # Build static site (full)
925
+ bunki generate --incremental # Build with caching (3x faster)
926
+ bunki validate [--config FILE] # Validate frontmatter
927
+ bunki serve [--port 3000] # Start dev server
928
+ bunki css [--watch] # Process CSS
929
+ bunki images:push [--domain DOMAIN] # Upload images to cloud
812
930
  ```
813
931
 
814
932
  ## Output Structure
@@ -895,6 +1013,7 @@ site-generator.ts (orchestrator)
895
1013
  - **Frontmatter Validation**: Automatic validation of business location data with clear error messages
896
1014
  - **Security**: XSS protection, sanitized HTML, link hardening
897
1015
  - **High Performance**:
1016
+ - **Incremental builds** with smart caching (3.2x faster, 68% speedup)
898
1017
  - Parallel page generation (40-60% faster builds)
899
1018
  - Batched post processing (10x faster for 100+ posts)
900
1019
  - Pre-compiled regex patterns (2-3x faster parsing)
@@ -973,7 +1092,24 @@ bunki/
973
1092
 
974
1093
  ## Changelog
975
1094
 
976
- ### v0.17.0 (Current)
1095
+ ### v0.18.0 (Current)
1096
+
1097
+ - **Incremental Builds**: Smart caching for 3.2x faster development builds
1098
+ - File change detection using content hashing and modification times
1099
+ - Selective markdown parsing (only parse changed files)
1100
+ - CSS caching (skip processing if unchanged)
1101
+ - Cache format v2.0.0 stores full parsed post data
1102
+ - Automatic config change detection triggers full rebuilds
1103
+ - `.bunki-cache.json` stores file hashes, mtimes, and parsed posts
1104
+ - **Performance Results** (455 posts):
1105
+ - Full build: 3,128ms
1106
+ - Incremental (no changes): 985ms (68% faster)
1107
+ - Markdown parsing: 1,202ms → 55ms (22x faster)
1108
+ - CSS processing: 1,024ms → 1ms (1024x faster)
1109
+ - **CLI Enhancement**: New `--incremental` flag for `bunki generate`
1110
+ - **Code Cleanup**: Removed unused imports, reverted template extraction
1111
+
1112
+ ### v0.17.0
977
1113
 
978
1114
  - **Major Architecture Refactoring**: Modular design with single responsibility modules
979
1115
  - Split `site-generator.ts` from 957 to 282 lines (-70%)
@@ -12,6 +12,7 @@ export declare function handleGenerateCommand(options: {
12
12
  content: string;
13
13
  output: string;
14
14
  templates: string;
15
+ incremental?: boolean;
15
16
  }, deps?: GenerateDeps): Promise<void>;
16
17
  export declare function registerGenerateCommand(program: Command): Command;
17
18
  export {};