Skip to content

vault/demo-vault/demo-vault-populate

Builds a complete PopulateFilesParams map for a plugin’s in-repo demo-vault/, ready to seed into the temp vault before Obsidian opens it. Composes readDemoVaultTree (the note tree) with the two pieces it deliberately omits: selected .obsidian/* config files, and the built binaries (+ data.json) of any extra community plugins the demo vault depends on (e.g. CodeScript Toolkit, demo-vault-helper).

Pairs with the enableCommunityPlugins option of the global-setup createSetup: this seeds the binaries, that turns them on. It intentionally does NOT write community-plugins.json — the harness owns that file (it lists the plugin-under-test), and enabling the extras persists them.

Stays synchronous, so an injected plugin whose binaries are absent is a throw rather than a download. demo-vault-bootstrap.ts owns the headless install the throw’s message points at — including buildDemoVaultPopulateAsync, the self-healing sibling of buildDemoVaultPopulate. The missing-plugin detection (resolveMissingInjectedPlugins) lives here and is shared with it, so the two paths cannot disagree about what “not installed” means.

Interface Description
BuildDemoVaultPopulateParams Parameters for buildDemoVaultPopulate.
InjectPluginParams A community plugin to seed into the demo vault alongside the note tree.
ResolveInjectedPluginStaleReasonParams Parameters for resolveInjectedPluginStaleReason.
ResolveMissingInjectedPluginsParams Parameters for resolveMissingInjectedPlugins.
Function Description
buildDemoVaultPopulate Builds the full populate map for a plugin’s demo-vault/: the note tree, the selected .obsidian/* config files, and every injected plugin’s binaries (+ optional data.json).
resolveInjectedPluginStaleReason Judges whether an installed copy of an injected plugin is too old to use, against its pinned InjectPluginParams.version and its InjectPluginParams.minVersion.
resolveMissingInjectedPlugins Selects the injected plugins that the headless bootstrap has to (re-)install — the exact set buildDemoVaultPopulate would otherwise throw on: those whose binaries are missing from the demo vault, and those whose installed copy is stale (see resolveInjectedPluginStaleReason). Plugins carrying an explicit InjectPluginParams.sourceDirectory are excluded: that names a local build output, not somewhere to download a published release into. Shared with the bootstrap so “missing” and “stale” each have one definition rather than two that can drift apart.