Create-obsidian-plugin: scaffold (and later update) an Obsidian plugin project

create-obsidian-plugin is a scaffolding CLI for Obsidian plugin developers. A wizard generates a new plugin project, and the same command updates that project later, when the templates improve. It runs on your machine, needs no account, and talks to no external service.

How it works

Run it in the folder where the project should go:

npm create @mnaoumov/obsidian-plugin

pnpm create, yarn create and bun create work the same way. The wizard asks:

  1. Plugin id, name and description, your GitHub username and an optional funding link.
  2. A preset, or each tool one by one: bundler (esbuild, Parcel, Rollup, Vite, Webpack), UI framework (none, Lit, Preact, React, Solid, Svelte, Vue), linter, formatter, unit tests (Vitest, Jest), E2E tests, styling (CSS, CSS Modules, PostCSS, SCSS, Tailwind), WebAssembly, i18n, hot reload, GitHub Actions, issue templates and package manager (npm, pnpm, yarn, bun).

It then writes the project, installs its dependencies, and leaves a plugin that builds and passes its own lint and tests out of the box.

Example: no questions asked. Every answer can be passed as a flag:

npm create @mnaoumov/obsidian-plugin "--" --yes --pluginId=my-plugin

In PowerShell a bare -- is swallowed by PowerShell, so npm would read the flags itself; the double-quoted "--" works in PowerShell, cmd and bash alike. See The – separator in PowerShell.

Example: updating a project. Run the same command inside a project it generated. Files you have not touched are updated to the latest templates, and files you have customised are skipped with a warning.

What else it does

  1. Checks your manifest before you submit. The id, name and description are validated against the rules the Community directory’s automated review enforces, and the id is checked against the published plugins. This matters most for the id, which can never change once the plugin is published.
  2. Scriptable. Answers can also come from an answers file, and the wizard can save your answers as a script that reproduces the same project.
  3. Your own templates. --customTemplate=<dir> layers your own EJS templates over the built-in ones.

Presets

  1. All-in-one Framework (recommended): builds on my helper library and toolkits for building, linting, testing and releasing.
  2. Standalone: no dependency on my packages; every script is inlined in the project.
  3. Official sample plugin: exactly obsidianmd/obsidian-sample-plugin, with only your id, name, author and description filled in.
  4. Developer docs showcase: every code block of the Obsidian developer docs as a command you can run inside Obsidian.
  5. Demo: every feature switched on, to see what the options produce.

A sample of the output: Sample Plugin Extended.

Links

  1. Documentation
  2. GitHub repository
  3. npm package

Bug reports and feature requests: open an issue.