@knowcode/doc-builder 1.7.6 → 1.8.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/.claude/settings.local.json +6 -1
- package/CHANGELOG.md +29 -0
- package/assets/css/notion-style.css +9 -1
- package/assets/js/main.js +10 -6
- package/html/README.html +44 -20
- package/html/auth.js +62 -13
- package/html/css/notion-style.css +9 -1
- package/html/documentation-index.html +44 -20
- package/html/guides/authentication-default-change.html +44 -20
- package/html/guides/authentication-guide.html +228 -263
- package/html/guides/claude-workflow-guide.html +44 -20
- package/html/guides/documentation-standards.html +44 -20
- package/html/guides/phosphor-icons-guide.html +44 -20
- package/html/guides/private-directory-authentication.html +472 -0
- package/html/guides/public-site-deployment.html +50 -25
- package/html/guides/search-engine-verification-guide.html +44 -20
- package/html/guides/seo-guide.html +44 -20
- package/html/guides/seo-optimization-guide.html +44 -20
- package/html/guides/troubleshooting-guide.html +44 -20
- package/html/guides/windows-setup-guide.html +44 -20
- package/html/index.html +44 -20
- package/html/js/auth.js +118 -39
- package/html/js/main.js +10 -6
- package/html/login.html +4 -4
- package/html/logout.html +2 -2
- package/html/private/cache-control-anti-pattern.html +408 -0
- package/html/private/launch/README.html +350 -0
- package/html/private/launch/auth-cleanup-summary.html +340 -0
- package/html/private/launch/bubble-plugin-specification.html +986 -0
- package/html/private/launch/go-to-market-strategy.html +716 -0
- package/html/private/launch/launch-announcements.html +646 -0
- package/html/private/launch/vercel-deployment-auth-setup.html +390 -0
- package/html/private/next-steps-walkthrough.html +685 -0
- package/html/private/supabase-auth-implementation-completed.html +433 -0
- package/html/private/supabase-auth-implementation-plan.html +590 -0
- package/html/private/supabase-auth-integration-plan.html +718 -0
- package/html/private/supabase-auth-setup-guide.html +545 -0
- package/html/private/test-private-doc.html +281 -0
- package/html/robots.txt +4 -0
- package/html/sitemap.xml +113 -29
- package/html/vercel-cli-setup-guide.html +44 -20
- package/html/vercel-first-time-setup-guide.html +44 -20
- package/lib/config.js +21 -3
- package/lib/core-builder.js +49 -7
- package/lib/supabase-auth.js +80 -25
- package/package.json +1 -1
- package/user-management/README.md +306 -0
- package/user-management/add-users.sh +730 -0
- package/user-management/create-user.js +65 -0
- package/user-management/users.txt +15 -0
|
@@ -46,6 +46,39 @@
|
|
|
46
46
|
<link rel="stylesheet" href="/css/notion-style.css">
|
|
47
47
|
|
|
48
48
|
|
|
49
|
+
<!-- Hide content until auth check -->
|
|
50
|
+
<style>
|
|
51
|
+
body {
|
|
52
|
+
visibility: hidden;
|
|
53
|
+
opacity: 0;
|
|
54
|
+
transition: opacity 0.3s ease;
|
|
55
|
+
}
|
|
56
|
+
body.authenticated {
|
|
57
|
+
visibility: visible;
|
|
58
|
+
opacity: 1;
|
|
59
|
+
}
|
|
60
|
+
/* Show login/logout pages immediately */
|
|
61
|
+
body.auth-page {
|
|
62
|
+
visibility: visible;
|
|
63
|
+
opacity: 1;
|
|
64
|
+
}
|
|
65
|
+
/* Style auth button consistently */
|
|
66
|
+
.auth-btn {
|
|
67
|
+
background: none;
|
|
68
|
+
border: none;
|
|
69
|
+
color: var(--text-secondary);
|
|
70
|
+
cursor: pointer;
|
|
71
|
+
padding: 0.5rem;
|
|
72
|
+
border-radius: 0.5rem;
|
|
73
|
+
transition: all 0.2s;
|
|
74
|
+
font-size: 1.1rem;
|
|
75
|
+
}
|
|
76
|
+
.auth-btn:hover {
|
|
77
|
+
background: var(--bg-secondary);
|
|
78
|
+
color: var(--text-primary);
|
|
79
|
+
}
|
|
80
|
+
</style>
|
|
81
|
+
|
|
49
82
|
|
|
50
83
|
<!-- Favicon -->
|
|
51
84
|
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>✨</text></svg>">
|
|
@@ -65,8 +98,8 @@
|
|
|
65
98
|
"name": "Knowcode Ltd",
|
|
66
99
|
"url": "https://knowcode.tech"
|
|
67
100
|
},
|
|
68
|
-
"datePublished": "2025-07-
|
|
69
|
-
"dateModified": "2025-07-
|
|
101
|
+
"datePublished": "2025-07-26T10:20:52.444Z",
|
|
102
|
+
"dateModified": "2025-07-26T10:20:52.444Z",
|
|
70
103
|
"mainEntityOfPage": {
|
|
71
104
|
"@type": "WebPage",
|
|
72
105
|
"@id": "https://doc-builder-delta.vercel.app/vercel-cli-setup-guide.html"
|
|
@@ -99,10 +132,14 @@
|
|
|
99
132
|
|
|
100
133
|
<div class="header-actions">
|
|
101
134
|
<div class="deployment-info">
|
|
102
|
-
<span class="deployment-date" title="Built with doc-builder v1.
|
|
135
|
+
<span class="deployment-date" title="Built with doc-builder v1.8.0">Last updated: Jul 26, 2025, 10:20 AM UTC</span>
|
|
103
136
|
</div>
|
|
104
137
|
|
|
105
138
|
|
|
139
|
+
<a href="../login.html" class="auth-btn" title="Login/Logout">
|
|
140
|
+
<i class="fas fa-sign-in-alt"></i>
|
|
141
|
+
</a>
|
|
142
|
+
|
|
106
143
|
|
|
107
144
|
<button id="theme-toggle" class="theme-toggle" aria-label="Toggle theme">
|
|
108
145
|
<i class="fas fa-moon"></i>
|
|
@@ -158,31 +195,17 @@
|
|
|
158
195
|
</a>
|
|
159
196
|
<div class="nav-content collapsed" id="nav-guides-1">
|
|
160
197
|
<a href="/guides/authentication-default-change.html" class="nav-item" data-tooltip="Starting from version 1.7.4, @knowcode/doc-builder now defaults to no authentication for all documentation sites."><i class="fas fa-file-alt"></i> Authentication Default Change</a>
|
|
161
|
-
<a href="/guides/authentication-guide.html" class="nav-item" data-tooltip="
|
|
162
|
-
<a href="/guides/cache-control-anti-pattern.html" class="nav-item" data-tooltip="Cache Control Anti-Pattern: Why Aggressive Cache-Busting is Bad for Documentation Sites."><i class="fas fa-file-alt"></i> Cache Control Anti Pattern</a>
|
|
198
|
+
<a href="/guides/authentication-guide.html" class="nav-item" data-tooltip="@knowcode/doc-builder supports enterprise-grade authentication through Supabase - a secure, scalable authentication platform."><i class="fas fa-file-alt"></i> Authentication Guide</a>
|
|
163
199
|
<a href="/guides/claude-workflow-guide.html" class="nav-item" data-tooltip="This guide demonstrates an efficient workflow for using Claude Code with a refined CLAUDE.md file to create high-quality documentation and deploy it..."><i class="fas fa-file-alt"></i> Claude Workflow Guide</a>
|
|
164
200
|
<a href="/guides/documentation-standards.html" class="nav-item" data-tooltip="This document defines the documentation standards and conventions for the @knowcode/doc-builder project."><i class="fas fa-file-alt"></i> Documentation Standards</a>
|
|
165
|
-
<a href="/guides/next-steps-walkthrough.html" class="nav-item" data-tooltip="Now that we've implemented Supabase authentication, let's walk through testing the implementation and preparing for deployment."><i class="fas fa-file-alt"></i> Next Steps Walkthrough</a>
|
|
166
201
|
<a href="/guides/phosphor-icons-guide.html" class="nav-item" data-tooltip="@knowcode/doc-builder automatically converts Unicode emojis in your markdown files to beautiful Phosphor icons in the generated HTML."><i class="fas fa-file-alt"></i> Phosphor Icons Guide</a>
|
|
202
|
+
<a href="/guides/private-directory-authentication.html" class="nav-item" data-tooltip="The @knowcode/doc-builder provides flexible authentication options to protect your documentation."><i class="fas fa-file-alt"></i> Private Directory Authentication</a>
|
|
167
203
|
<a href="/guides/public-site-deployment.html" class="nav-item" data-tooltip="The @knowcode/doc-builder now supports deploying public documentation sites without authentication."><i class="fas fa-file-alt"></i> Public Site Deployment</a>
|
|
168
204
|
<a href="/guides/search-engine-verification-guide.html" class="nav-item" data-tooltip="Search engine verification provides access to powerful webmaster tools:."><i class="fas fa-file-alt"></i> Search Engine Verification Guide</a>
|
|
169
205
|
<a href="/guides/seo-guide.html" class="nav-item" data-tooltip="@knowcode/doc-builder includes comprehensive SEO (Search Engine Optimization) features to help your documentation rank better in search results and..."><i class="fas fa-file-alt"></i> Seo Guide</a>
|
|
170
206
|
<a href="/guides/seo-optimization-guide.html" class="nav-item" data-tooltip="@knowcode/doc-builder includes comprehensive SEO (Search Engine Optimization) features that automatically optimize your documentation for search..."><i class="fas fa-file-alt"></i> Seo Optimization Guide</a>
|
|
171
|
-
<a href="/guides/supabase-auth-implementation-plan.html" class="nav-item" data-tooltip="Supabase Auth Implementation Plan for @knowcode/doc-builder."><i class="fas fa-file-alt"></i> Supabase Auth Implementation Plan</a>
|
|
172
|
-
<a href="/guides/supabase-auth-integration-plan.html" class="nav-item" data-tooltip="Supabase Authentication Integration Plan for @knowcode/doc-builder."><i class="fas fa-file-alt"></i> Supabase Auth Integration Plan</a>
|
|
173
|
-
<a href="/guides/supabase-auth-setup-guide.html" class="nav-item" data-tooltip="@knowcode/doc-builder now supports enterprise-grade authentication through Supabase, replacing the previous insecure basic authentication."><i class="fas fa-file-alt"></i> Supabase Auth Setup Guide</a>
|
|
174
207
|
<a href="/guides/troubleshooting-guide.html" class="nav-item" data-tooltip="This guide helps you resolve common issues when using @knowcode/doc-builder."><i class="fas fa-file-alt"></i> Troubleshooting Guide</a>
|
|
175
|
-
<a href="/guides/vercel-deployment-auth-setup.html" class="nav-item" data-tooltip="Vercel Deployment Authentication Setup Guide."><i class="fas fa-file-alt"></i> Vercel Deployment Auth Setup</a>
|
|
176
208
|
<a href="/guides/windows-setup-guide.html" class="nav-item" data-tooltip="This guide helps Windows users set up the complete AI-powered documentation workflow using Claude Code, @knowcode/doc-builder, and Vercel."><i class="fas fa-file-alt"></i> Windows Setup Guide</a></div></div>
|
|
177
|
-
<div class="nav-section" data-level="1">
|
|
178
|
-
<a class="nav-title collapsible" href="/launch/README.html" data-target="nav-launch-1" >
|
|
179
|
-
<i class="fas fa-chevron-right collapse-icon"></i><i class="fas fa-folder"></i> Launch
|
|
180
|
-
</a>
|
|
181
|
-
<div class="nav-content collapsed" id="nav-launch-1">
|
|
182
|
-
<a href="/launch/README.html" class="nav-item" data-tooltip="This directory contains all documentation related to the commercial launch of @knowcode/doc-builder, including go-to-market strategy, platform..."><i class="fas fa-file-alt"></i> Launch Overview</a>
|
|
183
|
-
<a href="/launch/bubble-plugin-specification.html" class="nav-item" data-tooltip="This document outlines the technical specification for creating a Bubble.io plugin that integrates @knowcode/doc-builder, enabling Bubble developers..."><i class="fas fa-file-alt"></i> Bubble Plugin Specification</a>
|
|
184
|
-
<a href="/launch/go-to-market-strategy.html" class="nav-item" data-tooltip="Go-to-Market Strategy & Product Launch Plan."><i class="fas fa-file-alt"></i> Go To Market Strategy</a>
|
|
185
|
-
<a href="/launch/launch-announcements.html" class="nav-item" data-tooltip="This document contains ready-to-use announcement templates for launching @knowcode/doc-builder across various platforms and channels."><i class="fas fa-file-alt"></i> Launch Announcements</a></div></div>
|
|
186
209
|
</nav>
|
|
187
210
|
<div class="resize-handle"></div>
|
|
188
211
|
</aside>
|
|
@@ -422,6 +445,7 @@ vercel --scope team-name
|
|
|
422
445
|
};
|
|
423
446
|
</script>
|
|
424
447
|
<script src="/js/main.js"></script>
|
|
425
|
-
|
|
448
|
+
<script src="https://unpkg.com/@supabase/supabase-js@2"></script>
|
|
449
|
+
<script src="/js/auth.js"></script>
|
|
426
450
|
</body>
|
|
427
451
|
</html>
|
|
@@ -46,6 +46,39 @@
|
|
|
46
46
|
<link rel="stylesheet" href="/css/notion-style.css">
|
|
47
47
|
|
|
48
48
|
|
|
49
|
+
<!-- Hide content until auth check -->
|
|
50
|
+
<style>
|
|
51
|
+
body {
|
|
52
|
+
visibility: hidden;
|
|
53
|
+
opacity: 0;
|
|
54
|
+
transition: opacity 0.3s ease;
|
|
55
|
+
}
|
|
56
|
+
body.authenticated {
|
|
57
|
+
visibility: visible;
|
|
58
|
+
opacity: 1;
|
|
59
|
+
}
|
|
60
|
+
/* Show login/logout pages immediately */
|
|
61
|
+
body.auth-page {
|
|
62
|
+
visibility: visible;
|
|
63
|
+
opacity: 1;
|
|
64
|
+
}
|
|
65
|
+
/* Style auth button consistently */
|
|
66
|
+
.auth-btn {
|
|
67
|
+
background: none;
|
|
68
|
+
border: none;
|
|
69
|
+
color: var(--text-secondary);
|
|
70
|
+
cursor: pointer;
|
|
71
|
+
padding: 0.5rem;
|
|
72
|
+
border-radius: 0.5rem;
|
|
73
|
+
transition: all 0.2s;
|
|
74
|
+
font-size: 1.1rem;
|
|
75
|
+
}
|
|
76
|
+
.auth-btn:hover {
|
|
77
|
+
background: var(--bg-secondary);
|
|
78
|
+
color: var(--text-primary);
|
|
79
|
+
}
|
|
80
|
+
</style>
|
|
81
|
+
|
|
49
82
|
|
|
50
83
|
<!-- Favicon -->
|
|
51
84
|
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>✨</text></svg>">
|
|
@@ -65,8 +98,8 @@
|
|
|
65
98
|
"name": "Knowcode Ltd",
|
|
66
99
|
"url": "https://knowcode.tech"
|
|
67
100
|
},
|
|
68
|
-
"datePublished": "2025-07-
|
|
69
|
-
"dateModified": "2025-07-
|
|
101
|
+
"datePublished": "2025-07-26T10:20:52.446Z",
|
|
102
|
+
"dateModified": "2025-07-26T10:20:52.446Z",
|
|
70
103
|
"mainEntityOfPage": {
|
|
71
104
|
"@type": "WebPage",
|
|
72
105
|
"@id": "https://doc-builder-delta.vercel.app/vercel-first-time-setup-guide.html"
|
|
@@ -99,10 +132,14 @@
|
|
|
99
132
|
|
|
100
133
|
<div class="header-actions">
|
|
101
134
|
<div class="deployment-info">
|
|
102
|
-
<span class="deployment-date" title="Built with doc-builder v1.
|
|
135
|
+
<span class="deployment-date" title="Built with doc-builder v1.8.0">Last updated: Jul 26, 2025, 10:20 AM UTC</span>
|
|
103
136
|
</div>
|
|
104
137
|
|
|
105
138
|
|
|
139
|
+
<a href="../login.html" class="auth-btn" title="Login/Logout">
|
|
140
|
+
<i class="fas fa-sign-in-alt"></i>
|
|
141
|
+
</a>
|
|
142
|
+
|
|
106
143
|
|
|
107
144
|
<button id="theme-toggle" class="theme-toggle" aria-label="Toggle theme">
|
|
108
145
|
<i class="fas fa-moon"></i>
|
|
@@ -158,31 +195,17 @@
|
|
|
158
195
|
</a>
|
|
159
196
|
<div class="nav-content collapsed" id="nav-guides-1">
|
|
160
197
|
<a href="/guides/authentication-default-change.html" class="nav-item" data-tooltip="Starting from version 1.7.4, @knowcode/doc-builder now defaults to no authentication for all documentation sites."><i class="fas fa-file-alt"></i> Authentication Default Change</a>
|
|
161
|
-
<a href="/guides/authentication-guide.html" class="nav-item" data-tooltip="
|
|
162
|
-
<a href="/guides/cache-control-anti-pattern.html" class="nav-item" data-tooltip="Cache Control Anti-Pattern: Why Aggressive Cache-Busting is Bad for Documentation Sites."><i class="fas fa-file-alt"></i> Cache Control Anti Pattern</a>
|
|
198
|
+
<a href="/guides/authentication-guide.html" class="nav-item" data-tooltip="@knowcode/doc-builder supports enterprise-grade authentication through Supabase - a secure, scalable authentication platform."><i class="fas fa-file-alt"></i> Authentication Guide</a>
|
|
163
199
|
<a href="/guides/claude-workflow-guide.html" class="nav-item" data-tooltip="This guide demonstrates an efficient workflow for using Claude Code with a refined CLAUDE.md file to create high-quality documentation and deploy it..."><i class="fas fa-file-alt"></i> Claude Workflow Guide</a>
|
|
164
200
|
<a href="/guides/documentation-standards.html" class="nav-item" data-tooltip="This document defines the documentation standards and conventions for the @knowcode/doc-builder project."><i class="fas fa-file-alt"></i> Documentation Standards</a>
|
|
165
|
-
<a href="/guides/next-steps-walkthrough.html" class="nav-item" data-tooltip="Now that we've implemented Supabase authentication, let's walk through testing the implementation and preparing for deployment."><i class="fas fa-file-alt"></i> Next Steps Walkthrough</a>
|
|
166
201
|
<a href="/guides/phosphor-icons-guide.html" class="nav-item" data-tooltip="@knowcode/doc-builder automatically converts Unicode emojis in your markdown files to beautiful Phosphor icons in the generated HTML."><i class="fas fa-file-alt"></i> Phosphor Icons Guide</a>
|
|
202
|
+
<a href="/guides/private-directory-authentication.html" class="nav-item" data-tooltip="The @knowcode/doc-builder provides flexible authentication options to protect your documentation."><i class="fas fa-file-alt"></i> Private Directory Authentication</a>
|
|
167
203
|
<a href="/guides/public-site-deployment.html" class="nav-item" data-tooltip="The @knowcode/doc-builder now supports deploying public documentation sites without authentication."><i class="fas fa-file-alt"></i> Public Site Deployment</a>
|
|
168
204
|
<a href="/guides/search-engine-verification-guide.html" class="nav-item" data-tooltip="Search engine verification provides access to powerful webmaster tools:."><i class="fas fa-file-alt"></i> Search Engine Verification Guide</a>
|
|
169
205
|
<a href="/guides/seo-guide.html" class="nav-item" data-tooltip="@knowcode/doc-builder includes comprehensive SEO (Search Engine Optimization) features to help your documentation rank better in search results and..."><i class="fas fa-file-alt"></i> Seo Guide</a>
|
|
170
206
|
<a href="/guides/seo-optimization-guide.html" class="nav-item" data-tooltip="@knowcode/doc-builder includes comprehensive SEO (Search Engine Optimization) features that automatically optimize your documentation for search..."><i class="fas fa-file-alt"></i> Seo Optimization Guide</a>
|
|
171
|
-
<a href="/guides/supabase-auth-implementation-plan.html" class="nav-item" data-tooltip="Supabase Auth Implementation Plan for @knowcode/doc-builder."><i class="fas fa-file-alt"></i> Supabase Auth Implementation Plan</a>
|
|
172
|
-
<a href="/guides/supabase-auth-integration-plan.html" class="nav-item" data-tooltip="Supabase Authentication Integration Plan for @knowcode/doc-builder."><i class="fas fa-file-alt"></i> Supabase Auth Integration Plan</a>
|
|
173
|
-
<a href="/guides/supabase-auth-setup-guide.html" class="nav-item" data-tooltip="@knowcode/doc-builder now supports enterprise-grade authentication through Supabase, replacing the previous insecure basic authentication."><i class="fas fa-file-alt"></i> Supabase Auth Setup Guide</a>
|
|
174
207
|
<a href="/guides/troubleshooting-guide.html" class="nav-item" data-tooltip="This guide helps you resolve common issues when using @knowcode/doc-builder."><i class="fas fa-file-alt"></i> Troubleshooting Guide</a>
|
|
175
|
-
<a href="/guides/vercel-deployment-auth-setup.html" class="nav-item" data-tooltip="Vercel Deployment Authentication Setup Guide."><i class="fas fa-file-alt"></i> Vercel Deployment Auth Setup</a>
|
|
176
208
|
<a href="/guides/windows-setup-guide.html" class="nav-item" data-tooltip="This guide helps Windows users set up the complete AI-powered documentation workflow using Claude Code, @knowcode/doc-builder, and Vercel."><i class="fas fa-file-alt"></i> Windows Setup Guide</a></div></div>
|
|
177
|
-
<div class="nav-section" data-level="1">
|
|
178
|
-
<a class="nav-title collapsible" href="/launch/README.html" data-target="nav-launch-1" >
|
|
179
|
-
<i class="fas fa-chevron-right collapse-icon"></i><i class="fas fa-folder"></i> Launch
|
|
180
|
-
</a>
|
|
181
|
-
<div class="nav-content collapsed" id="nav-launch-1">
|
|
182
|
-
<a href="/launch/README.html" class="nav-item" data-tooltip="This directory contains all documentation related to the commercial launch of @knowcode/doc-builder, including go-to-market strategy, platform..."><i class="fas fa-file-alt"></i> Launch Overview</a>
|
|
183
|
-
<a href="/launch/bubble-plugin-specification.html" class="nav-item" data-tooltip="This document outlines the technical specification for creating a Bubble.io plugin that integrates @knowcode/doc-builder, enabling Bubble developers..."><i class="fas fa-file-alt"></i> Bubble Plugin Specification</a>
|
|
184
|
-
<a href="/launch/go-to-market-strategy.html" class="nav-item" data-tooltip="Go-to-Market Strategy & Product Launch Plan."><i class="fas fa-file-alt"></i> Go To Market Strategy</a>
|
|
185
|
-
<a href="/launch/launch-announcements.html" class="nav-item" data-tooltip="This document contains ready-to-use announcement templates for launching @knowcode/doc-builder across various platforms and channels."><i class="fas fa-file-alt"></i> Launch Announcements</a></div></div>
|
|
186
209
|
</nav>
|
|
187
210
|
<div class="resize-handle"></div>
|
|
188
211
|
</aside>
|
|
@@ -381,6 +404,7 @@
|
|
|
381
404
|
};
|
|
382
405
|
</script>
|
|
383
406
|
<script src="/js/main.js"></script>
|
|
384
|
-
|
|
407
|
+
<script src="https://unpkg.com/@supabase/supabase-js@2"></script>
|
|
408
|
+
<script src="/js/auth.js"></script>
|
|
385
409
|
</body>
|
|
386
410
|
</html>
|
package/lib/config.js
CHANGED
|
@@ -264,9 +264,8 @@ async function loadConfig(configPath, options = {}) {
|
|
|
264
264
|
if (options.output) {
|
|
265
265
|
config.outputDir = options.output;
|
|
266
266
|
}
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
}
|
|
267
|
+
// Note: We don't apply auth=false here anymore because private directory detection
|
|
268
|
+
// should always override to ensure security
|
|
270
269
|
if (options.changelog === false) {
|
|
271
270
|
config.features.changelog = false;
|
|
272
271
|
config.changelog.enabled = false;
|
|
@@ -303,6 +302,25 @@ async function loadConfig(configPath, options = {}) {
|
|
|
303
302
|
console.log(chalk.gray(`Create it with: mkdir ${config.docsDir} && echo "# Documentation" > ${config.docsDir}/README.md`));
|
|
304
303
|
}
|
|
305
304
|
// Don't throw error - let commands handle missing directories appropriately
|
|
305
|
+
} else {
|
|
306
|
+
// Check for private directory and auto-enable authentication if found
|
|
307
|
+
const privatePath = path.join(docsPath, 'private');
|
|
308
|
+
if (fs.existsSync(privatePath) && fs.statSync(privatePath).isDirectory()) {
|
|
309
|
+
// Auto-enable authentication when private directory exists
|
|
310
|
+
// This overrides any config setting to ensure private directories are always protected
|
|
311
|
+
console.log(chalk.blue('🔐 Found private directory - automatically enabling Supabase authentication'));
|
|
312
|
+
config.features.authentication = 'supabase';
|
|
313
|
+
config.features.autoAuthEnabled = true; // Track that this was auto-enabled
|
|
314
|
+
|
|
315
|
+
// Check if Supabase credentials are configured
|
|
316
|
+
if (!config.auth.supabaseUrl || !config.auth.supabaseAnonKey || !config.auth.siteId) {
|
|
317
|
+
console.warn(chalk.yellow('⚠️ Supabase credentials not configured.'));
|
|
318
|
+
console.warn(chalk.yellow(' To enable authentication, set the following in your config:'));
|
|
319
|
+
console.warn(chalk.yellow(' - auth.supabaseUrl'));
|
|
320
|
+
console.warn(chalk.yellow(' - auth.supabaseAnonKey'));
|
|
321
|
+
console.warn(chalk.yellow(' - auth.siteId'));
|
|
322
|
+
}
|
|
323
|
+
}
|
|
306
324
|
}
|
|
307
325
|
|
|
308
326
|
return config;
|
package/lib/core-builder.js
CHANGED
|
@@ -362,6 +362,21 @@ ${seoTags}
|
|
|
362
362
|
visibility: visible;
|
|
363
363
|
opacity: 1;
|
|
364
364
|
}
|
|
365
|
+
/* Style auth button consistently */
|
|
366
|
+
.auth-btn {
|
|
367
|
+
background: none;
|
|
368
|
+
border: none;
|
|
369
|
+
color: var(--text-secondary);
|
|
370
|
+
cursor: pointer;
|
|
371
|
+
padding: 0.5rem;
|
|
372
|
+
border-radius: 0.5rem;
|
|
373
|
+
transition: all 0.2s;
|
|
374
|
+
font-size: 1.1rem;
|
|
375
|
+
}
|
|
376
|
+
.auth-btn:hover {
|
|
377
|
+
background: var(--bg-secondary);
|
|
378
|
+
color: var(--text-primary);
|
|
379
|
+
}
|
|
365
380
|
</style>
|
|
366
381
|
` : ''}
|
|
367
382
|
|
|
@@ -389,8 +404,8 @@ ${seoTags}
|
|
|
389
404
|
</div>
|
|
390
405
|
|
|
391
406
|
${config.features?.authentication === 'supabase' ? `
|
|
392
|
-
<a href="${relativePath}
|
|
393
|
-
<i class="fas fa-sign-
|
|
407
|
+
<a href="${relativePath}login.html" class="auth-btn" title="Login/Logout">
|
|
408
|
+
<i class="fas fa-sign-in-alt"></i>
|
|
394
409
|
</a>
|
|
395
410
|
` : ''}
|
|
396
411
|
|
|
@@ -484,10 +499,23 @@ const folderDescriptions = {
|
|
|
484
499
|
};
|
|
485
500
|
|
|
486
501
|
// Build navigation structure with rich functionality
|
|
487
|
-
function buildNavigationStructure(files, currentFile) {
|
|
502
|
+
function buildNavigationStructure(files, currentFile, config = {}) {
|
|
488
503
|
const tree = { files: [], folders: {} };
|
|
489
504
|
|
|
505
|
+
// Check if authentication is enabled
|
|
506
|
+
const isAuthEnabled = config.features?.authentication === 'supabase';
|
|
507
|
+
|
|
508
|
+
// Filter files based on authentication status and whether we're building for an authenticated page
|
|
509
|
+
// We'll pass a flag from processMarkdownFile to indicate if this is a private page
|
|
510
|
+
const isPrivatePage = currentFile && (currentFile.startsWith('private/') || currentFile.includes('/private/'));
|
|
511
|
+
const shouldIncludePrivate = isAuthEnabled && isPrivatePage;
|
|
512
|
+
|
|
490
513
|
files.forEach(file => {
|
|
514
|
+
// Skip private files if we're not on an authenticated page
|
|
515
|
+
if (file.isPrivate && !shouldIncludePrivate) {
|
|
516
|
+
return;
|
|
517
|
+
}
|
|
518
|
+
|
|
491
519
|
const parts = file.urlPath.split('/');
|
|
492
520
|
let current = tree;
|
|
493
521
|
|
|
@@ -704,8 +732,8 @@ async function processMarkdownFile(filePath, outputPath, allFiles, config) {
|
|
|
704
732
|
// Process content
|
|
705
733
|
const htmlContent = processMarkdownContent(content, config);
|
|
706
734
|
|
|
707
|
-
// Build navigation
|
|
708
|
-
const navigation = buildNavigationStructure(allFiles, urlPath);
|
|
735
|
+
// Build navigation - pass config to handle private file filtering
|
|
736
|
+
const navigation = buildNavigationStructure(allFiles, urlPath, config);
|
|
709
737
|
|
|
710
738
|
// Generate full HTML (pass original content and front matter for SEO)
|
|
711
739
|
const html = generateHTML(title, htmlContent, navigation, urlPath, config, content, frontMatter);
|
|
@@ -740,12 +768,18 @@ async function getAllMarkdownFiles(dir, baseDir = dir) {
|
|
|
740
768
|
const content = await fs.readFile(fullPath, 'utf-8');
|
|
741
769
|
const summary = extractSummary(content);
|
|
742
770
|
|
|
771
|
+
// Check if this file is in the private directory
|
|
772
|
+
const isPrivate = relativePath.split(path.sep)[0] === 'private' ||
|
|
773
|
+
relativePath.startsWith('private/') ||
|
|
774
|
+
relativePath.startsWith('private\\');
|
|
775
|
+
|
|
743
776
|
files.push({
|
|
744
777
|
path: fullPath,
|
|
745
778
|
relativePath,
|
|
746
779
|
urlPath,
|
|
747
780
|
displayName,
|
|
748
|
-
summary
|
|
781
|
+
summary,
|
|
782
|
+
isPrivate
|
|
749
783
|
});
|
|
750
784
|
}
|
|
751
785
|
}
|
|
@@ -1158,8 +1192,15 @@ async function generateSupabaseAuthFiles(outputDir, config) {
|
|
|
1158
1192
|
throw new Error(`Supabase authentication configuration errors:\n${validationErrors.join('\n')}`);
|
|
1159
1193
|
}
|
|
1160
1194
|
|
|
1195
|
+
// If no credentials at all, use placeholder values to generate auth UI
|
|
1196
|
+
const authConfig = {
|
|
1197
|
+
supabaseUrl: config.auth.supabaseUrl || 'https://placeholder.supabase.co',
|
|
1198
|
+
supabaseAnonKey: config.auth.supabaseAnonKey || 'placeholder-key',
|
|
1199
|
+
siteId: config.auth.siteId || 'placeholder-site-id'
|
|
1200
|
+
};
|
|
1201
|
+
|
|
1161
1202
|
// Create Supabase auth instance
|
|
1162
|
-
const supabaseAuth = new SupabaseAuth(
|
|
1203
|
+
const supabaseAuth = new SupabaseAuth(authConfig);
|
|
1163
1204
|
|
|
1164
1205
|
// Generate auth script and save to js/auth.js
|
|
1165
1206
|
const authScript = supabaseAuth.generateAuthScript();
|
|
@@ -1179,6 +1220,7 @@ async function generateSupabaseAuthFiles(outputDir, config) {
|
|
|
1179
1220
|
console.log(chalk.green('✓ Generated Supabase authentication files'));
|
|
1180
1221
|
}
|
|
1181
1222
|
|
|
1223
|
+
|
|
1182
1224
|
// Create default index page when no documentation exists
|
|
1183
1225
|
async function createDefaultIndexPage(outputDir, config, version) {
|
|
1184
1226
|
const siteName = config.siteName || 'Documentation';
|
package/lib/supabase-auth.js
CHANGED
|
@@ -58,11 +58,22 @@ class SupabaseAuth {
|
|
|
58
58
|
// Check authentication and site access
|
|
59
59
|
async function checkAuth() {
|
|
60
60
|
try {
|
|
61
|
+
// Check if current page is in private directory
|
|
62
|
+
const currentPath = window.location.pathname;
|
|
63
|
+
const isPrivatePage = currentPath.includes('/private/');
|
|
64
|
+
|
|
61
65
|
// Get current user session
|
|
62
66
|
const { data: { user }, error: userError } = await supabaseClient.auth.getUser();
|
|
63
67
|
|
|
64
68
|
if (userError || !user) {
|
|
65
|
-
|
|
69
|
+
// Only redirect if we're on a private page
|
|
70
|
+
if (isPrivatePage) {
|
|
71
|
+
redirectToLogin();
|
|
72
|
+
} else {
|
|
73
|
+
// Public page, just show it
|
|
74
|
+
document.body.classList.add('authenticated'); // Use same class to show body
|
|
75
|
+
updateAuthButton(false);
|
|
76
|
+
}
|
|
66
77
|
return;
|
|
67
78
|
}
|
|
68
79
|
|
|
@@ -75,17 +86,30 @@ class SupabaseAuth {
|
|
|
75
86
|
.single();
|
|
76
87
|
|
|
77
88
|
if (accessError || !access) {
|
|
78
|
-
|
|
89
|
+
if (isPrivatePage) {
|
|
90
|
+
showAccessDenied();
|
|
91
|
+
} else {
|
|
92
|
+
// Public page, just show it
|
|
93
|
+
document.body.classList.add('authenticated');
|
|
94
|
+
updateAuthButton(false);
|
|
95
|
+
}
|
|
79
96
|
return;
|
|
80
97
|
}
|
|
81
98
|
|
|
82
99
|
// User is authenticated and has access
|
|
83
100
|
console.log('User authenticated and authorized');
|
|
84
101
|
document.body.classList.add('authenticated');
|
|
102
|
+
updateAuthButton(true);
|
|
85
103
|
|
|
86
104
|
} catch (error) {
|
|
87
105
|
console.error('Auth check failed:', error);
|
|
88
|
-
|
|
106
|
+
if (window.location.pathname.includes('/private/')) {
|
|
107
|
+
redirectToLogin();
|
|
108
|
+
} else {
|
|
109
|
+
// Public page, show it anyway
|
|
110
|
+
document.body.classList.add('authenticated');
|
|
111
|
+
updateAuthButton(false);
|
|
112
|
+
}
|
|
89
113
|
}
|
|
90
114
|
}
|
|
91
115
|
|
|
@@ -110,16 +134,41 @@ class SupabaseAuth {
|
|
|
110
134
|
\`;
|
|
111
135
|
}
|
|
112
136
|
|
|
113
|
-
//
|
|
137
|
+
// Function to update auth button
|
|
138
|
+
function updateAuthButton(isAuthenticated) {
|
|
139
|
+
const authBtn = document.querySelector('.auth-btn');
|
|
140
|
+
if (authBtn) {
|
|
141
|
+
const icon = authBtn.querySelector('i');
|
|
142
|
+
if (icon) {
|
|
143
|
+
if (isAuthenticated) {
|
|
144
|
+
icon.className = 'fas fa-sign-out-alt';
|
|
145
|
+
authBtn.title = 'Logout';
|
|
146
|
+
authBtn.href = '/logout.html';
|
|
147
|
+
} else {
|
|
148
|
+
icon.className = 'fas fa-sign-in-alt';
|
|
149
|
+
authBtn.title = 'Login';
|
|
150
|
+
authBtn.href = '/login.html';
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// Add auth button functionality
|
|
114
157
|
document.addEventListener('DOMContentLoaded', function() {
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
await supabaseClient.auth.
|
|
120
|
-
|
|
158
|
+
const authBtn = document.querySelector('.auth-btn');
|
|
159
|
+
if (authBtn) {
|
|
160
|
+
authBtn.addEventListener('click', async function(e) {
|
|
161
|
+
// Check if we're logged in
|
|
162
|
+
const { data: { user } } = await supabaseClient.auth.getUser();
|
|
163
|
+
if (user) {
|
|
164
|
+
// Logged in - sign out
|
|
165
|
+
e.preventDefault();
|
|
166
|
+
await supabaseClient.auth.signOut();
|
|
167
|
+
window.location.href = '/logout.html';
|
|
168
|
+
}
|
|
169
|
+
// If not logged in, normal navigation to login page will occur
|
|
121
170
|
});
|
|
122
|
-
}
|
|
171
|
+
}
|
|
123
172
|
});
|
|
124
173
|
|
|
125
174
|
// Run auth check
|
|
@@ -271,21 +320,27 @@ class SupabaseAuth {
|
|
|
271
320
|
static validateConfig(config) {
|
|
272
321
|
const errors = [];
|
|
273
322
|
|
|
274
|
-
if
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
if (!config.auth.supabaseAnonKey) {
|
|
279
|
-
errors.push('auth.supabaseAnonKey is required');
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
if (!config.auth.siteId) {
|
|
283
|
-
errors.push('auth.siteId is required');
|
|
284
|
-
}
|
|
323
|
+
// Only validate if at least one credential is provided
|
|
324
|
+
// This allows the auth UI to show even without full configuration
|
|
325
|
+
const hasAnyCredential = config.auth.supabaseUrl || config.auth.supabaseAnonKey || config.auth.siteId;
|
|
285
326
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
327
|
+
if (hasAnyCredential) {
|
|
328
|
+
if (!config.auth.supabaseUrl) {
|
|
329
|
+
errors.push('auth.supabaseUrl is required');
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
if (!config.auth.supabaseAnonKey) {
|
|
333
|
+
errors.push('auth.supabaseAnonKey is required');
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
if (!config.auth.siteId) {
|
|
337
|
+
errors.push('auth.siteId is required');
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
// Validate URL format
|
|
341
|
+
if (config.auth.supabaseUrl && !config.auth.supabaseUrl.match(/^https:\/\/\w+\.supabase\.co$/)) {
|
|
342
|
+
errors.push('auth.supabaseUrl must be a valid Supabase URL (https://xxx.supabase.co)');
|
|
343
|
+
}
|
|
289
344
|
}
|
|
290
345
|
|
|
291
346
|
return errors;
|