Starting a new Obsidian plugin checklist

up:: Obsidian Plugin Development

  • Navigate to an empty directory
    • Remove any folders with rm -rf foldername
  • Open the Obsidian Sample Plugin and press use this template
  • Clone your fork: git clone https://github.com/YOURREPO .
    • I like to start by cloning one of my plugins instead sometimes: git clone https://github.com/selfire1/obsidian-luna-dark-mode .
  • Run npm i to initialise npm
  • Resetting the plugin
    • Delete unnecessary folders
    • Empty CHANGELOG.md
  • Update the documentation
  • Change the plugin name
    • manifest.json
      • Change id, name, version, description
    • manifest-beta.json
      • Copy and paste from manifest.json
    • package.json
      • Update name (which is id), version and description
    • workflows/release.yml: Change env.PLUGIN_NAME to id
  • Create a new repo on github
  • Initialise on git
    • If a .git folder already exists:
      • git remote add origin REPOURL
      • git branch -M main
      • git add .
      • git commit -m "🎉 init"
    • If a .git folder doesn’t exist
      • git init
      • git commit -m "🎉 init"
      • git branch -M main
      • git remote add origin REPOURL
      • git push -u origin main
    • Rename to main
      • git checkout -b main origin/master --no-track
      • git push -u origin main
      • git remote set-head origin main
    • Install standard version
    • Start developing!

  1. Install github cli via brewbrew install gh
  2. Set up Automatically Open the Current Directory in VS Code From Terminal
#vars
$plugin-id
$plugin-desc
$plugin-name
$plugin-start-version
$author
 
mkdir $plugin-id && cd $plugin-id
gh repo create -y -d "$plugin-desc" --public -p "https://github.com/obsidianmd/obsidian-sample-plugin"
 
echo "# $plugin-id" > README.md
sed 
-e -i 's/obsidian-sample-plugin/$plugin-id' 
-e -i 's/"Sample Plugin"/$plugin-name' 
-e -i 's/1.0.1/$plugin-start-version' 
-e -i 's/"This is a sample plugin for Obsidian. This plugin demonstrates some of the capabilities of the Obsidian API."/$plugin-desc' 
-e -i 's/"author": "Obsidian"/"author": \"$author\"'  manifest.json
 
touch manifest-beta.json
cat manifest.json > manifest-beta.json
 
sed
-e -i 's/obsidian-sample-plugin/$plugin-id'
-e -i 's/This is a sample plugin for Obsidian (https://obsidian.md)/$plugin-desc'
package.json
 
mkdir .github/workflows && cd .github/workflows
touch release.yml
 
echo "FILE" > release.yml
 
git init $plugin-id
 

This will create:

  • public repo
  • open in new vscode window