Skip to content

script-utils/build

This module provides utility functions to handle the build process for static assets and cleaning the build output folder. It includes functions to copy static files to the distribution folder and to remove the existing build output.

FunctionDescription
buildCleanRemoves the distribution folder and its contents. This function deletes the entire distribution folder to ensure a clean build environment.
buildCompileCompiles the code.
buildCompileSvelteCompiles the Svelte code.
buildCompileTypeScriptCompiles the TypeScript code. The general tsc pass runs with skipLibCheck: true (configured in tsconfig.json) so it does not fail on broken upstream .d.ts files we do not control. Afterwards, validateProjectTypes re-runs the type-check in-memory with skipLibCheck: false, reporting only diagnostics from the files we own, so the declarations we author are still fully validated.
buildTemplatesCopies all template files from the templates folder to the templates folder within the distribution folder. This function recursively reads the contents of the templates folder and copies each file to the corresponding path under ObsidianDevUtilsRepoPaths.DistTemplates, so consumers can copy the templates from node_modules/obsidian-dev-utils/dist/templates. A trailing .template on a source file name is stripped in the destination (e.g. eslint.config.mts.template is copied as eslint.config.mts), so an active config template can live in the repo under a name that the corresponding tool does not auto-discover.