starlight-obsidian 0.2.0 → 0.3.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/index.ts +26 -11
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -37,6 +37,15 @@ const starlightObsidianConfigSchema = z.object({
|
|
|
37
37
|
* @default 'notes'
|
|
38
38
|
*/
|
|
39
39
|
output: z.string().default('notes'),
|
|
40
|
+
/**
|
|
41
|
+
* Whether the Starlight Obsidian plugin should skip the generation of the Obsidian vault pages.
|
|
42
|
+
*
|
|
43
|
+
* This is useful to disable generating the Obsidian vault pages when deploying on platforms that do not have access
|
|
44
|
+
* to the Obsidian vault. This will require you to build and commit the pages locally ahead of time.
|
|
45
|
+
*
|
|
46
|
+
* @default false
|
|
47
|
+
*/
|
|
48
|
+
skipGeneration: z.boolean().default(false),
|
|
40
49
|
/**
|
|
41
50
|
* The generated vault pages sidebar group configuration.
|
|
42
51
|
*/
|
|
@@ -126,20 +135,26 @@ export default function starlightObsidianPlugin(userConfig: StarlightObsidianUse
|
|
|
126
135
|
}
|
|
127
136
|
}
|
|
128
137
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
138
|
+
if (config.skipGeneration) {
|
|
139
|
+
logger.warn(
|
|
140
|
+
`Skipping generation of Starlight pages from Obsidian vault as the 'skipGeneration' option is enabled.`,
|
|
141
|
+
)
|
|
142
|
+
} else {
|
|
143
|
+
try {
|
|
144
|
+
const start = performance.now()
|
|
145
|
+
logger.info('Generating Starlight pages from Obsidian vault…')
|
|
132
146
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
147
|
+
const vault = await getVault(config)
|
|
148
|
+
const obsidianPaths = await getObsidianPaths(vault, config.ignore)
|
|
149
|
+
await addObsidianFiles(config, vault, obsidianPaths, logger)
|
|
136
150
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
151
|
+
const duration = Math.round(performance.now() - start)
|
|
152
|
+
logger.info(`Starlight pages generated from Obsidian vault in ${duration}ms.`)
|
|
153
|
+
} catch (error) {
|
|
154
|
+
logger.error(error instanceof Error ? error.message : String(error))
|
|
141
155
|
|
|
142
|
-
|
|
156
|
+
throwUserError('Failed to generate Starlight pages from Obsidian vault.')
|
|
157
|
+
}
|
|
143
158
|
}
|
|
144
159
|
|
|
145
160
|
addIntegration(starlightObsidianIntegration(config))
|