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.
Files changed (2) hide show
  1. package/index.ts +26 -11
  2. 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
- try {
130
- const start = performance.now()
131
- logger.info('Generating Starlight pages from Obsidian vault')
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
- const vault = await getVault(config)
134
- const obsidianPaths = await getObsidianPaths(vault, config.ignore)
135
- await addObsidianFiles(config, vault, obsidianPaths, logger)
147
+ const vault = await getVault(config)
148
+ const obsidianPaths = await getObsidianPaths(vault, config.ignore)
149
+ await addObsidianFiles(config, vault, obsidianPaths, logger)
136
150
 
137
- const duration = Math.round(performance.now() - start)
138
- logger.info(`Starlight pages generated from Obsidian vault in ${duration}ms.`)
139
- } catch (error) {
140
- logger.error(error instanceof Error ? error.message : String(error))
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
- throwUserError('Failed to generate Starlight pages from Obsidian vault.')
156
+ throwUserError('Failed to generate Starlight pages from Obsidian vault.')
157
+ }
143
158
  }
144
159
 
145
160
  addIntegration(starlightObsidianIntegration(config))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "starlight-obsidian",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "license": "MIT",
5
5
  "description": "Starlight plugin to publish Obsidian vaults.",
6
6
  "author": "HiDeoo <github@hideoo.dev> (https://hideoo.dev)",