Skip to content

bootstrapDemoVault

Bootstraps a demo vault so its notes’ code-buttons work with no manual setup: installs CodeScript Toolkit from the community store (if it is not already installed), writes its settings, then enables it — writing the settings BEFORE enabling so a fresh enable loads it already configured, with no reload. If CodeScript Toolkit is already enabled but the settings just changed, it is reloaded (disabled then enabled) so it re-reads data.json; when the settings were already in place, nothing is reloaded (so a routine vault re-open does not re-run CodeScript Toolkit’s startup). CodeScript Toolkit then runs the vault’s startup.ts. Folder Notes is installed next, configured to treat README.md as a folder’s own note, so a vault whose notes are grouped into folders describes each group in the file explorer. Finally it closes Settings (so the notice cannot be raised inside the settings popout) and raises the sandbox notice describing the opened vault as a throwaway copy.

Import:

import { bootstrapDemoVault } from 'obsidian-dev-utils/obsidian/demo-vault-helper';

Signature:

function bootstrapDemoVault(params: BootstrapDemoVaultParams): Promise<void>

Parameters:

ParameterTypeDescription
paramsBootstrapDemoVaultParamsThe BootstrapDemoVaultParams.

Returns: Promise<void> — A Promise that resolves once CodeScript Toolkit is installed, configured, and enabled and the sandbox notice has been shown.


Links to this page: