Skip to content

3C0D/obsidian-plugin-config

Repository files navigation

Obsidian Plugin Config

🎯 Injection system for standalone Obsidian plugins.

NPM Version License

Installation

npm install -g obsidian-plugin-config

Update

npm update -g obsidian-plugin-config

Commands

For Plugin Config Development

# Installation & Setup
yarn i                   # Install dependencies
yarn update-exports      # Update package.json exports

# Git & Version Management
yarn acp                 # Add, commit, push
yarn bacp                # Build + add, commit, push
yarn v                   # Update version

# Build & Testing
yarn build               # TypeScript check (no build needed)
yarn dev                 # Development build (watch mode)
yarn real                # Build to real vault
yarn lint, lint:fix      # ESLint verification/correction

# Injection (Development phase)
yarn inject-prompt       # Interactive injection
yarn inject-path         # Direct injection
yarn inject, check-plugin # Injection shortcuts

# NPM Publishing
yarn npm-publish         # Complete NPM workflow
yarn build-npm           # Alias for npm-publish

# Help
yarn help                # Show help

For Plugin Injection

# Interactive injection (recommended)
obsidian-inject
obsidian-inject ../my-plugin
yarn inject-prompt "../my-plugin"

# Automatic injection
obsidian-inject ../my-plugin --yes
yarn inject-path ../my-plugin --yes

# SASS injection (includes esbuild-sass-plugin)
yarn inject-sass ../my-plugin --yes

# Verification only
yarn check-plugin ../my-plugin

What is injected

  • Standalone local scripts: esbuild.config.ts, acp.ts, update-version.ts, etc.
  • package.json configuration: scripts, dependencies, yarn protection
  • tsconfig.json template: modern optimized TypeScript configuration
  • Automatic installation of dependencies with yarn
  • Traceability file: .injection-info.json (version, injection date)
  • 🎨 SASS support: Optional SASS/SCSS compilation with --sass option

Commands available after injection

yarn build          # Production build
yarn dev            # Development build + watch
yarn start          # Install dependencies + start dev
yarn real           # Build to real vault
yarn acp            # Add-commit-push
yarn bacp           # Build + add-commit-push
yarn v              # Update version
yarn release        # GitHub release
yarn help           # Full help

SASS Support

For plugins that use SASS/SCSS styling:

# Inject with SASS support
yarn inject-sass ../my-plugin --yes

# What gets added:
# - esbuild-sass-plugin dependency
# - SASS compilation in esbuild.config.ts
# - Automatic .scss file detection
# - CSS cleanup after compilation

SASS Features:

  • Automatic detection of .scss files in src/ directory
  • Priority order: src/styles.scss > src/styles.css > styles.css
  • Clean compilation with automatic main.css removal
  • Error handling with helpful messages

Architecture

The plugin becomes 100% STANDALONE after injection:

  • No external dependencies required
  • Scripts integrated locally
  • Updatable via re-injection
  • Yarn protection maintained
  • Compatible with all Obsidian plugins

Local Development (for contributors)

Installation

git clone https://github.com/3C0D/obsidian-plugin-config
cd obsidian-plugin-config
yarn install

As a Plugin (for testing NPM exports)

# Setup vault paths in .env
echo "TEST_VAULT=C:/path/to/test/vault" >> .env
echo "REAL_VAULT=C:/path/to/real/vault" >> .env

# Development mode
yarn start                # Start development mode
yarn dev                  # Watch mode for development
yarn real                 # Install to real vault

Local injection test

# Automatic injection
yarn inject ../my-plugin --yes

# Injection with prompts
yarn inject-prompt "../my-plugin"

Development Workflow

# Standard workflow
1. yarn i                # Install dependencies
2. Make changes to obsidian-plugin-config
3. yarn update-exports   # Update exports if needed
4. yarn lint:fix         # Fix any linting issues
5. yarn v                # Update version + commit + push GitHub
6. yarn npm-publish      # Complete NPM workflow

# Testing as plugin (optional)
yarn dev                 # Watch mode for development
yarn real                # Install to real vault

# Injection testing (development phase)
yarn inject ../test-plugin --yes

Key Commands Summary

# Essential workflow
yarn i                 # Install dependencies
yarn update-exports    # Update exports
yarn v                 # Update version + commit + push
yarn npm-publish       # Complete NPM workflow

# Development & testing
yarn dev               # Test as plugin (watch mode)
yarn lint:fix          # Fix code issues
yarn help              # Full help

Releases

No releases published

Packages

No packages published