@knowcode/doc-builder 1.5.2 → 1.5.3

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.
@@ -24,7 +24,8 @@
24
24
  "Bash(vercel project:*)",
25
25
  "Bash(vercel alias:*)",
26
26
  "Bash(find:*)",
27
- "Bash(diff:*)"
27
+ "Bash(diff:*)",
28
+ "Bash(git log:*)"
28
29
  ],
29
30
  "deny": []
30
31
  }
package/CHANGELOG.md CHANGED
@@ -5,6 +5,21 @@ All notable changes to @knowcode/doc-builder will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.5.3] - 2025-07-22
9
+
10
+ ### Fixed
11
+ - Fixed mobile menu not being visible when scrolled down by changing sidebar from absolute to fixed positioning
12
+ - Increased sidebar z-index to 1002 to ensure it appears above header and other elements
13
+ - Made floating menu button always visible on mobile (removed scroll-based visibility)
14
+ - Added overlay backdrop when mobile menu is open for better UX
15
+ - Fixed overlay and menu state synchronization across different toggle methods
16
+
17
+ ### Changed
18
+ - Mobile sidebar now uses `position: fixed` instead of `position: absolute`
19
+ - Floating menu button is now always visible on mobile for consistent access
20
+ - Added semi-transparent overlay when mobile menu is open
21
+ - Improved click-outside behavior to properly close menu and overlay
22
+
8
23
  ## [1.5.2] - 2025-07-22
9
24
 
10
25
  ### Added
@@ -954,19 +954,39 @@ tr:hover {
954
954
 
955
955
  /* Hide sidebar on mobile */
956
956
  .sidebar {
957
- position: absolute;
957
+ position: fixed;
958
958
  top: calc(var(--header-height) + var(--breadcrumb-height));
959
959
  left: 0;
960
960
  height: calc(100vh - var(--header-height) - var(--breadcrumb-height));
961
- z-index: 999;
961
+ z-index: 1002; /* Above header and floating button */
962
962
  transform: translateX(-100%);
963
963
  transition: transform var(--duration-normal) var(--easing-out);
964
+ box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15); /* Add shadow for depth */
964
965
  }
965
966
 
966
967
  .sidebar.open {
967
968
  transform: translateX(0);
968
969
  }
969
970
 
971
+ /* Mobile menu overlay */
972
+ .sidebar-overlay {
973
+ display: none;
974
+ position: fixed;
975
+ top: 0;
976
+ left: 0;
977
+ right: 0;
978
+ bottom: 0;
979
+ background: rgba(0, 0, 0, 0.5);
980
+ z-index: 1001; /* Below sidebar but above content */
981
+ opacity: 0;
982
+ transition: opacity var(--duration-normal);
983
+ }
984
+
985
+ .sidebar-overlay.active {
986
+ display: block;
987
+ opacity: 1;
988
+ }
989
+
970
990
  .main-wrapper {
971
991
  margin-left: 0;
972
992
  margin-top: var(--header-height); /* Only account for fixed header on mobile */
package/assets/js/main.js CHANGED
@@ -512,9 +512,28 @@ function updateThemeIcon(theme) {
512
512
  const menuToggle = document.getElementById('menu-toggle');
513
513
  const sidebar = document.querySelector('.sidebar');
514
514
 
515
+ // Create overlay element for mobile
516
+ let overlay = document.querySelector('.sidebar-overlay');
517
+ if (!overlay && window.innerWidth <= 768) {
518
+ overlay = document.createElement('div');
519
+ overlay.className = 'sidebar-overlay';
520
+ document.body.appendChild(overlay);
521
+ }
522
+
515
523
  if (menuToggle) {
516
524
  menuToggle.addEventListener('click', () => {
517
525
  sidebar.classList.toggle('open');
526
+ if (overlay) {
527
+ overlay.classList.toggle('active');
528
+ }
529
+ });
530
+ }
531
+
532
+ // Close menu when clicking overlay
533
+ if (overlay) {
534
+ overlay.addEventListener('click', () => {
535
+ sidebar.classList.remove('open');
536
+ overlay.classList.remove('active');
518
537
  });
519
538
  }
520
539
 
@@ -532,7 +551,8 @@ function initFloatingMenuButton() {
532
551
  floatingButton.className = 'floating-menu-toggle';
533
552
  floatingButton.setAttribute('aria-label', 'Toggle menu');
534
553
  floatingButton.innerHTML = '<i class="fas fa-bars"></i>';
535
- floatingButton.style.display = 'none'; // Hidden by default
554
+ floatingButton.style.display = 'flex'; // Always visible on mobile
555
+ floatingButton.classList.add('visible'); // Start visible
536
556
 
537
557
  // Add to body
538
558
  document.body.appendChild(floatingButton);
@@ -540,6 +560,26 @@ function initFloatingMenuButton() {
540
560
  // Toggle sidebar on click
541
561
  floatingButton.addEventListener('click', () => {
542
562
  sidebar.classList.toggle('open');
563
+
564
+ // Handle overlay
565
+ let overlay = document.querySelector('.sidebar-overlay');
566
+ if (!overlay) {
567
+ overlay = document.createElement('div');
568
+ overlay.className = 'sidebar-overlay';
569
+ document.body.appendChild(overlay);
570
+
571
+ // Add overlay click handler
572
+ overlay.addEventListener('click', () => {
573
+ sidebar.classList.remove('open');
574
+ overlay.classList.remove('active');
575
+ floatingButton.querySelector('i').className = 'fas fa-bars';
576
+ });
577
+ }
578
+
579
+ if (overlay) {
580
+ overlay.classList.toggle('active');
581
+ }
582
+
543
583
  // Update icon based on state
544
584
  const icon = floatingButton.querySelector('i');
545
585
  if (sidebar.classList.contains('open')) {
@@ -549,33 +589,7 @@ function initFloatingMenuButton() {
549
589
  }
550
590
  });
551
591
 
552
- // Show/hide based on scroll position
553
- let scrollTimeout;
554
-
555
- window.addEventListener('scroll', () => {
556
- clearTimeout(scrollTimeout);
557
- scrollTimeout = setTimeout(() => {
558
- const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
559
- const headerHeight = document.querySelector('.header')?.offsetHeight || 64;
560
-
561
- // Show floating button when scrolled past header
562
- if (scrollTop > headerHeight + 50) {
563
- floatingButton.style.display = 'flex';
564
- // Add slight delay for smooth appearance
565
- setTimeout(() => {
566
- floatingButton.classList.add('visible');
567
- }, 10);
568
- } else {
569
- floatingButton.classList.remove('visible');
570
- // Hide after transition completes
571
- setTimeout(() => {
572
- if (!floatingButton.classList.contains('visible')) {
573
- floatingButton.style.display = 'none';
574
- }
575
- }, 300);
576
- }
577
- }, 100);
578
- });
592
+ // Remove scroll-based visibility - button is always visible on mobile
579
593
 
580
594
  // Update icon when sidebar state changes from other sources
581
595
  const observer = new MutationObserver(() => {
@@ -611,11 +625,21 @@ document.addEventListener('click', (e) => {
611
625
  if (window.innerWidth <= 768) {
612
626
  const isClickInsideSidebar = sidebar && sidebar.contains(e.target);
613
627
  const isMenuToggle = e.target.closest('#menu-toggle');
628
+ const isFloatingButton = e.target.closest('#floating-menu-toggle');
614
629
  const isNavItem = e.target.closest('.nav-item, .nav-title');
630
+ const overlay = document.querySelector('.sidebar-overlay');
615
631
 
616
632
  // Close sidebar only if clicking outside AND not on menu toggle AND not on nav items
617
- if (!isClickInsideSidebar && !isMenuToggle && !isNavItem && sidebar?.classList.contains('open')) {
633
+ if (!isClickInsideSidebar && !isMenuToggle && !isFloatingButton && !isNavItem && sidebar?.classList.contains('open')) {
618
634
  sidebar.classList.remove('open');
635
+ if (overlay) {
636
+ overlay.classList.remove('active');
637
+ }
638
+ // Update floating button icon if it exists
639
+ const floatingBtn = document.getElementById('floating-menu-toggle');
640
+ if (floatingBtn) {
641
+ floatingBtn.querySelector('i').className = 'fas fa-bars';
642
+ }
619
643
  }
620
644
  }
621
645
  });
package/html/README.html CHANGED
@@ -58,8 +58,8 @@
58
58
  "name": "Knowcode Ltd",
59
59
  "url": "https://knowcode.tech"
60
60
  },
61
- "datePublished": "2025-07-22T05:55:46.703Z",
62
- "dateModified": "2025-07-22T05:55:46.703Z",
61
+ "datePublished": "2025-07-22T06:01:14.255Z",
62
+ "dateModified": "2025-07-22T06:01:14.255Z",
63
63
  "mainEntityOfPage": {
64
64
  "@type": "WebPage",
65
65
  "@id": "https://doc-builder-delta.vercel.app/README.html"
@@ -92,7 +92,7 @@
92
92
 
93
93
  <div class="header-actions">
94
94
  <div class="deployment-info">
95
- <span class="deployment-date" title="Built with doc-builder v1.5.1">Last updated: Jul 22, 2025, 05:55 AM UTC</span>
95
+ <span class="deployment-date" title="Built with doc-builder v1.5.2">Last updated: Jul 22, 2025, 06:01 AM UTC</span>
96
96
  </div>
97
97
 
98
98
 
@@ -58,8 +58,8 @@
58
58
  "name": "Knowcode Ltd",
59
59
  "url": "https://knowcode.tech"
60
60
  },
61
- "datePublished": "2025-07-22T05:55:46.714Z",
62
- "dateModified": "2025-07-22T05:55:46.714Z",
61
+ "datePublished": "2025-07-22T06:01:14.265Z",
62
+ "dateModified": "2025-07-22T06:01:14.265Z",
63
63
  "mainEntityOfPage": {
64
64
  "@type": "WebPage",
65
65
  "@id": "https://doc-builder-delta.vercel.app/documentation-index.html"
@@ -92,7 +92,7 @@
92
92
 
93
93
  <div class="header-actions">
94
94
  <div class="deployment-info">
95
- <span class="deployment-date" title="Built with doc-builder v1.5.1">Last updated: Jul 22, 2025, 05:55 AM UTC</span>
95
+ <span class="deployment-date" title="Built with doc-builder v1.5.2">Last updated: Jul 22, 2025, 06:01 AM UTC</span>
96
96
  </div>
97
97
 
98
98
 
@@ -58,8 +58,8 @@
58
58
  "name": "Knowcode Ltd",
59
59
  "url": "https://knowcode.tech"
60
60
  },
61
- "datePublished": "2025-07-22T05:55:46.716Z",
62
- "dateModified": "2025-07-22T05:55:46.716Z",
61
+ "datePublished": "2025-07-22T06:01:14.269Z",
62
+ "dateModified": "2025-07-22T06:01:14.269Z",
63
63
  "mainEntityOfPage": {
64
64
  "@type": "WebPage",
65
65
  "@id": "https://doc-builder-delta.vercel.app/guides/authentication-guide.html"
@@ -98,7 +98,7 @@
98
98
 
99
99
  <div class="header-actions">
100
100
  <div class="deployment-info">
101
- <span class="deployment-date" title="Built with doc-builder v1.5.1">Last updated: Jul 22, 2025, 05:55 AM UTC</span>
101
+ <span class="deployment-date" title="Built with doc-builder v1.5.2">Last updated: Jul 22, 2025, 06:01 AM UTC</span>
102
102
  </div>
103
103
 
104
104
 
@@ -58,8 +58,8 @@
58
58
  "name": "Knowcode Ltd",
59
59
  "url": "https://knowcode.tech"
60
60
  },
61
- "datePublished": "2025-07-22T05:55:46.719Z",
62
- "dateModified": "2025-07-22T05:55:46.719Z",
61
+ "datePublished": "2025-07-22T06:01:14.275Z",
62
+ "dateModified": "2025-07-22T06:01:14.275Z",
63
63
  "mainEntityOfPage": {
64
64
  "@type": "WebPage",
65
65
  "@id": "https://doc-builder-delta.vercel.app/guides/claude-workflow-guide.html"
@@ -98,7 +98,7 @@
98
98
 
99
99
  <div class="header-actions">
100
100
  <div class="deployment-info">
101
- <span class="deployment-date" title="Built with doc-builder v1.5.1">Last updated: Jul 22, 2025, 05:55 AM UTC</span>
101
+ <span class="deployment-date" title="Built with doc-builder v1.5.2">Last updated: Jul 22, 2025, 06:01 AM UTC</span>
102
102
  </div>
103
103
 
104
104
 
@@ -58,8 +58,8 @@
58
58
  "name": "Knowcode Ltd",
59
59
  "url": "https://knowcode.tech"
60
60
  },
61
- "datePublished": "2025-07-22T05:55:46.722Z",
62
- "dateModified": "2025-07-22T05:55:46.722Z",
61
+ "datePublished": "2025-07-22T06:01:14.283Z",
62
+ "dateModified": "2025-07-22T06:01:14.283Z",
63
63
  "mainEntityOfPage": {
64
64
  "@type": "WebPage",
65
65
  "@id": "https://doc-builder-delta.vercel.app/guides/documentation-standards.html"
@@ -98,7 +98,7 @@
98
98
 
99
99
  <div class="header-actions">
100
100
  <div class="deployment-info">
101
- <span class="deployment-date" title="Built with doc-builder v1.5.1">Last updated: Jul 22, 2025, 05:55 AM UTC</span>
101
+ <span class="deployment-date" title="Built with doc-builder v1.5.2">Last updated: Jul 22, 2025, 06:01 AM UTC</span>
102
102
  </div>
103
103
 
104
104
 
@@ -58,8 +58,8 @@
58
58
  "name": "Knowcode Ltd",
59
59
  "url": "https://knowcode.tech"
60
60
  },
61
- "datePublished": "2025-07-22T05:55:46.726Z",
62
- "dateModified": "2025-07-22T05:55:46.726Z",
61
+ "datePublished": "2025-07-22T06:01:14.288Z",
62
+ "dateModified": "2025-07-22T06:01:14.288Z",
63
63
  "mainEntityOfPage": {
64
64
  "@type": "WebPage",
65
65
  "@id": "https://doc-builder-delta.vercel.app/guides/seo-guide.html"
@@ -98,7 +98,7 @@
98
98
 
99
99
  <div class="header-actions">
100
100
  <div class="deployment-info">
101
- <span class="deployment-date" title="Built with doc-builder v1.5.1">Last updated: Jul 22, 2025, 05:55 AM UTC</span>
101
+ <span class="deployment-date" title="Built with doc-builder v1.5.2">Last updated: Jul 22, 2025, 06:01 AM UTC</span>
102
102
  </div>
103
103
 
104
104
 
@@ -58,8 +58,8 @@
58
58
  "name": "Knowcode Ltd",
59
59
  "url": "https://knowcode.tech"
60
60
  },
61
- "datePublished": "2025-07-22T05:55:46.728Z",
62
- "dateModified": "2025-07-22T05:55:46.728Z",
61
+ "datePublished": "2025-07-22T06:01:14.294Z",
62
+ "dateModified": "2025-07-22T06:01:14.294Z",
63
63
  "mainEntityOfPage": {
64
64
  "@type": "WebPage",
65
65
  "@id": "https://doc-builder-delta.vercel.app/guides/troubleshooting-guide.html"
@@ -98,7 +98,7 @@
98
98
 
99
99
  <div class="header-actions">
100
100
  <div class="deployment-info">
101
- <span class="deployment-date" title="Built with doc-builder v1.5.1">Last updated: Jul 22, 2025, 05:55 AM UTC</span>
101
+ <span class="deployment-date" title="Built with doc-builder v1.5.2">Last updated: Jul 22, 2025, 06:01 AM UTC</span>
102
102
  </div>
103
103
 
104
104
 
package/html/index.html CHANGED
@@ -58,8 +58,8 @@
58
58
  "name": "Knowcode Ltd",
59
59
  "url": "https://knowcode.tech"
60
60
  },
61
- "datePublished": "2025-07-22T05:55:46.703Z",
62
- "dateModified": "2025-07-22T05:55:46.703Z",
61
+ "datePublished": "2025-07-22T06:01:14.255Z",
62
+ "dateModified": "2025-07-22T06:01:14.255Z",
63
63
  "mainEntityOfPage": {
64
64
  "@type": "WebPage",
65
65
  "@id": "https://doc-builder-delta.vercel.app/README.html"
@@ -92,7 +92,7 @@
92
92
 
93
93
  <div class="header-actions">
94
94
  <div class="deployment-info">
95
- <span class="deployment-date" title="Built with doc-builder v1.5.1">Last updated: Jul 22, 2025, 05:55 AM UTC</span>
95
+ <span class="deployment-date" title="Built with doc-builder v1.5.2">Last updated: Jul 22, 2025, 06:01 AM UTC</span>
96
96
  </div>
97
97
 
98
98
 
package/html/sitemap.xml CHANGED
@@ -2,79 +2,79 @@
2
2
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
3
3
  <url>
4
4
  <loc>https://doc-builder-delta.vercel.app/404.html</loc>
5
- <lastmod>2025-07-22T05:55:46.744Z</lastmod>
5
+ <lastmod>2025-07-22T06:01:14.316Z</lastmod>
6
6
  <changefreq>monthly</changefreq>
7
7
  <priority>0.6</priority>
8
8
  </url>
9
9
  <url>
10
10
  <loc>https://doc-builder-delta.vercel.app/README.html</loc>
11
- <lastmod>2025-07-22T05:55:46.744Z</lastmod>
11
+ <lastmod>2025-07-22T06:01:14.316Z</lastmod>
12
12
  <changefreq>monthly</changefreq>
13
13
  <priority>0.6</priority>
14
14
  </url>
15
15
  <url>
16
16
  <loc>https://doc-builder-delta.vercel.app/claude-workflow-guide.html</loc>
17
- <lastmod>2025-07-22T05:55:46.744Z</lastmod>
17
+ <lastmod>2025-07-22T06:01:14.316Z</lastmod>
18
18
  <changefreq>monthly</changefreq>
19
19
  <priority>0.8</priority>
20
20
  </url>
21
21
  <url>
22
22
  <loc>https://doc-builder-delta.vercel.app/documentation-index.html</loc>
23
- <lastmod>2025-07-22T05:55:46.744Z</lastmod>
23
+ <lastmod>2025-07-22T06:01:14.316Z</lastmod>
24
24
  <changefreq>monthly</changefreq>
25
25
  <priority>0.6</priority>
26
26
  </url>
27
27
  <url>
28
28
  <loc>https://doc-builder-delta.vercel.app/guides/authentication-guide.html</loc>
29
- <lastmod>2025-07-22T05:55:46.744Z</lastmod>
29
+ <lastmod>2025-07-22T06:01:14.316Z</lastmod>
30
30
  <changefreq>monthly</changefreq>
31
31
  <priority>0.8</priority>
32
32
  </url>
33
33
  <url>
34
34
  <loc>https://doc-builder-delta.vercel.app/guides/claude-workflow-guide.html</loc>
35
- <lastmod>2025-07-22T05:55:46.744Z</lastmod>
35
+ <lastmod>2025-07-22T06:01:14.316Z</lastmod>
36
36
  <changefreq>monthly</changefreq>
37
37
  <priority>0.8</priority>
38
38
  </url>
39
39
  <url>
40
40
  <loc>https://doc-builder-delta.vercel.app/guides/document-standards.html</loc>
41
- <lastmod>2025-07-22T05:55:46.744Z</lastmod>
41
+ <lastmod>2025-07-22T06:01:14.316Z</lastmod>
42
42
  <changefreq>monthly</changefreq>
43
43
  <priority>0.8</priority>
44
44
  </url>
45
45
  <url>
46
46
  <loc>https://doc-builder-delta.vercel.app/guides/documentation-standards.html</loc>
47
- <lastmod>2025-07-22T05:55:46.744Z</lastmod>
47
+ <lastmod>2025-07-22T06:01:14.316Z</lastmod>
48
48
  <changefreq>monthly</changefreq>
49
49
  <priority>0.8</priority>
50
50
  </url>
51
51
  <url>
52
52
  <loc>https://doc-builder-delta.vercel.app/guides/seo-guide.html</loc>
53
- <lastmod>2025-07-22T05:55:46.744Z</lastmod>
53
+ <lastmod>2025-07-22T06:01:14.316Z</lastmod>
54
54
  <changefreq>monthly</changefreq>
55
55
  <priority>0.8</priority>
56
56
  </url>
57
57
  <url>
58
58
  <loc>https://doc-builder-delta.vercel.app/guides/troubleshooting-guide.html</loc>
59
- <lastmod>2025-07-22T05:55:46.744Z</lastmod>
59
+ <lastmod>2025-07-22T06:01:14.316Z</lastmod>
60
60
  <changefreq>monthly</changefreq>
61
61
  <priority>0.8</priority>
62
62
  </url>
63
63
  <url>
64
64
  <loc>https://doc-builder-delta.vercel.app/index.html</loc>
65
- <lastmod>2025-07-22T05:55:46.744Z</lastmod>
65
+ <lastmod>2025-07-22T06:01:14.316Z</lastmod>
66
66
  <changefreq>weekly</changefreq>
67
67
  <priority>1.0</priority>
68
68
  </url>
69
69
  <url>
70
70
  <loc>https://doc-builder-delta.vercel.app/vercel-cli-setup-guide.html</loc>
71
- <lastmod>2025-07-22T05:55:46.744Z</lastmod>
71
+ <lastmod>2025-07-22T06:01:14.316Z</lastmod>
72
72
  <changefreq>monthly</changefreq>
73
73
  <priority>0.8</priority>
74
74
  </url>
75
75
  <url>
76
76
  <loc>https://doc-builder-delta.vercel.app/vercel-first-time-setup-guide.html</loc>
77
- <lastmod>2025-07-22T05:55:46.744Z</lastmod>
77
+ <lastmod>2025-07-22T06:01:14.316Z</lastmod>
78
78
  <changefreq>monthly</changefreq>
79
79
  <priority>0.8</priority>
80
80
  </url>
@@ -58,8 +58,8 @@
58
58
  "name": "Knowcode Ltd",
59
59
  "url": "https://knowcode.tech"
60
60
  },
61
- "datePublished": "2025-07-22T05:55:46.731Z",
62
- "dateModified": "2025-07-22T05:55:46.731Z",
61
+ "datePublished": "2025-07-22T06:01:14.298Z",
62
+ "dateModified": "2025-07-22T06:01:14.298Z",
63
63
  "mainEntityOfPage": {
64
64
  "@type": "WebPage",
65
65
  "@id": "https://doc-builder-delta.vercel.app/vercel-cli-setup-guide.html"
@@ -92,7 +92,7 @@
92
92
 
93
93
  <div class="header-actions">
94
94
  <div class="deployment-info">
95
- <span class="deployment-date" title="Built with doc-builder v1.5.1">Last updated: Jul 22, 2025, 05:55 AM UTC</span>
95
+ <span class="deployment-date" title="Built with doc-builder v1.5.2">Last updated: Jul 22, 2025, 06:01 AM UTC</span>
96
96
  </div>
97
97
 
98
98
 
@@ -58,8 +58,8 @@
58
58
  "name": "Knowcode Ltd",
59
59
  "url": "https://knowcode.tech"
60
60
  },
61
- "datePublished": "2025-07-22T05:55:46.734Z",
62
- "dateModified": "2025-07-22T05:55:46.734Z",
61
+ "datePublished": "2025-07-22T06:01:14.306Z",
62
+ "dateModified": "2025-07-22T06:01:14.306Z",
63
63
  "mainEntityOfPage": {
64
64
  "@type": "WebPage",
65
65
  "@id": "https://doc-builder-delta.vercel.app/vercel-first-time-setup-guide.html"
@@ -92,7 +92,7 @@
92
92
 
93
93
  <div class="header-actions">
94
94
  <div class="deployment-info">
95
- <span class="deployment-date" title="Built with doc-builder v1.5.1">Last updated: Jul 22, 2025, 05:55 AM UTC</span>
95
+ <span class="deployment-date" title="Built with doc-builder v1.5.2">Last updated: Jul 22, 2025, 06:01 AM UTC</span>
96
96
  </div>
97
97
 
98
98
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knowcode/doc-builder",
3
- "version": "1.5.2",
3
+ "version": "1.5.3",
4
4
  "description": "Reusable documentation builder for markdown-based sites with Vercel deployment support",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -8,7 +8,9 @@
8
8
  },
9
9
  "scripts": {
10
10
  "postinstall": "node scripts/setup.js || true",
11
- "test": "echo \"Error: no test specified\" && exit 1"
11
+ "test": "echo \"Error: no test specified\" && exit 1",
12
+ "publish:npm": "./publish.sh",
13
+ "release": "./publish.sh"
12
14
  },
13
15
  "keywords": [
14
16
  "documentation",
package/publish.sh ADDED
@@ -0,0 +1,198 @@
1
+ #!/bin/bash
2
+
3
+ # Colors for output
4
+ RED='\033[0;31m'
5
+ GREEN='\033[0;32m'
6
+ YELLOW='\033[0;33m'
7
+ BLUE='\033[0;34m'
8
+ CYAN='\033[0;36m'
9
+ NC='\033[0m' # No Color
10
+
11
+ # Icons
12
+ CHECK="✓"
13
+ CROSS="✗"
14
+ ARROW="→"
15
+ INFO="ℹ"
16
+ WARN="⚠"
17
+
18
+ # Function to print colored output
19
+ print_info() {
20
+ echo -e "${BLUE}${INFO}${NC} $1"
21
+ }
22
+
23
+ print_success() {
24
+ echo -e "${GREEN}${CHECK}${NC} $1"
25
+ }
26
+
27
+ print_error() {
28
+ echo -e "${RED}${CROSS}${NC} $1"
29
+ }
30
+
31
+ print_warning() {
32
+ echo -e "${YELLOW}${WARN}${NC} $1"
33
+ }
34
+
35
+ print_step() {
36
+ echo -e "${CYAN}${ARROW}${NC} $1"
37
+ }
38
+
39
+ # Header
40
+ echo ""
41
+ echo -e "${BLUE}┌─────────────────────────────────────────┐${NC}"
42
+ echo -e "${BLUE}│ 📦 NPM Publishing Script │${NC}"
43
+ echo -e "${BLUE}│ @knowcode/doc-builder │${NC}"
44
+ echo -e "${BLUE}└─────────────────────────────────────────┘${NC}"
45
+ echo ""
46
+
47
+ # Check if we're in the right directory
48
+ if [ ! -f "package.json" ]; then
49
+ print_error "package.json not found! Are you in the project root?"
50
+ exit 1
51
+ fi
52
+
53
+ # Get package info
54
+ PACKAGE_NAME=$(node -p "require('./package.json').name")
55
+ CURRENT_VERSION=$(node -p "require('./package.json').version")
56
+
57
+ print_info "Package: ${PACKAGE_NAME}"
58
+ print_info "Current version: ${CURRENT_VERSION}"
59
+ echo ""
60
+
61
+ # Check if user is logged into npm
62
+ print_step "Checking npm login status..."
63
+ if ! npm whoami &> /dev/null; then
64
+ print_error "You are not logged into npm!"
65
+ print_info "Please run: npm login"
66
+ exit 1
67
+ else
68
+ NPM_USER=$(npm whoami)
69
+ print_success "Logged in as: ${NPM_USER}"
70
+ fi
71
+ echo ""
72
+
73
+ # Check for uncommitted changes
74
+ print_step "Checking for uncommitted changes..."
75
+ if ! git diff-index --quiet HEAD --; then
76
+ print_warning "You have uncommitted changes!"
77
+ echo ""
78
+ git status --short
79
+ echo ""
80
+ read -p "Do you want to continue anyway? (y/N) " -n 1 -r
81
+ echo ""
82
+ if [[ ! $REPLY =~ ^[Yy]$ ]]; then
83
+ print_info "Publishing cancelled."
84
+ exit 1
85
+ fi
86
+ else
87
+ print_success "Working directory is clean"
88
+ fi
89
+ echo ""
90
+
91
+ # Check if version exists on npm
92
+ print_step "Checking if version ${CURRENT_VERSION} is already published..."
93
+ if npm view "${PACKAGE_NAME}@${CURRENT_VERSION}" version &> /dev/null; then
94
+ print_error "Version ${CURRENT_VERSION} is already published!"
95
+ print_info "Please update the version in package.json first."
96
+ echo ""
97
+
98
+ # Show last few published versions
99
+ print_info "Recent versions:"
100
+ npm view "${PACKAGE_NAME}" versions --json | tail -5 | sed 's/,$//' | sed 's/^/ /'
101
+ echo ""
102
+
103
+ # Suggest next version
104
+ LATEST_VERSION=$(npm view "${PACKAGE_NAME}" version)
105
+ print_info "Latest published version: ${LATEST_VERSION}"
106
+ print_info "Suggested next versions:"
107
+ echo " - Patch: $(npx semver ${LATEST_VERSION} -i patch)"
108
+ echo " - Minor: $(npx semver ${LATEST_VERSION} -i minor)"
109
+ echo " - Major: $(npx semver ${LATEST_VERSION} -i major)"
110
+ exit 1
111
+ else
112
+ print_success "Version ${CURRENT_VERSION} is not yet published"
113
+ fi
114
+ echo ""
115
+
116
+ # Build the project
117
+ print_step "Building documentation..."
118
+ if node cli.js build > /dev/null 2>&1; then
119
+ print_success "Build completed successfully"
120
+ else
121
+ print_error "Build failed!"
122
+ print_info "Run 'node cli.js build' to see the error"
123
+ exit 1
124
+ fi
125
+ echo ""
126
+
127
+ # Run npm pack to preview
128
+ print_step "Creating package preview..."
129
+ PACK_FILE=$(npm pack --dry-run 2>&1 | grep -E "^[a-zA-Z0-9@/._-]+\.tgz$" | tail -1)
130
+ print_success "Package will be created as: ${PACK_FILE}"
131
+
132
+ # Show what will be published
133
+ print_info "Files to be included:"
134
+ npm pack --dry-run 2>&1 | grep -E "^npm notice.*[0-9]+B" | head -10 | sed 's/npm notice/ /'
135
+ TOTAL_FILES=$(npm pack --dry-run 2>&1 | grep -E "^npm notice total files:" | sed 's/npm notice total files://')
136
+ print_info "Total files:${TOTAL_FILES}"
137
+ echo ""
138
+
139
+ # Final confirmation
140
+ echo -e "${YELLOW}┌─────────────────────────────────────────┐${NC}"
141
+ echo -e "${YELLOW}│ READY TO PUBLISH │${NC}"
142
+ echo -e "${YELLOW}├─────────────────────────────────────────┤${NC}"
143
+ echo -e "${YELLOW}│${NC} Package: ${PACKAGE_NAME}"
144
+ echo -e "${YELLOW}│${NC} Version: ${CURRENT_VERSION}"
145
+ echo -e "${YELLOW}│${NC} User: ${NPM_USER}"
146
+ echo -e "${YELLOW}│${NC} Registry: https://registry.npmjs.org/"
147
+ echo -e "${YELLOW}└─────────────────────────────────────────┘${NC}"
148
+ echo ""
149
+
150
+ read -p "Do you want to publish to npm? (y/N) " -n 1 -r
151
+ echo ""
152
+ echo ""
153
+
154
+ if [[ ! $REPLY =~ ^[Yy]$ ]]; then
155
+ print_warning "Publishing cancelled by user"
156
+ exit 0
157
+ fi
158
+
159
+ # Publish to npm
160
+ print_step "Publishing to npm..."
161
+ echo ""
162
+
163
+ if npm publish; then
164
+ echo ""
165
+ print_success "Successfully published ${PACKAGE_NAME}@${CURRENT_VERSION}!"
166
+ echo ""
167
+
168
+ # Show post-publish info
169
+ echo -e "${GREEN}┌─────────────────────────────────────────┐${NC}"
170
+ echo -e "${GREEN}│ 🎉 PUBLISHED SUCCESSFULLY! │${NC}"
171
+ echo -e "${GREEN}└─────────────────────────────────────────┘${NC}"
172
+ echo ""
173
+
174
+ print_info "View on npm:"
175
+ echo " https://www.npmjs.com/package/${PACKAGE_NAME}"
176
+ echo ""
177
+
178
+ print_info "Install command:"
179
+ echo " npm install ${PACKAGE_NAME}@${CURRENT_VERSION}"
180
+ echo ""
181
+
182
+ print_info "Or use with npx:"
183
+ echo " npx ${PACKAGE_NAME}@latest"
184
+ echo ""
185
+
186
+ # Suggest next steps
187
+ print_info "Next steps:"
188
+ echo " 1. Create a git tag: git tag v${CURRENT_VERSION}"
189
+ echo " 2. Push the tag: git push origin v${CURRENT_VERSION}"
190
+ echo " 3. Create a GitHub release"
191
+ echo " 4. Update CHANGELOG.md for the next version"
192
+ echo ""
193
+ else
194
+ echo ""
195
+ print_error "Publishing failed!"
196
+ print_info "Check the error message above for details"
197
+ exit 1
198
+ fi