@knowcode/doc-builder 1.4.8 → 1.4.9

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/package/index.js DELETED
@@ -1,38 +0,0 @@
1
- /**
2
- * @knowcode/doc-builder - Programmatic API
3
- *
4
- * This module exports functions for use in scripts or other tools
5
- */
6
-
7
- const { build } = require('./lib/builder');
8
- const { startDevServer } = require('./lib/dev-server');
9
- const { deployToVercel, setupVercelProject } = require('./lib/deploy');
10
- const { loadConfig, createDefaultConfig } = require('./lib/config');
11
-
12
- module.exports = {
13
- // Main functions
14
- build,
15
- startDevServer,
16
- deployToVercel,
17
- setupVercelProject,
18
-
19
- // Config utilities
20
- loadConfig,
21
- createDefaultConfig,
22
-
23
- // Convenience wrapper for common operations
24
- async buildDocs(configPath = 'doc-builder.config.js', options = {}) {
25
- const config = await loadConfig(configPath, options);
26
- return build(config);
27
- },
28
-
29
- async deploy(configPath = 'doc-builder.config.js', options = {}) {
30
- const config = await loadConfig(configPath, options);
31
- return deployToVercel(config, options.prod);
32
- },
33
-
34
- async dev(configPath = 'doc-builder.config.js', options = {}) {
35
- const config = await loadConfig(configPath, options);
36
- return startDevServer(config, options.port || 3000);
37
- }
38
- };
@@ -1,32 +0,0 @@
1
- const fs = require('fs-extra');
2
- const path = require('path');
3
- const chalk = require('chalk');
4
- const { buildDocumentation } = require('./core-builder');
5
-
6
- /**
7
- * Main build function
8
- * Now fully self-contained!
9
- */
10
- async function build(config) {
11
- console.log(chalk.blue(`\nšŸš€ Building ${config.siteName}...\n`));
12
-
13
- // Validate config
14
- if (!config || typeof config !== 'object') {
15
- throw new Error('Invalid configuration provided to build function');
16
- }
17
-
18
- try {
19
- // Use the self-contained builder
20
- await buildDocumentation(config);
21
- console.log(chalk.green('\n✨ Build complete!\n'));
22
- } catch (error) {
23
- console.error(chalk.red('\nāŒ Build failed:'), error.message);
24
- throw error;
25
- }
26
- }
27
-
28
- // Asset copying is now handled in core-builder.js
29
-
30
- module.exports = {
31
- build
32
- };
@@ -1,278 +0,0 @@
1
- const fs = require('fs-extra');
2
- const path = require('path');
3
- const chalk = require('chalk');
4
-
5
- /**
6
- * Default configuration
7
- */
8
- const defaultConfig = {
9
- // Source and output directories
10
- docsDir: 'docs',
11
- outputDir: 'html',
12
-
13
- // Site metadata
14
- siteName: 'Documentation',
15
- siteDescription: 'Documentation site built with @knowcode/doc-builder',
16
-
17
- // Features
18
- features: {
19
- authentication: false,
20
- changelog: true,
21
- mermaid: true,
22
- tooltips: true,
23
- search: false,
24
- darkMode: true
25
- },
26
-
27
- // Authentication (if enabled)
28
- auth: {
29
- username: 'admin',
30
- password: 'password'
31
- },
32
-
33
- // Changelog settings
34
- changelog: {
35
- daysBack: 14,
36
- enabled: true
37
- },
38
-
39
- // Navigation configuration
40
- folderOrder: [],
41
- folderDescriptions: {},
42
- folderIcons: {},
43
-
44
- // Deployment
45
- deployment: {
46
- platform: 'vercel',
47
- outputDirectory: 'html'
48
- }
49
- };
50
-
51
- /**
52
- * Notion-inspired preset - clean, modern documentation style
53
- */
54
- const notionInspiredPreset = {
55
- docsDir: 'docs',
56
- outputDir: 'html',
57
- siteName: 'Documentation', // Clean default name
58
- siteDescription: 'Transforming complex sales through intelligent automation',
59
-
60
- features: {
61
- authentication: true,
62
- changelog: true,
63
- mermaid: true,
64
- tooltips: true,
65
- search: false,
66
- darkMode: true
67
- },
68
-
69
- auth: {
70
- username: 'admin',
71
- password: 'docs2025'
72
- },
73
-
74
- changelog: {
75
- daysBack: 14,
76
- enabled: true
77
- },
78
-
79
- // Folder descriptions from existing code
80
- folderDescriptions: {
81
- 'product-roadmap': 'Strategic vision, timeline, and feature planning',
82
- 'product-requirements': 'Detailed product specifications, requirements documents, and feature definitions',
83
- 'architecture': 'System design, data flows, and technical infrastructure documentation',
84
- 'system-analysis': 'Comprehensive system analysis, functional requirements, and cross-component documentation',
85
- 'bubble': 'Core application platform - business logic, UI/UX, and user workflows',
86
- 'quickbase': 'Database schema, data management, and backend operations',
87
- 'activecampaign': 'Marketing automation integration and lead management system',
88
- 'juno-signer': 'Document signing service for digital signatures and PDF generation',
89
- 'juno-api-deprecated': 'Legacy API documentation (deprecated, for reference only)',
90
- 'postman': 'API testing tools, collections, and test automation',
91
- 'mcp': 'Model Context Protocol setup and configuration guides',
92
- 'team': 'Team roles, responsibilities, and task assignments',
93
- 'thought-leadership': 'Strategic thinking, industry insights, and future vision',
94
- 'paths': 'Dynamic pathway routing system for insurance applications',
95
- 'testing': 'Testing procedures, checklists, and quality assurance',
96
- 'technical': 'Technical documentation and implementation details',
97
- 'application': 'Application components, data types, and workflows'
98
- },
99
-
100
- folderIcons: {
101
- 'root': 'fas fa-home',
102
- 'product-roadmap': 'fas fa-road',
103
- 'product-requirements': 'fas fa-clipboard-list',
104
- 'architecture': 'fas fa-sitemap',
105
- 'system-analysis': 'fas fa-analytics',
106
- 'system': 'fas fa-cogs',
107
- 'bubble': 'fas fa-bubble',
108
- 'quickbase': 'fas fa-database',
109
- 'activecampaign': 'fas fa-envelope',
110
- 'juno-signer': 'fas fa-signature',
111
- 'juno-api-deprecated': 'fas fa-archive',
112
- 'postman': 'fas fa-flask',
113
- 'mcp': 'fas fa-puzzle-piece',
114
- 'team': 'fas fa-users',
115
- 'thought-leadership': 'fas fa-lightbulb',
116
- 'middleware': 'fas fa-layer-group',
117
- 'paths': 'fas fa-route',
118
- 'testing': 'fas fa-vial',
119
- 'juno-api': 'fas fa-plug'
120
- },
121
-
122
- folderOrder: [
123
- 'product-roadmap',
124
- 'product-requirements',
125
- 'architecture',
126
- 'system-analysis',
127
- 'bubble',
128
- 'quickbase',
129
- 'activecampaign',
130
- 'juno-signer',
131
- 'juno-api-deprecated',
132
- 'postman',
133
- 'mcp',
134
- 'team',
135
- 'thought-leadership'
136
- ]
137
- };
138
-
139
- /**
140
- * Load configuration
141
- */
142
- async function loadConfig(configPath, options = {}) {
143
- let config = { ...defaultConfig };
144
-
145
- // Apply preset if specified
146
- if (options.preset === 'notion-inspired') {
147
- config = { ...config, ...notionInspiredPreset };
148
- }
149
-
150
- // Load custom config file if it exists
151
- const customConfigPath = path.join(process.cwd(), configPath);
152
- if (fs.existsSync(customConfigPath)) {
153
- try {
154
- const customConfig = require(customConfigPath);
155
- config = { ...config, ...customConfig };
156
-
157
- // Handle alternative config formats
158
- if (customConfig.site) {
159
- // Map site.title to siteName
160
- if (customConfig.site.title) {
161
- config.siteName = customConfig.site.title;
162
- console.log(chalk.gray(` Using site name: ${config.siteName}`));
163
- }
164
- if (customConfig.site.description) {
165
- config.siteDescription = customConfig.site.description;
166
- }
167
- }
168
-
169
- // Map input/output to docsDir/outputDir
170
- if (customConfig.input) {
171
- config.docsDir = customConfig.input;
172
- }
173
- if (customConfig.output) {
174
- config.outputDir = customConfig.output;
175
- }
176
-
177
- console.log(chalk.gray(`Loaded config from ${configPath}`));
178
- } catch (error) {
179
- console.warn(chalk.yellow(`Warning: Failed to load config file: ${error.message}`));
180
- }
181
- } else if (!options.preset && !options.legacy) {
182
- console.log(chalk.gray('No config file found, using defaults'));
183
- }
184
-
185
- // Apply CLI options (these override config file)
186
- if (options.input) {
187
- config.docsDir = options.input;
188
- }
189
- if (options.output) {
190
- config.outputDir = options.output;
191
- }
192
- if (options.auth === false) {
193
- config.features.authentication = false;
194
- }
195
- if (options.changelog === false) {
196
- config.features.changelog = false;
197
- config.changelog.enabled = false;
198
- }
199
-
200
- // Legacy mode - auto-detect structure
201
- if (options.legacy) {
202
- const docsPath = path.join(process.cwd(), 'docs');
203
- const htmlPath = path.join(process.cwd(), 'html');
204
-
205
- if (fs.existsSync(docsPath) && fs.existsSync(htmlPath)) {
206
- console.log(chalk.gray('Legacy mode: detected docs/ and html/ structure'));
207
- config.docsDir = 'docs';
208
- config.outputDir = 'html';
209
- }
210
- }
211
-
212
- // Validate paths - but be lenient for deploy command
213
- const docsPath = path.join(process.cwd(), config.docsDir);
214
- if (!fs.existsSync(docsPath)) {
215
- console.warn(chalk.yellow(`Warning: Documentation directory not found: ${config.docsDir}`));
216
- console.log(chalk.gray(`Create it with: mkdir ${config.docsDir} && echo "# Documentation" > ${config.docsDir}/README.md`));
217
- // Don't throw error - let commands handle missing directories appropriately
218
- }
219
-
220
- return config;
221
- }
222
-
223
- /**
224
- * Create default configuration
225
- */
226
- async function createDefaultConfig() {
227
- const answers = await require('prompts')([
228
- {
229
- type: 'text',
230
- name: 'siteName',
231
- message: 'Site name:',
232
- initial: 'My Documentation'
233
- },
234
- {
235
- type: 'text',
236
- name: 'siteDescription',
237
- message: 'Site description:',
238
- initial: 'Documentation for my project'
239
- },
240
- {
241
- type: 'confirm',
242
- name: 'authentication',
243
- message: 'Enable authentication?',
244
- initial: false
245
- },
246
- {
247
- type: prev => prev ? 'text' : null,
248
- name: 'authUsername',
249
- message: 'Authentication username:',
250
- initial: 'admin'
251
- },
252
- {
253
- type: prev => prev ? 'password' : null,
254
- name: 'authPassword',
255
- message: 'Authentication password:',
256
- initial: 'password'
257
- }
258
- ]);
259
-
260
- const config = { ...defaultConfig };
261
- config.siteName = answers.siteName;
262
- config.siteDescription = answers.siteDescription;
263
- config.features.authentication = answers.authentication;
264
-
265
- if (answers.authentication) {
266
- config.auth.username = answers.authUsername;
267
- config.auth.password = answers.authPassword;
268
- }
269
-
270
- return config;
271
- }
272
-
273
- module.exports = {
274
- defaultConfig,
275
- notionInspiredPreset,
276
- loadConfig,
277
- createDefaultConfig
278
- };