@life-and-dev/mdsite 0.0.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.
- package/README.md +228 -0
- package/bin/mdsite.js +3 -0
- package/dist/commands/commands.test.d.ts +1 -0
- package/dist/commands/commands.test.js +302 -0
- package/dist/commands/commands.test.js.map +1 -0
- package/dist/commands/generate.d.ts +1 -0
- package/dist/commands/generate.js +20 -0
- package/dist/commands/generate.js.map +1 -0
- package/dist/commands/init.d.ts +1 -0
- package/dist/commands/init.js +16 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/prepare.d.ts +1 -0
- package/dist/commands/prepare.js +111 -0
- package/dist/commands/prepare.js.map +1 -0
- package/dist/commands/prepare.test.d.ts +1 -0
- package/dist/commands/prepare.test.js +131 -0
- package/dist/commands/prepare.test.js.map +1 -0
- package/dist/commands/preview.d.ts +5 -0
- package/dist/commands/preview.js +62 -0
- package/dist/commands/preview.js.map +1 -0
- package/dist/commands/start.d.ts +5 -0
- package/dist/commands/start.js +50 -0
- package/dist/commands/start.js.map +1 -0
- package/dist/commands/stop.d.ts +1 -0
- package/dist/commands/stop.js +26 -0
- package/dist/commands/stop.js.map +1 -0
- package/dist/commands/workflows.test.d.ts +1 -0
- package/dist/commands/workflows.test.js +183 -0
- package/dist/commands/workflows.test.js.map +1 -0
- package/dist/config/default-mdsite-config.d.ts +2 -0
- package/dist/config/default-mdsite-config.js +82 -0
- package/dist/config/default-mdsite-config.js.map +1 -0
- package/dist/config/default-mdsite-config.test.d.ts +1 -0
- package/dist/config/default-mdsite-config.test.js +42 -0
- package/dist/config/default-mdsite-config.test.js.map +1 -0
- package/dist/config/mdsite-config.d.ts +42 -0
- package/dist/config/mdsite-config.js +74 -0
- package/dist/config/mdsite-config.js.map +1 -0
- package/dist/config/mdsite-config.test.d.ts +1 -0
- package/dist/config/mdsite-config.test.js +115 -0
- package/dist/config/mdsite-config.test.js.map +1 -0
- package/dist/config/menu.d.ts +3 -0
- package/dist/config/menu.js +58 -0
- package/dist/config/menu.js.map +1 -0
- package/dist/config/menu.test.d.ts +1 -0
- package/dist/config/menu.test.js +53 -0
- package/dist/config/menu.test.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +99 -0
- package/dist/index.js.map +1 -0
- package/dist/index.test.d.ts +1 -0
- package/dist/index.test.js +133 -0
- package/dist/index.test.js.map +1 -0
- package/dist/process/child-process.d.ts +9 -0
- package/dist/process/child-process.js +142 -0
- package/dist/process/child-process.js.map +1 -0
- package/dist/process/child-process.test.d.ts +1 -0
- package/dist/process/child-process.test.js +131 -0
- package/dist/process/child-process.test.js.map +1 -0
- package/dist/process/runtime-state.d.ts +16 -0
- package/dist/process/runtime-state.js +42 -0
- package/dist/process/runtime-state.js.map +1 -0
- package/dist/process/runtime-state.test.d.ts +1 -0
- package/dist/process/runtime-state.test.js +57 -0
- package/dist/process/runtime-state.test.js.map +1 -0
- package/dist/renderer/mdsite-nuxt.d.ts +22 -0
- package/dist/renderer/mdsite-nuxt.js +194 -0
- package/dist/renderer/mdsite-nuxt.js.map +1 -0
- package/dist/renderer/mdsite-nuxt.test.d.ts +1 -0
- package/dist/renderer/mdsite-nuxt.test.js +226 -0
- package/dist/renderer/mdsite-nuxt.test.js.map +1 -0
- package/mdsite-nuxt/app/app.vue +7 -0
- package/mdsite-nuxt/app/assets/css/bible-tooltips.css +87 -0
- package/mdsite-nuxt/app/assets/css/markdown.css +195 -0
- package/mdsite-nuxt/app/assets/css/print.css +133 -0
- package/mdsite-nuxt/app/components/AppBar.vue +138 -0
- package/mdsite-nuxt/app/components/AppFooter.vue +88 -0
- package/mdsite-nuxt/app/components/AppNavigation.vue +162 -0
- package/mdsite-nuxt/app/components/AppTableOfContents.vue +149 -0
- package/mdsite-nuxt/app/components/BreadcrumbNav.vue +139 -0
- package/mdsite-nuxt/app/components/NavigationTree.vue +169 -0
- package/mdsite-nuxt/app/components/SearchBox.vue +212 -0
- package/mdsite-nuxt/app/components/TocItem.vue +75 -0
- package/mdsite-nuxt/app/components/TreeNode.vue +264 -0
- package/mdsite-nuxt/app/components/content/MarkdownAlert.vue +42 -0
- package/mdsite-nuxt/app/components/content/Mermaid.vue +103 -0
- package/mdsite-nuxt/app/components/content/ProseA.vue +57 -0
- package/mdsite-nuxt/app/components/content/ProseBlockquote.vue +14 -0
- package/mdsite-nuxt/app/components/content/ProsePre.vue +49 -0
- package/mdsite-nuxt/app/components/content/ProseTable.vue +143 -0
- package/mdsite-nuxt/app/composables/useAppTheme.ts +89 -0
- package/mdsite-nuxt/app/composables/useBibleTooltips.ts +21 -0
- package/mdsite-nuxt/app/composables/useBreadcrumbs.ts +70 -0
- package/mdsite-nuxt/app/composables/useContentPostProcessing.ts +89 -0
- package/mdsite-nuxt/app/composables/useNavigationTree.ts +174 -0
- package/mdsite-nuxt/app/composables/useSearchIndex.ts +47 -0
- package/mdsite-nuxt/app/composables/useSearchRelevance.test.ts +255 -0
- package/mdsite-nuxt/app/composables/useSearchRelevance.ts +207 -0
- package/mdsite-nuxt/app/composables/useSidebarState.ts +62 -0
- package/mdsite-nuxt/app/composables/useSiteConfig.ts +37 -0
- package/mdsite-nuxt/app/composables/useSourceEdit.ts +69 -0
- package/mdsite-nuxt/app/composables/useTableOfContents.ts +141 -0
- package/mdsite-nuxt/app/composables/useTableParser.ts +106 -0
- package/mdsite-nuxt/app/composables/useTooltipConfig.ts +20 -0
- package/mdsite-nuxt/app/config/themes.ts +17 -0
- package/mdsite-nuxt/app/layouts/default.vue +376 -0
- package/mdsite-nuxt/app/pages/[...slug].vue +56 -0
- package/mdsite-nuxt/app/pages/index.vue +54 -0
- package/mdsite-nuxt/app/plugins/bible-tooltips.client.ts +401 -0
- package/mdsite-nuxt/app/plugins/bible-tooltips.test.ts +284 -0
- package/mdsite-nuxt/app/types/content.d.ts +10 -0
- package/mdsite-nuxt/app/types/table.ts +57 -0
- package/mdsite-nuxt/app/utils/bible-book-names.ts +37 -0
- package/mdsite-nuxt/app/utils/bible-verse-utils.test.ts +148 -0
- package/mdsite-nuxt/app/utils/bible-verse-utils.ts +236 -0
- package/mdsite-nuxt/content.config.ts +18 -0
- package/mdsite-nuxt/example.config.yml +67 -0
- package/mdsite-nuxt/nuxt.config.ts +247 -0
- package/mdsite-nuxt/package-lock.json +15922 -0
- package/mdsite-nuxt/package.json +50 -0
- package/mdsite-nuxt/playwright.config.js +47 -0
- package/mdsite-nuxt/public/robots.txt +2 -0
- package/mdsite-nuxt/scripts/generate-favicons.ts +192 -0
- package/mdsite-nuxt/scripts/generate-indices.ts +508 -0
- package/mdsite-nuxt/scripts/renderer-hooks.test.ts +277 -0
- package/mdsite-nuxt/scripts/renderer-hooks.ts +141 -0
- package/mdsite-nuxt/scripts/start.test.ts +164 -0
- package/mdsite-nuxt/scripts/start.ts +55 -0
- package/mdsite-nuxt/scripts/sync-content.ts +504 -0
- package/mdsite-nuxt/tsconfig.json +18 -0
- package/mdsite-nuxt/utils/mdsite-config.ts +240 -0
- package/mdsite-nuxt/vitest.config.ts +7 -0
- package/package.json +36 -0
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import YAML from 'yaml';
|
|
4
|
+
|
|
5
|
+
export interface MdsiteConfig {
|
|
6
|
+
content?: {
|
|
7
|
+
path?: string
|
|
8
|
+
}
|
|
9
|
+
favicon: string
|
|
10
|
+
features: {
|
|
11
|
+
bibleTooltips: boolean
|
|
12
|
+
sourceEdit: boolean
|
|
13
|
+
}
|
|
14
|
+
menu: Array<string | null | Record<string, string | null | Array<any>>>
|
|
15
|
+
server: {
|
|
16
|
+
output: string
|
|
17
|
+
path: string
|
|
18
|
+
repo: string
|
|
19
|
+
}
|
|
20
|
+
site: {
|
|
21
|
+
canonical: string
|
|
22
|
+
name: string
|
|
23
|
+
}
|
|
24
|
+
themes: {
|
|
25
|
+
light: {
|
|
26
|
+
colors: Record<string, string>
|
|
27
|
+
}
|
|
28
|
+
dark: {
|
|
29
|
+
colors: Record<string, string>
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface LoadedMdsiteConfig {
|
|
35
|
+
config: MdsiteConfig
|
|
36
|
+
configPath?: string
|
|
37
|
+
contentDir: string
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const configFileName = 'mdsite.yml';
|
|
41
|
+
|
|
42
|
+
const defaultLightColors = {
|
|
43
|
+
primary: '#0969da',
|
|
44
|
+
secondary: '#656d76',
|
|
45
|
+
selected: '#dbe3eb',
|
|
46
|
+
error: '#d1242f',
|
|
47
|
+
warning: '#bf8700',
|
|
48
|
+
info: '#0969da',
|
|
49
|
+
success: '#1a7f37',
|
|
50
|
+
background: '#f6f8fa',
|
|
51
|
+
surface: '#ffffff',
|
|
52
|
+
'surface-rail': '#edf1f5',
|
|
53
|
+
'surface-appbar': '#e4eaf0',
|
|
54
|
+
'on-surface-rail': '#32302a',
|
|
55
|
+
'on-surface-appbar': '#000000',
|
|
56
|
+
'on-background': '#24292f',
|
|
57
|
+
'on-surface': '#24292f',
|
|
58
|
+
'on-primary': '#ffffff',
|
|
59
|
+
'on-secondary': '#ffffff',
|
|
60
|
+
'on-selectable': '#24292f',
|
|
61
|
+
'on-selected': '#000000',
|
|
62
|
+
'on-error': '#ffffff',
|
|
63
|
+
'on-warning': '#ffffff',
|
|
64
|
+
'on-info': '#ffffff',
|
|
65
|
+
'on-success': '#ffffff',
|
|
66
|
+
outline: '#d0d7de',
|
|
67
|
+
'outline-bars': '#f3f4f6'
|
|
68
|
+
} satisfies Record<string, string>;
|
|
69
|
+
|
|
70
|
+
const defaultDarkColors = {
|
|
71
|
+
primary: '#58a6ff',
|
|
72
|
+
secondary: '#8b949e',
|
|
73
|
+
selected: '#313943',
|
|
74
|
+
error: '#f85149',
|
|
75
|
+
warning: '#d29922',
|
|
76
|
+
info: '#58a6ff',
|
|
77
|
+
success: '#3fb950',
|
|
78
|
+
background: '#161b22',
|
|
79
|
+
surface: '#0d1117',
|
|
80
|
+
'surface-rail': '#1f252d',
|
|
81
|
+
'surface-appbar': '#282f38',
|
|
82
|
+
'on-surface-rail': '#ced0d6',
|
|
83
|
+
'on-surface-appbar': '#ffffff',
|
|
84
|
+
'on-background': '#c9d1d9',
|
|
85
|
+
'on-surface': '#c9d1d9',
|
|
86
|
+
'on-primary': '#0d1117',
|
|
87
|
+
'on-secondary': '#0d1117',
|
|
88
|
+
'on-selectable': '#c9d1d9',
|
|
89
|
+
'on-selected': '#ffffff',
|
|
90
|
+
'on-error': '#ffffff',
|
|
91
|
+
'on-warning': '#ffffff',
|
|
92
|
+
'on-info': '#ffffff',
|
|
93
|
+
'on-success': '#ffffff',
|
|
94
|
+
outline: '#30363d',
|
|
95
|
+
'outline-bars': '#161b22'
|
|
96
|
+
} satisfies Record<string, string>;
|
|
97
|
+
|
|
98
|
+
export function loadMdsiteConfigSync(options: {
|
|
99
|
+
configPath?: string
|
|
100
|
+
contentPath?: string
|
|
101
|
+
searchFrom?: string
|
|
102
|
+
} = {}): LoadedMdsiteConfig {
|
|
103
|
+
const configPath = resolveMdsiteConfigPath(options);
|
|
104
|
+
|
|
105
|
+
if (!configPath) {
|
|
106
|
+
const contentDir = resolveContentDir(options, configPath);
|
|
107
|
+
return {
|
|
108
|
+
config: createDefaultMdsiteConfig(path.basename(contentDir) || 'Site'),
|
|
109
|
+
contentDir
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const rawText = fs.readFileSync(configPath, 'utf8');
|
|
114
|
+
const parsed = YAML.parse(rawText) ?? {};
|
|
115
|
+
const contentDir = resolveContentDir(options, configPath, parsed);
|
|
116
|
+
|
|
117
|
+
return {
|
|
118
|
+
config: normalizeMdsiteConfig(parsed, contentDir),
|
|
119
|
+
configPath,
|
|
120
|
+
contentDir
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export function resolveMdsiteConfigPath(options: {
|
|
125
|
+
configPath?: string
|
|
126
|
+
contentPath?: string
|
|
127
|
+
searchFrom?: string
|
|
128
|
+
} = {}): string | undefined {
|
|
129
|
+
const candidates = [
|
|
130
|
+
options.configPath,
|
|
131
|
+
process.env.MDSITE_CONFIG_PATH,
|
|
132
|
+
options.contentPath ? path.join(options.contentPath, configFileName) : undefined,
|
|
133
|
+
process.env.NUXT_CONTENT_PATH ? path.join(process.env.NUXT_CONTENT_PATH, configFileName) : undefined,
|
|
134
|
+
options.searchFrom ? path.join(options.searchFrom, configFileName) : undefined,
|
|
135
|
+
path.join(process.cwd(), configFileName)
|
|
136
|
+
];
|
|
137
|
+
|
|
138
|
+
for (const candidate of candidates) {
|
|
139
|
+
if (!candidate) {
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const resolvedPath = path.resolve(candidate);
|
|
144
|
+
if (fs.existsSync(resolvedPath) && fs.statSync(resolvedPath).isFile()) {
|
|
145
|
+
return resolvedPath;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return undefined;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export function resolveContentDir(options: {
|
|
153
|
+
configPath?: string
|
|
154
|
+
contentPath?: string
|
|
155
|
+
searchFrom?: string
|
|
156
|
+
} = {}, resolvedConfigPath?: string, rawConfig: Record<string, any> = {}): string {
|
|
157
|
+
if (options.contentPath) {
|
|
158
|
+
return path.resolve(options.contentPath);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (process.env.NUXT_CONTENT_PATH) {
|
|
162
|
+
return path.resolve(process.env.NUXT_CONTENT_PATH);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if (resolvedConfigPath) {
|
|
166
|
+
const configDir = path.dirname(resolvedConfigPath);
|
|
167
|
+
return typeof rawConfig.content?.path === 'string' ? path.resolve(configDir, rawConfig.content.path) : configDir;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if (options.searchFrom) {
|
|
171
|
+
return path.resolve(options.searchFrom);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return process.cwd();
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function createDefaultMdsiteConfig(siteName: string): MdsiteConfig {
|
|
178
|
+
return {
|
|
179
|
+
favicon: '',
|
|
180
|
+
features: {
|
|
181
|
+
bibleTooltips: true,
|
|
182
|
+
sourceEdit: true
|
|
183
|
+
},
|
|
184
|
+
menu: [],
|
|
185
|
+
server: {
|
|
186
|
+
output: '.output',
|
|
187
|
+
path: '.mdsite',
|
|
188
|
+
repo: 'https://github.com/life-and-dev/mdsite'
|
|
189
|
+
},
|
|
190
|
+
site: {
|
|
191
|
+
canonical: '',
|
|
192
|
+
name: siteName
|
|
193
|
+
},
|
|
194
|
+
themes: {
|
|
195
|
+
light: {
|
|
196
|
+
colors: defaultLightColors
|
|
197
|
+
},
|
|
198
|
+
dark: {
|
|
199
|
+
colors: defaultDarkColors
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
function normalizeMdsiteConfig(rawConfig: Record<string, any>, contentDir: string): MdsiteConfig {
|
|
206
|
+
const fallbackConfig = createDefaultMdsiteConfig(path.basename(contentDir) || 'Site');
|
|
207
|
+
|
|
208
|
+
return {
|
|
209
|
+
favicon: typeof rawConfig.favicon === 'string' ? rawConfig.favicon : fallbackConfig.favicon,
|
|
210
|
+
features: {
|
|
211
|
+
bibleTooltips: rawConfig.features?.bibleTooltips ?? fallbackConfig.features.bibleTooltips,
|
|
212
|
+
sourceEdit: rawConfig.features?.sourceEdit ?? fallbackConfig.features.sourceEdit
|
|
213
|
+
},
|
|
214
|
+
content: typeof rawConfig.content?.path === 'string' ? { path: rawConfig.content.path } : fallbackConfig.content,
|
|
215
|
+
menu: Array.isArray(rawConfig.menu) ? rawConfig.menu : fallbackConfig.menu,
|
|
216
|
+
server: {
|
|
217
|
+
output: typeof rawConfig.server?.output === 'string' ? rawConfig.server.output : fallbackConfig.server.output,
|
|
218
|
+
path: typeof rawConfig.server?.path === 'string' ? rawConfig.server.path : fallbackConfig.server.path,
|
|
219
|
+
repo: typeof rawConfig.server?.repo === 'string' ? rawConfig.server.repo : fallbackConfig.server.repo
|
|
220
|
+
},
|
|
221
|
+
site: {
|
|
222
|
+
canonical: typeof rawConfig.site?.canonical === 'string' ? rawConfig.site.canonical : fallbackConfig.site.canonical,
|
|
223
|
+
name: typeof rawConfig.site?.name === 'string' && rawConfig.site.name.trim() ? rawConfig.site.name : fallbackConfig.site.name
|
|
224
|
+
},
|
|
225
|
+
themes: {
|
|
226
|
+
light: {
|
|
227
|
+
colors: {
|
|
228
|
+
...fallbackConfig.themes.light.colors,
|
|
229
|
+
...(rawConfig.themes?.light?.colors ?? {})
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
dark: {
|
|
233
|
+
colors: {
|
|
234
|
+
...fallbackConfig.themes.dark.colors,
|
|
235
|
+
...(rawConfig.themes?.dark?.colors ?? {})
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@life-and-dev/mdsite",
|
|
3
|
+
"version": "0.0.3",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"private": false,
|
|
6
|
+
"description": "Local-first CLI that orchestrates mdsite-nuxt",
|
|
7
|
+
"bin": {
|
|
8
|
+
"mdsite": "./bin/mdsite.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"bin/",
|
|
12
|
+
"dist/",
|
|
13
|
+
"mdsite-nuxt/",
|
|
14
|
+
"README.md"
|
|
15
|
+
],
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public"
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsc -p tsconfig.json",
|
|
21
|
+
"install-alias": "node scripts/mdsite-dev-alias.js install",
|
|
22
|
+
"uninstall-alias": "node scripts/mdsite-dev-alias.js uninstall",
|
|
23
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
24
|
+
"test": "vitest run",
|
|
25
|
+
"verify:package": "node --experimental-strip-types scripts/verify-package-artifacts.ts",
|
|
26
|
+
"prepublishOnly": "npm test && npm run typecheck && npm run build && npm run verify:package"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"yaml": "^2.8.1"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@types/node": "^24.10.0",
|
|
33
|
+
"typescript": "^5.9.3",
|
|
34
|
+
"vitest": "^4.0.8"
|
|
35
|
+
}
|
|
36
|
+
}
|